[jboss-user] [JBoss Messaging] - can not catch excption when jboss as is down

tony9427 do-not-reply at jboss.com
Fri Oct 26 05:40:14 EDT 2007


Application environment: JBoss Application Server 4.2.1, JBoss Messaging 1.3.0

THere is a standalone application to receive jms in a while loop

When Jboss server is up, the application runs well.
But When I shutdown the JBoss server and restart it, the application can not run

Part of the code: I want to re-connect JBoss Message when JBoss is down
But it seems the application willl never go to #10 even JBoss is shut down.

 boolean reConnect = false;
  | #1 while (true){
  | #2     try{
  | #3 	if(reConnect){ // Try to connect JBoss Connection again
  | #4	    sf = new ServiceFactory(ic,"/ConnectionFactory");
  | #5	    reConnect = false;
  | #6	}	
  | #7	String message = receiver.receive(1000);
  | #8  }catch(Exception e){  
  | #9	// No exception is catched
  | #10     System.out.println("exception");
  | #11	reConnect = true;
  | #12  }
  | #13}

ow can I make the application running when jboss is restarted?

Some log information is detected: 


2007-10-26 17:34:52,633 ERROR [org.jboss.remoting.transport.bisocket.BisocketServerInvoker] unable to get secondary locator
  | org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [bisocket://192.168.164.172:4457/?clientMaxPoolSize=50&clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&dataType=jms&marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&numberOfRetries=1&socket.check_connection=false&timeout=0&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat]
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:530)
  | 	at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.transport(BisocketClientInvoker.java:353)
  | 	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
  | 	at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.getSecondaryLocator(BisocketClientInvoker.java:441)
  | 	at org.jboss.remoting.transport.bisocket.BisocketServerInvoker.createControlConnection(BisocketServerInvoker.java:204)
  | 	at org.jboss.remoting.transport.bisocket.BisocketServerInvoker$1.run(BisocketServerInvoker.java:949)
  | Caused by: java.net.ConnectException: Connection refused: connect
  | 	at java.net.PlainSocketImpl.socketConnect(Native Method)
  | 	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
  | 	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
  | 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
  | 	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
  | 	at java.net.Socket.connect(Socket.java:507)
  | 	at org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:187)
  | 	at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.createSocket(BisocketClientInvoker.java:360)
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:801)
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:526)
  | 	... 5 more
  | 2007-10-26 17:34:52,633 ERROR [org.jboss.remoting.transport.bisocket.BisocketServerInvoker] Unable to recreate control connection: InvokerLocator [null://192.168.164.172:3892/null]
  | java.io.IOException: unable to get secondary locator: Can not get connection to server. Problem establishing socket connection for InvokerLocator [bisocket://192.168.164.172:4457/?clientMaxPoolSize=50&clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&dataType=jms&marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&numberOfRetries=1&socket.check_connection=false&timeout=0&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat]
  | 	at org.jboss.remoting.transport.bisocket.BisocketServerInvoker.createControlConnection(BisocketServerInvoker.java:209)
  | 	at org.jboss.remoting.transport.bisocket.BisocketServerInvoker$1.run(BisocketServerInvoker.java:949)
  | 2007-10-26 17:34:58,551 WARN  [org.jboss.remoting.LeasePinger] LeasePinger[SocketClientInvoker[12789d2, bisocket://192.168.164.172:4457](5c4o4k4s-3b4bn5-f88ic34s-1-f88ic3ta-5)] failed to ping to server: Can not get connection to server. Problem establishing socket connection for InvokerLocator [bisocket://192.168.164.172:4457/?clientMaxPoolSize=50&clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&dataType=jms&marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&numberOfRetries=1&socket.check_connection=false&timeout=0&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat]


Please help, thanks in advance

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099178#4099178

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4099178



More information about the jboss-user mailing list