java.lang.SecurityException When Shutdowning JBoss
We can run following command when starting JBoss. We assume there are already jboss system user in OS.
Centossu jboss -c '$JBOSS_HOME/bin/run.sh -b 0.0.0.0 > /dev/null 2> /dev/null &'# Ubuntusudo -u jboss $JBOSS_HOME/bin/run.sh -b 0.0.0.0 > /dev/null 2> /dev/null &
Stopping jboss actually should be done by running this
Centossu jboss -c '$JBOSS_HOME/bin/shutdown.sh -S &'# for ubuntusudo -u jboss '$JBOSS_HOME/bin/shutdown.sh -S &'
But in my system this will Exception in thread "main" java.lang.SecurityException: Failed to authenticate principal=null, securityDomain=jmx-console. This is happen because likely we have enabled the interceptor in jmx-invoker-service.xml file in deploy folder. Then for shuttingdown jboss we should provide some credential that we can see at login-config.xml file in the conf folder.
So the shutdown command should be like this# Centossu jboss -c '$JBOSS_HOME/bin/shutdown.sh -S -u admin -p admin &'# for ubuntusudo -u jboss '$JBOSS_HOME/bin/shutdown.sh -S -u admin -p admin &'
Actually there still some exception when running this.
javax.management.InstanceNotFoundException: jboss.remoting:service=invoker,transport= bisocket,host=sudirman.nfsint.com,port=4457,JBM_clientMaxPoolSize=200,clientLeasePeriod=10000,clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper,dataType=jms,marshaller=org.jboss.jms.wireformat.JMSWireFormat,numberOfCallRetries=1,numberOfRetries=10,pingFrequency=214748364,pingWindowFactor=10,socket.check_connection=false,timeout=0,unmarshaller=org.jboss.jms.wireformat.JMSWireFormat is not registered.
and
2011-07-27 10:06:07,835 ERROR [org.jboss.remoting.transport.Connector] invalid Object Namejavax.management.InstanceNotFoundException: jboss.remoting:service=invoker,transport= socket,host=sudirman.nfsint.com,port=3873 is not registered.
But after running
ps ax | grep java
I cannot see any JBoss instance that still running. So I conclude that shutdowning has been done correcly. I will check the later issue when have time. Meanwhile those shutdowning command can be put into some script.