Topic
  • 2 replies
  • Latest Post - ‏2013-07-19T20:26:48Z by XVQG_Anwarul_Azim
XVQG_Anwarul_Azim
XVQG_Anwarul_Azim
15 Posts

Pinned topic Getting "Server did not stop: return code = 2" when trying to stop server through liberty controller

‏2013-07-15T21:25:19Z |

Hi there,

I am trying to stop and start a liberty server through a liberty controller following the tutorial https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/labs/Lab-CollectivesClusters.pdf.  But I get Server did not stop: return code = 2 message all the time. I traced down to python scripts that it comes from stopServerResults = serverCommand.stop(host,usrdir,serverName,options) function in stopServer.py script. My question is how to find out what is the error or what I need to do successfully stop the server. This is my total message when I run stopServer.py in debug mode:

Connecting to the server...
Successfully connected to the server "redhatlsf2:9443"
com.ibm.ws.jmx.connector.client.rest.internal.RESTMBeanServerConnection@3969dc67
stdErr= None
stdOut= None
returnCode= 2
Server did not stop: return code = 2

Please let me know. I believe the JMX connection is successfully established from this upper message. If not, how to find out which parameter is wrong for stopServer.py script when it executes.

Thanks-Anwarul

  • MichaelThompson
    MichaelThompson
    4 Posts

    Re: Getting "Server did not stop: return code = 2" when trying to stop server through liberty controller

    ‏2013-07-19T13:46:32Z  

    Hi Anwarul,

    The operations on the ServerCommandsMBean behave exactly as the wlp/bin/server command does with respect to their standard output, error and return code. The return code of 2 indicates that the server does not exist. What is likely the error is that the arguments to the MBean invocation are incorrect.

     

    For example, if your environment is:
    host = sys.myhost.com
    userdir = /opt/wlp
    serverName = myServer

    Then your invocation would be serverCommand.stop("sys.myhost.com", "/opt/wlp", "myServer"). Please note that the server will consider its host name to whatever the value of the defaultHostName variable is in the server.xml. If the value of defaultHostName="sys" instead of "sys.myhost.com", then you will need to use the value "sys" in the serverCommand.stop invocation.

    Hope that helps.

    Thanks,
    Mike

     

  • XVQG_Anwarul_Azim
    XVQG_Anwarul_Azim
    15 Posts

    Re: Getting "Server did not stop: return code = 2" when trying to stop server through liberty controller

    ‏2013-07-19T20:26:48Z  

    Hi Anwarul,

    The operations on the ServerCommandsMBean behave exactly as the wlp/bin/server command does with respect to their standard output, error and return code. The return code of 2 indicates that the server does not exist. What is likely the error is that the arguments to the MBean invocation are incorrect.

     

    For example, if your environment is:
    host = sys.myhost.com
    userdir = /opt/wlp
    serverName = myServer

    Then your invocation would be serverCommand.stop("sys.myhost.com", "/opt/wlp", "myServer"). Please note that the server will consider its host name to whatever the value of the defaultHostName variable is in the server.xml. If the value of defaultHostName="sys" instead of "sys.myhost.com", then you will need to use the value "sys" in the serverCommand.stop invocation.

    Hope that helps.

    Thanks,
    Mike

     

    Thanks very much. It worked for me.