2 Replies Latest reply on Apr 25, 2013 1:52 AM by S V S G Krishna Murthy K

    Socket TimedOut Exception When Pushing Message to JBOSS 7 Messaging Queue

    S V S G Krishna Murthy K Novice

      Hi,

       

      I'm usnig JBOSS-7.0.1 Final Version.I'm getting SocketTimedOut Connection when I'm sending the message to JBOSS Messaging Queue.Here is the Code

       

      Hashtable<Object, String> env = new Hashtable<Object, String>();

      Connection connection = null;

      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

      env.put(Context.PROVIDER_URL, "remote://192.168.2.47:4447");

      env.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces:org.jboss.naming");   

      env.put(Context.SECURITY_AUTHENTICATION, "simple");

      ConnectionFactory connectionFactory=null;

      connectionFactory = (ConnectionFactory) initialContext.lookup("jms/RemoteConnectionFactory");

      Queue queue = (Queue) initialContext.lookup(queueName);

      connection = connectionFactory.createConnection("guest","india");   

      Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);

      MessageProducer sender = session.createProducer(queue);

      TextMessage message = session.createTextMessage(textMessage);

      sender.send(message);

      connection.start();

      connection.close();

       

      Please suggest me how to resolve this SocketTimeOut Exception..JBOSS is running in linux,While starting server I'm starting using standalone.sh -c standalone-full.xml

       

      Please find attached standlonefull.xml

       

      java.net.SocketTimeoutException: connect timed out

          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 org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.connect(OioClientSocketPipelineSink.java:114)

          at org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.eventSunk(OioClientSocketPipelineSink.java:74)

          at org.jboss.netty.channel.Channels.connect(Channels.java:541)

          at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:210)

          at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:227)

          at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:188)

          at org.hornetq.core.remoting.impl.netty.NettyConnector.createConnection(NettyConnector.java:473)

          at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:1143)

          at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnectionWithRetry(ClientSessionFactoryImpl.java:993)

          at org.hornetq.core.client.impl.ClientSessionFactoryImpl.connect(ClientSessionFactoryImpl.java:224)

          at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:747)

          at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:601)

          at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:119)

          at com.tree.Test.sendMessage(Test.java:99)

          at com.tree.Test.main(Test.java:24)

      javax.jms.JMSException: Failed to create session factory

          at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:605)

          at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:119)

          at com.tree.Test.sendMessage(Test.java:99)

          at com.tree.Test.main(Test.java:24)

      Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.]

          at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:769)

          at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:601)

          ... 3 more