RE: Shutdown openjms server (0.7.6.1) and all of its threads without stopping vm
"Tim Anderson" <[email protected]>
| Newsgroups | gmane.comp.java.openjms.user |
|---|---|
| Message-ID | <[email protected]> |
Here is a solution for SwiftMQ from <http://www.swiftmq.com/developers/howto_jmsintravm_was5/> http://www.swiftmq.com/developers/howto_jmsintravm_was5/ SwiftMQ 4.x uses JMS 1.1 but WebSphere 5.0 includes JMS 1.0.2 classes in "lib/j2ee.jar" so you have to delete all "javax/jms" classes out of this jar file. Then copy "jms.jar" from the router's "jars/" directory to WebSphere's "lib/" directory. You should be able to do the same in order to deploy 0.7.7. -Tim _____ From: openjms-user-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:openjms-user-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Simon Bredel Sent: Monday, 6 February 2006 8:54 PM To: [email protected] Subject: RE: [openjms-user] Shutdown openjms server (0.7.6.1) and all of its threads without stopping vm Hello, first at all thanks for the quick reply. The reason why I can't use JMS 1.1 is that another application which connects to the JMS Server has to run inside a IBM WebSphere 5.1.0 Application Server. WebSphere uses JMS to communicate between the different VMs it runs (maybe this is not 100% correct, I'm not a WebSphere Expert), so in each VM there are already the JMS libraries loaded, the JMS 1.0.2b libraries. I didn't see a possibility to load the JMS 1.1 libraris inside WebSphere, so I used OpenJMS 0.7.6.1 and the JMS 1.0.2 API. [email protected] schrieb am 05.02.06 05:37:22: You can't shut down an embedded server cleanly in 0.7.6 when using TCP, HTTP, or RMI connectors, without performing a System.exit(). Can you explain the reason you can't use the JMS 1.1 API? It's backward compatible with 1.0.2. The above has been resolved in 0.7.7, which uses JMS 1.1. _____ From: openjms-user-admin-5NWGOfrQmneRv+LV9MX5uv+2+P5yyue3@public.gmane.org t [mailto:openjms-user-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Simon Bredel Sent: Friday, 3 February 2006 10:43 PM To: [email protected] Subject: [openjms-user] Shutdown openjms server (0.7.6.1) and all of its threads without stopping vm Hello, I'm trying to run a openjms server inside a tomcat. Because it is necessary that the jms server can be stopped and restarted via the Tomcat manager web application, I wrote the class attatched below to start and stop the server as a spring bean. Spring calls the afterPropertiesSet() method on startup and the destroy() method on shutdown. The Problem on shutdown is, that the org.exolab.jms.server.AdminConnection.stopServer() also stops the java vm by calling System.exit(0), what stopped the whole Tomcat in my case. To! avoid this, I removed this line in the code to test what happens. The vm staid alive, but trying to restart ended with an exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsServer' defined in ServletContext resource [/WEB-INF/jms-broker.xml]: Initialization of bean failed; ! nested exception is org.exolab.jms.server.ServerException: Failed to initialise server for the tcp connector org.exolab.jms.server.ServerException: java.net.BindException: Address in use: JVM_Bind at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:447) at java.net.ServerSocket.<init>(ServerSocket.java:165) at org.exolab.core.mipc.MultiplexConnectionServer.<init>(MultiplexConnectionSer ver.java:135) at ! org.exolab.core.mipc.MultiplexConnectionServer.<init>(MultiplexC onnectionServer.java:118) at org.exolab.jms.server.mipc.IpcJmsServer.createServer(IpcJmsServer.java:236) at org.exolab.jms.server.mipc.IpcJmsServer.init(IpcJmsServer.java:129) &nb! sp; at org.exolab.jms.server.JmsServer.initConnector(JmsServer.j ava:367) at org.exolab.jms.server.JmsServer.initConnectors(JmsServer.java:321) at org.exolab.jms.server.JmsServer.init(JmsServer.java:197) I can see that there are still some threads alive after the admin.stopServer() method has called and one of of it still uses the needet port. The Threads I recognized were: - PDM-LockManager - Missing message castor.misc.threadLocalDaemonName - two other unnamed Threads started by the JmsServer.init() method I have made shure that all clients who had been connected to the server ha! ve been closed, so are their connections and sessions. I browsed the archive for solutions but couldn't find an answer. Does anybody know a solution for my problem? Unfortunately I am bound to JMS 1.0.2 so I am using openjms-0.7.6.1 and cannot change to an actual version of openjms. The Tomcat version I use is 4x. ! ; The class I modified (org.exolab.jms.server.AdminConnection): public void stopServer() { // todo perform neccesary clean up for a much nicer shutdown. // probably should inform all clients. _log.info("Stopping all services"); ServiceManager.instance().removeAll(); _log.info("Server Shutdown scheduled for 5 secs"); Runnable r = new R! unnable() { &nbs p; public void run() { try { Thread.sleep(5000); --! > // dont shut down java vm --> // System.exit(0); } catch (Exception err) { // } } }; Thread t = new Thre! ad(r); t.start(); } My class: public class JmsServer implements InitializingBean, DisposableBean{ private JmsServer jmsServer = null; private String configPath = null; private String lockPath = null; private String adminConnectionUrl = null; public void setConfig(String configPath){ this.configPath = configPath; } public void setLock(String lockPath){ this.lockPath = lockPath; } public void setAdminConnectionUrl(String url) { this.adminConnectionUrl = u! rl; } &nbs p; /* (non-Javadoc) * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */ public void afterPropertiesSet() throws Exception { ! String webappRoot = System.getProperty("webapp.root "); String absoluteLockPath = webappRoot + this.lock; File file = new File(absoluteLockPath); if (file.exists()){ file.delete(); } String absoluteConfigPath = webappRoot + this.config; &n! bsp; this.broker = new JmsServer(absoluteConfigPath); this.broker.init(); } /* (non-Javadoc) * @see org.springframework.beans.factory.DisposableBean#dest! roy() */ public void destroy() throws Exception { JmsAdminServerIfc admin = AdminConnectionFactory.create(this.adminConnectionUrl); admin.stopServer(); } } <https://img.web.de/p.gif> Erweitern S ie FreeMail zu einem noch leistungsstarkeren E-Mail-Postfach! Mehr Infos unter <http://freemail.web.de/home/landingpad/?mc=021131> http://freemail.web.de/home/landingpad/?mc=021131