7 Replies Latest reply on Feb 5, 2003 11:54 AM by Rémi Bonefoy

    JMS Queue - Failed to connect from standalone application

    Rémi Bonefoy Newbie

      Hi,

      I use JBoss-3.0.4 on a Linux (Red Hat 7.3) server and JDK 1.4.0_02.

      I deployed a simple MessageDrivenBean listening to the queue queue/testQueue.

      Now, I'm trying to run a standalone application running on W2K machine whith JDK 1.3.1_01. Here is the main code :

      Hashtable props = new Hashtable() ;
      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory") ;
      props.put(Context.PROVIDER_URL, "jnp://jetb:1099") ;
      props.put( Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      //props.put( "java.naming.rmi.security.manager", "yes");
      props.put( Context.SECURITY_PRINCIPAL, "john" );
      props.put( Context.SECURITY_CREDENTIALS, "neddle" );
      InitialContext context = new InitialContext(props) ;
      QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup("ConnectionFactory") ;
      QueueConnection queueConnection = queueFactory.createQueueConnection() ;
      QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE) ;
      Queue queue = (Queue)context.lookup("queue/testQueue") ;
      QueueSender queueSender = queueSession.createSender(queue) ;
      TextMessage message = queueSession.createTextMessage();
      message.setText("Hello...") ;
      queueSender.send(queue, message) ;
      queueSession.close() ;
      queueConnection.close() ;

      The bold line throws this exception :
      javax.naming.CommunicationException. Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
      java.net.ConnectException: Connection refused: connect
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:445)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at ejb.jboss.SimpleQueueSender.main(SimpleQueueSender.java:36)
      Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:161)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
      at java.net.Socket.connect(Socket.java:425)
      at java.net.Socket.connect(Socket.java:375)
      at java.net.Socket.(Socket.java:290)
      at java.net.Socket.(Socket.java:118)
      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:122)
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
      ... 8 more


      Despite my searches, i can't solve this problem. So what I am doing wrong ?



      Thanks,

      remi