I suspect that is you are seeing the connection error more than once, that the connection error is always the problem, even when not reported. So let's try to see if we can solve that. First, it will help if you ran the shutdown.bat manually - then we can try different options and see what works and what does not (all that shutting down the service does is call shutdown.bat, you can see it in the service.bat file). Try running this from a command prompt (with the service started), from the JBoss AS bin directory:
shutdown -S -s localhost:1099
Did you change the ports that JBoss AS uses, particularly the JNDI port? The JNDI port is 1099 by default.
Have you changed the stc/hosts file? Particularly, did you add localhost to it?
Started the JBoss with net start, and then shut it down with: shutdown -S -s localhost:1099
No output to shutdown.log, but run.log shows a successfull shutdown.
.r.lock is still there along with the java.exe.
I didn't change the JNDI port, and etc/hosts only has 127.0.0.1 localhost
JBoss-service.xml:<mbean code="org.jnp.server.NamingBeanImpl" name="jboss:service=NamingBeanImpl" xmbean-dd="resource:xmdesc/NamingBean-xmbean.xml" />- <mbean code="org.jboss.naming.NamingService" name="jboss:service=Naming" xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
bindings-jboss-beans.xml- <bean class="org.jboss.services.binding.ServiceBindingMetadata"><property name="serviceName">jboss:service=Naming</property><property name="bindingName">Port</property><property name="port">1099</property><property name="description">The listening socket for the Naming service</property></bean>- <bean class="org.jboss.services.binding.ServiceBindingMetadata"><property name="serviceName">jboss:service=Naming</property><property name="bindingName">RmiPort</property><property name="port">1098</property><property name="description">Socket Naming service uses to receive RMI requests from client proxies</property></bean>
What version of Windows are you using? If Vista, Server 2008 or 7, in the Task Manager, on the Processes tab, add the Command Line column. Then post the contents of that column for the java.exe process. Also, post the value in the Threads column.
For XP, Server 2003, or if the command line is truncated or not present in Task Manager, get Process Explorer from Winternals. It will show the full command line for the java.exe process.
Also look in the jboss_home/server/xxx/log/server.log file and verify that JBoss AS received the shutdown message. You should see an entry like this:
2010-04-06 09:36:28,806 INFO [org.jboss.bootstrap.microcontainer.ServerImpl] (RMI TCP Connection(4)-127.0.0.1) Shutting down the server, blockingShutdown: false
Thank you Peter. Your questions led to the discovery of the problem.
The OS is Windows 2003 Server, so I used Process Explorer to find the command line that the guilty process was assigned to.
The stuck process was assigned to the PowerBuilder Application Server plugin java.exe. I thought that I was starting JBoss without starting the power builder plugin (service.bat was calling run.bat). This appears not to be the case. The installer for the Powerbuilder plugin apparently added some hooks to the JBoss startup process so that it starts whenever JBoss is started. I haven't connected all the dots here, but Process Explorer clearly shows the Power Builder plugin java.exe starting with JBoss.
Additionally starting JBoss manually (run.bat) also starts the power builder plugin java.exe, and it stays running after running shutdown -S -s localhost:1099. The difference is that I can re-start JBoss manually indefinitely. Only the service.bat (windows service) recognizes the .r.lock file hold.
Solution for me is to uninstall the powerbuilder plugin and perhaps reinstall JBoss.