• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3373
  • Last Modified:

stop jboss server in Linux

Hi, Here I have tried to stop jboss server in Linux .  This seems does not work. Could you please tell where is the problem ?

Please find the file attached. Sensitive information has been masked.
  • 5
  • 5
  • 4
  • +2
5 Solutions
just use the kill command
kill pid

it will not kill the JBoss, just will signal it to close
JBoss will shutdown gracefully
also, if you have multiple IPs on that server, JBoss might bind some ports only to some IP

issue a "netstat -na" and find out the listening port and IP
First Way to stop gracefully :

# cd  /home/jboss/bin/
# ./shutdown.sh -S

If it work then good , otherwise force stop :

Log on via root

# ps -ef | grep jboss

You will find PID

# kill -9 PID
Managing Security & Risk at the Speed of Business

Gartner Research VP, Neil McDonald & AlgoSec CTO, Prof. Avishai Wool, discuss the business-driven approach to automated security policy management, its benefits and how to align security policy management with business processes to address today's security challenges.

kill -9 should be the almost the last thing you try (before rebooting)
/home/jboss/bin/shutdown.sh -S

Check this

try to Set up all the permissions and run levels like this:

sudo chown root:root /etc/init.d/jboss
sudo chmod ug+x /etc/init.d/jboss

ln -s /etc/rc.d/init.d/jboss /etc/rc3.d/S84jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc4.d/S84jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc5.d/S84jboss

ln -s /etc/rc.d/init.d/jboss/etc/rc6.d/K15jboss
ln -s /etc/rc.d/init.d/jboss/etc/rc0.d/K15jboss
ln -s /etc/rc.d/init.d/jboss/etc/rc1.d/K15jboss
ln -s /etc/rc.d/init.d/jboss/etc/rc2.d/K15jboss

and try to start up like :
$ /etc/init.d/./jboss start or $ /etc/init.d/./jboss stop


Stopping JBoss, if you launched JBoss from the command line, the easiest way to stop it is to press ctrl-C.  JBoss should begin it's shutdown. (OR) ./shutdown.sh -S in jboss bin folder.
cofactorAuthor Commented:
>>/home/jboss/bin/shutdown.sh -S

my jboss start is a bind to host and started as a service . Is not we should stop as a service ?

>>>just use the kill command
>>kill pid

Is it not  good to stop the service  ? is there any way for that ?

Also, how do we know  the startup status when I start jboss as a service ? it does not return anything ..seems things are in the background . How do I know the startup status ?  
look in the log files
look at boot.log - notice the timestamp
look at server.log from the timestamp of the boot.log

also ... to kill a service you might need root rights

Use this following command to stop the server:-

% ./shutdown.sh --host=myremotemachineOrIP -S

Try providing your machine's ip address instead of "localhost".

and also check the boot & server logs in jboss

cofactorAuthor Commented:
>>>look at boot.log - notice the timestamp
>>>look at server.log from the timestamp of the boot.log

why timestamp is required here ? I dont understand why you are telling to note the timestamp . why do I need that ?
to see the log at the time the server started ....
> root@me-helobox:~# sudo /etc/init.d/jboss stop
> JBOSS_CMD_START = cd /home/jboss/bin; /home/jboss/bin/run.sh -c default -b
Could you post
cofactorAuthor Commented:
>>>Could you post

Yes. But I may not post the entire server details in public . Would you like to see any specific portion ?

Please tell me which portion you would like to check ..I'd copy that part and post it here.

You may tell me which Tag to copy from those files so that it would be helpful to check
1. Please tye to use
/home/jboss/bin/shutdown.sh -S
to see if this typical command can stop your jboss smoothly
If not, then it could be some configuration issue in jboss;
If this way shutdown ok, then the issue is inside your script.

2. The way you stop jboss show the "JBOSS_CMD_START..."
> root@me-helobox:~# sudo /etc/init.d/jboss stop
> JBOSS_CMD_START = cd /home/jboss/bin; /home/jboss/bin/run.sh -c default -b
Then shows the error messages. It seems that there is some command/configuration in /etc/init.d/jboss or /home/jboss/bin/run.sh might cause the issue.
So it might be helpful to troubleshooting if you can provide those two scripts.
If there is confidential stuff in there, then you can examine those two scripts by yourself.
Assume those two are shell scripts. Run them with debugging information like this
# sudo sh -x /etc/init.d/jboss stop
and if it calls /home/jboss/bin/run.sh, then please add "sh -x" in front of  "/home/jboss/bin/run.sh"
cofactorAuthor Commented:
>>>>Please tye to use
>>/home/jboss/bin/shutdown.sh -S
>>to see if this typical command can stop your jboss smoothly

when I run the above I get this ..

 /home/jboss/bin/shutdown.sh -S
Exception in thread "main" java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
        java.net.ConnectException: Connection refused]
        at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:338)
        at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
        at org.jboss.Shutdown.main(Shutdown.java:235)
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
        java.net.ConnectException: Connection refused]
        at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:101)
        at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1886)
        at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1856)
        at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)
        ... 2 more
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
        java.net.ConnectException: Connection refused
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
        at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
        at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:97)
        ... 7 more
Caused by: java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:529)
        at java.net.Socket.connect(Socket.java:478)
        at java.net.Socket.<init>(Socket.java:375)
        at java.net.Socket.<init>(Socket.java:189)
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
        ... 12 more
cofactorAuthor Commented:
>>>ps -ef | grep jboss

This shows the list   but not formatted . Hence I find difficult to identify the jboss process id.

Could you please modify the above command so that this prints a nicely formatted  listing . This will help me to dentify the  process id for jboss and thereafter to kill this process.

I'm using putty.exe to connect to server.
>  I find difficult to identify the jboss process id.
pgrep jboss

pkill jboss
 to kill jboss
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 5
  • 5
  • 4
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now