Internal Server Error while starting the Weblogic Server using RESTful API

When you are trying to start the Managed server using weblogic management REST API ,  sometimes you get Internal Server Error but the server will be started though.

 

Issue snippet:

 

aksarav@mwinventory.in:/apps/oracle-weblogic/domains/mwidomain/bin$ curl -v \
> – user weblogic:weblogic1 \
> -H Content-Type:application/json \
> -H Host:localhost \
> -H X-Requested-By:MyClient \
> -H Accept:application/json \
> -d "{}" \
> -X POST http://localhost:17001/management/weblogic/latest/domainRuntime/serverLifeCycleRuntimes/mwiserver3/start
Note: Unnecessary use of -X or – request, POST is already inferred.
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 17001 (#0)
* Server auth using Basic with user 'weblogic'
> POST /management/weblogic/latest/domainRuntime/serverLifeCycleRuntimes/mwiserver3/start HTTP/1.1
> Host:localhost
> Authorization: Basic d2VibG9naWM6d2VibG9naWMx
> User-Agent: curl/7.54.0
> Content-Type:application/json
> X-Requested-By:MyClient
> Accept:application/json
> Content-Length: 2
> 
* upload completely sent off: 2 out of 2 bytes
< HTTP/1.1 500 Internal Server Error
< Connection: close
< Date: Thu, 15 Mar 2018 04:03:20 GMT
< Content-Length: 21
< Content-Type: text/html; charset=UTF-8
< X-ORACLE-DMS-ECID: 68047f27-b535-4c93-8a78-b595cef5d024-0000003b
< X-ORACLE-DMS-RID: 0
< Set-Cookie: JSESSIONID=OX4n05OecYPunHUtRxgC54H0JY6i1bYkLmIKBwx0crNZcm6MRHdr!-881645436; path=/; HttpOnly
< 
* Closing connection 0
Internal Server Error

 

Solution

 

The solution is very simple, Just make sure you are using the correct header values. Especially the Host. I had to update the Host Header value to localhost:17001 from localhost and that fixed my issue.

here is the successful request Snippet

aksarav@mwinventory.in:/apps/oracle-weblogic/domains/mwidomain/bin$ curl -v \
> – user weblogic:weblogic1 \
> -H Content-Type:application/json \
> -H Host:localhost:17001 \
> -H X-Requested-By:MyClient \
> -H Accept:application/json \
> -d "{}" \
> -X POST http://localhost:17001/management/weblogic/latest/domainRuntime/serverLifeCycleRuntimes/mwiserver1/start
Note: Unnecessary use of -X or – request, POST is already inferred.
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 17001 (#0)
* Server auth using Basic with user 'weblogic'
> POST /management/weblogic/latest/domainRuntime/serverLifeCycleRuntimes/mwiserver1/start HTTP/1.1
> Host:localhost:17001
> Authorization: Basic d2VibG9naWM6d2VibG9naWMx
> User-Agent: curl/7.54.0
> Content-Type:application/json
> X-Requested-By:MyClient
> Accept:application/json
> Content-Length: 2
>
* upload completely sent off: 2 out of 2 bytes
< HTTP/1.1 200 OK
< Date: Thu, 15 Mar 2018 04:06:10 GMT
< Content-Length: 865
< Content-Type: application/json
< X-ORACLE-DMS-ECID: 68047f27-b535-4c93-8a78-b595cef5d024-00000042
< X-ORACLE-DMS-RID: 0
< Set-Cookie: JSESSIONID=2kEn1iwYzyuI1WS93hulNBs-p4W7Y-CyggyE4cuvviGgtH5jFq7d!-881645436; path=/; HttpOnly
<
{
    "links": [{
        "rel": "job",
        "href": "http:\/\/localhost:17001\/management\/weblogic\/latest\/domainRuntime\/serverLifeCycleRuntimes\/mwiserver1\/tasks\/_7_start"
    }],
    "identity": [
        "serverLifeCycleRuntimes",
        "mwiserver1",
        "tasks",
        "_7_start"
    ],
    "running": false,
    "systemTask": false,
    "endTimeAsLong": 1521086784402,
    "name": "_7_start",
    "progress": "success",
    "description": "Starting mwiserver1 server ...",
    "serverName": "mwiserver1",
    "taskError": null,
    "startTimeAsLong": 1521086770207,
    "type": "ServerLifeCycleTaskRuntime",
    "operation": "start",
    "taskStatus": "TASK COMPLETED",
    "parentTask": null,
    "completed": true,
    "intervalToPoll": 1000,
    "startTime": "2018-03-15T09:36:10.207+05:30",
    "endTime": "2018-03-15T09:36:24.402+05:30"
* Connection #0 to host localhost left intact
}