8 Replies Latest reply on May 16, 2003 6:13 AM by mars73

    Messaging

    trugbild

      I've written a very, very short program, which sould be able to send messages to a queue, but it doesn't run...
      Here's the code:

      Properties env = new Properties();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "localhost:1099");
      Context ctx = new InitialContext(env);

      // 1: Lookup ConnectionFactory via JNDI
      QueueConnectionFactory factory = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");

      // 2: Use ConnectionFactory to create JMS connection
      QueueConnection connection = factory.createQueueConnection();

      The last line causes a java.net.SocketException.
      I really do not know why???

      And what I also do not know is why my responses to the topic in the JMS-Forum on jboss.org do not appear after posting them...

        • 1. Re: Messaging
          trugbild

          PS: I'm testing it with jboss 3.2 - the one, where everything has changed again...

          • 2. Re: Messaging

            Post the full stack trace.

            The posts don't appear because Jive is broken.

            Regards,
            Adrian

            • 3. Re: Messaging
              trugbild

              The Stack-Trace is:

              java.net.SocketException: Connection reset
              at java.net.SocketInputStream.reas(SocketInputStream.java:168)
              at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
              at java.io.BufferedInputStream.read(BufferedInputStream.java:201
              at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2133)
              at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInptStream.java:2316)
              at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2383)
              at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2455)
              at java.ip.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2604)
              at java.io.ObjectInptStream.readByte(ObjectInputStream.java:845)
              at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:205)
              at java.lang.Thread.run(Thread.java:536)

              and that's all...

              • 4. Re: Messaging
                trugbild

                Another problem - probably related to the first one - is, I can't find the "QueueConnectionFactory". Where do I have to configure it?

                • 5. Re: Messaging

                  The server cannot connect back to the client
                  for some reason, usually a network config problem.

                  There is no QueueConnectionFactory, just
                  ConnectionFactory.

                  The jndi name is defined in jbossmq-service.xml

                  You will find the same answers already posted
                  over the last month.

                  Regards,
                  Adrian

                  • 6. Re: Messaging
                    trugbild

                    >The server cannot connect back to the client
                    >for some reason, usually a network config problem.
                    A network config problem on my local machine??? How is THIS possible?

                    • 7. Re: Messaging
                      trugbild

                      I've found the solution: This exception occurs, if you don't close the connection!

                      Thanks for your help, Adrian.

                      • 8. Re: Messaging
                        mars73

                        i am also trying to write and run a simple sender and receiver via JMS. But cant fig out y it cannot work..

                        Where on earth do i define my user?

                        My stack as below
                        -----------------

                        Start receving messages.....
                        Exception in thread "main" org.jboss.mq.SpyJMSException: Cannot authenticate user; - nested throwab
                        e: (java.net.SocketException: Option unsupported by protocol: connect)
                        at org.jboss.mq.Connection.authenticate(Connection.java:883)
                        at org.jboss.mq.Connection.(Connection.java:238)
                        at org.jboss.mq.Connection.(Connection.java:315)
                        at org.jboss.mq.SpyConnection.(SpyConnection.java:59)
                        at org.jboss.mq.SpyConnectionFactory.createQueueConnection(SpyConnectionFactory.java:116)
                        at com.helplab.Receiver.setupQueue(Receiver.java:27)
                        at com.helplab.Receiver.receive(Receiver.java:39)
                        at com.helplab.Receiver.main(Receiver.java:68)
                        + nested throwable: java.net.SocketException: Option unsupported by protocol: connect
                        at java.net.PlainSocketImpl.socketConnect(Native Method)
                        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:345)
                        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:157)
                        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:144)
                        at java.net.Socket.(Socket.java:294)
                        at java.net.Socket.(Socket.java:148)
                        at javax.net.DefaultSocketFactory.createSocket(Unknown Source)
                        at org.jboss.mq.il.oil.OILServerIL.createConnection(OILServerIL.java:563)
                        at org.jboss.mq.il.oil.OILServerIL.checkConnection(OILServerIL.java:507)
                        at org.jboss.mq.il.oil.OILServerIL.authenticate(OILServerIL.java:289)
                        at org.jboss.mq.Connection.authenticate(Connection.java:876)
                        at org.jboss.mq.Connection.(Connection.java:238)
                        at org.jboss.mq.Connection.(Connection.java:315)
                        at org.jboss.mq.SpyConnection.(SpyConnection.java:59)
                        at org.jboss.mq.SpyConnectionFactory.createQueueConnection(SpyConnectionFactory.java:116)
                        at com.helplab.Receiver.setupQueue(Receiver.java:27)
                        at com.helplab.Receiver.receive(Receiver.java:39)
                        at com.helplab.Receiver.main(Receiver.java:68)