7 Replies Latest reply on Feb 5, 2003 11:54 AM by remi

    JMS Queue - Failed to connect from standalone application

    remi

      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

        • 1. Re: JMS Queue - Failed to connect from standalone applicatio
          joelvogt

          whenever redhat is involved in this it generally is the /etc/hosts file.

          • 2. Re: JMS Queue - Failed to connect from standalone applicatio
            genman

            The previous poster is probably right, check your /etc/hosts file. Type /sbin/ifconfig and make sure that 127.0.0.1 is listed. I just installed RedHat 9, and it is mostly trouble-free, though it took some coorcing to get the domain name right while running DHCP.

            • 3. Re: JMS Queue - Failed to connect from standalone applicatio
              remi

              Hi,

              I saw, on this forum or sun's forum, something like that.

              Here is the content of my /etc/hosts file :

              127.0.0.1 jetb localhost.localdomain localhost
              192.1.1.218 jeta
              192.1.1.217 jetb


              When i run /sbin/ifconfig i get 192.1.1.217 for eth0 and 127.0.0.1 for loopBack.

              The server doesn't get its ip via DHCP.

              Thanks for your answer.

              Remi

              • 4. Re: JMS Queue - Failed to connect from standalone applicatio
                crackers

                Take "jetb" out of the 127.0.0.1 line and you should be okay. This is one of those weird things that RedHat's done for ages and, for some reason, seem to think it's "the right way" to do a hosts file.

                • 5. Re: JMS Queue - Failed to connect from standalone applicatio
                  remi

                  Thanks for the tips,

                  I get another exception, so i think the connection problem is solved.. :)

                  Do you have a solution for this :

                  javax.naming.NamingException: Invalid reference. Error: org.jboss.mq.il.oil.OILServerIL; local class incompatible: stream classdesc serialVersionUID = 5576846920031604128, local class serialVersionUID = -8979254837130462322

                  I followed advices from a post of this forum : clear the temporary files of the jboss server, but the exception is still here.

                  The jars i use for the client are those provided with jboss 3.0.0 and my server is running the version 3.0.4. This may be a trouble ?

                  I use also java 1.3.1 on the client side and java 1.4.0 on then server side.

                  Thanks for the reply,

                  Remi

                  • 6. Re: JMS Queue - Failed to connect from standalone applicatio
                    joelvogt

                    >The jars i use for the client are those provided with jboss >3.0.0 and my server is running the version 3.0.4. This may >be a trouble ?
                    yep

                    >I use also java 1.3.1 on the client side and java 1.4.0 on >then server side.
                    maybe

                    • 7. Re: JMS Queue - Failed to connect from standalone applicatio
                      remi

                      Hi,

                      You're right joelvogt, using the same jars on client and server sides solve my connection problem : no more exception... but the MDB is not created... and so doesn't receive messages.

                      In the jar i deployed, i put the MDB class file, the ejb-jar.xml and jbos.xml files configured like in the doc.

                      The deployement is OK, the messages are stored in the jboss tmp files...

                      What I'm doing wrong !

                      Remi