10 Replies Latest reply on Apr 22, 2003 10:15 PM by yjyang

    how to deploy a mdb on jboss?

    yjyang

      who can tell me how to deploy a mdb on jboss?
      what do i need to do?
      which files do i need except jboss.xml and ejb-jar.xml?
      Do i need to modify jbossmq-service and jbossmq-destination-service?
      i have deploy a mdb on jboss,but when i run its client,it tell me the error:
      JMS_example-client:
      [java] javax.naming.NameNotFoundException: QueueConnectionFactory not bound

      jboss.xml:

      JBoss JavaMail Sample Application
      <display-name>Mailer EJB</display-name>
      <enterprise-beans>

      <display-name>MessageTester</display-name>
      <ejb-name>MessageTester</ejb-name>

      <resource-ref>
      <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
      <destination-jndi-name>queue/QueueConnectionFactory</destination-jndi-name>
      <jndi-name>QueueConnectionFactory</jndi-name>
      </resource-ref>


      <!--resource-managers>
      <resource-manager>
      <res-name>queue</res-name>
      <res-jndi-name>QueueConnectionFactory</res-jndi-name>
      </resource-manager>
      </resource-managers-->



      client.java:
      package JMS_example;
      import javax.jms.*;
      import java.io.*;
      import java.net.*;
      import javax.naming.*;

      public class MsgListener {
      private static final String QUEUE_CONN_FACTORY =
      "QueueConnectionFactory";
      private static final String QUEUE = "jms/Queue";

      public static void main(String[] args) {
      Context initCtx;
      QueueConnectionFactory factory;
      Queue queue;
      QueueConnection conn;
      QueueSession session;
      QueueReceiver receiver;
      TextMessage request;

      try {
      //Obtain an initial context
      initCtx = new InitialContext();

      //Lookup Connection Factory and Queue name
      factory = (QueueConnectionFactory)
      initCtx.lookup(QUEUE_CONN_FACTORY);
      queue = (Queue) initCtx.lookup(QUEUE);

      //Create and start a Queue connection using the Factory
      conn = (QueueConnection)factory.createQueueConnection();
      conn.start();

      //Open a Queue session on this connection
      session = conn.createQueueSession(false,
      Session.AUTO_ACKNOWLEDGE);

      //Create a listener to receive messages from the Queue
      receiver = session.createReceiver(queue);

      //Send every message received to Standard Out
      while (true) {
      request = (TextMessage) receiver.receive();
      System.out.println("Message Received: " + request.getText());
      }
      } catch (NamingException ne) {
      ne.printStackTrace();
      } catch (JMSException jms) {
      jms.printStackTrace();
      }

      }
      }

      Please help me to find the error or give me an example about the problems.Thanks



        • 1. Re: how to deploy a mdb on jboss?

          Try "ConnectionFactory"

          Your queue name is probably wrong as well.

          You can see the jndi tree using http://localhost:8080/jmx-console
          on the JNDIView list operation.

          Regards,
          Adrian

          • 2. Re: how to deploy a mdb on jboss?
            yjyang

            Thank you!
            but when i use the "ConnectionFactory",it still told me the errors:
            JMS_example-client:
            [java] javax.naming.NameNotFoundException: jms not bound
            [java] at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)

            [java] at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)

            [java] at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
            [java] at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
            [java] at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
            [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
            hodAccessorImpl.java:25)
            [java] at java.lang.reflect.Method.invoke(Method.java:324)
            [java] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.jav
            a:261)
            [java] at sun.rmi.transport.Transport$1.run(Transport.java:148)
            [java] at java.security.AccessController.doPrivileged(Native Method)
            [java] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
            [java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTranspor
            t.java:460)
            [java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPT
            ransport.java:701)
            [java] at java.lang.Thread.run(Thread.java:536)
            [java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServe
            r(StreamRemoteCall.java:247)
            [java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCa
            ll.java:223)
            [java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
            [java] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
            [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:48
            4)
            [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:46
            3)
            [java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
            [java] at JMS_example.MsgListener.main(MsgListener.java:28)

            Please tell me how to resolve it!

            • 3. Re: how to deploy a mdb on jboss?

              What are you using as your jndi properties?

              Try the following code to list the context
              your client can see.

              InitialContext ctx = new InitialContext();
              for (Enumeration e = ctx.list(""); e.hasMoreElements();)
              {
              try
              {
              System.out.println(e.nextElement());
              }
              catch (Exception ignored)
              {
              System.out.println(ignored);
              }
              }

              Regards,
              Adrian

              • 4. Re: how to deploy a mdb on jboss?
                yjyang

                Thank warjort for your helps.
                But I still will bother you.
                Now I have do as you teach.It prints as following:
                JMS_example-client:
                [java] XAConnectionFactory: org.jboss.mq.SpyXAConnectionFactory
                [java] jmx:yjyang:rmi: org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl
                [java] UserTransactionSessionFactory: org.jboss.tm.usertx.server.UserTransa
                ctionSessionFactoryImpl
                [java] RMIXAConnectionFactory: org.jboss.mq.SpyXAConnectionFactory
                [java] topic: org.jnp.interfaces.NamingContext
                [java] queue: org.jnp.interfaces.NamingContext
                [java] CompIntService: $Proxy23
                [java] ConnectionFactory: org.jboss.mq.SpyConnectionFactory
                [java] RMIConnectionFactory: org.jboss.mq.SpyConnectionFactory
                [java] UserTransaction: org.jboss.tm.usertx.client.ClientUserTransaction
                [java] ejb: org.jnp.interfaces.NamingContext
                [java] invokers: org.jnp.interfaces.NamingContext
                [java] CompoundInterestAgent: $Proxy22
                [java] jmx: org.jnp.interfaces.NamingContext
                [java] UILXAConnectionFactory: org.jboss.mq.SpyXAConnectionFactory
                [java] UILConnectionFactory: org.jboss.mq.SpyConnectionFactory
                [java] javax.naming.NameNotFoundException: jms not bound
                [java] at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)

                [java] at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)

                [java] at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
                [java] at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
                [java] at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
                [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
                hodAccessorImpl.java:25)
                [java] at java.lang.reflect.Method.invoke(Method.java:324)
                [java] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.jav
                a:261)
                [java] at sun.rmi.transport.Transport$1.run(Transport.java:148)
                [java] at java.security.AccessController.doPrivileged(Native Method)
                [java] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
                [java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTranspor
                t.java:460)
                [java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPT
                ransport.java:701)
                [java] at java.lang.Thread.run(Thread.java:536)
                [java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServe
                r(StreamRemoteCall.java:247)
                [java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCa
                ll.java:223)
                [java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
                [java] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:48
                4)
                [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:46
                3)
                [java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
                [java] at JMS_example.MsgListener.main(MsgListener.java:44)

                Please help me to see where the boot of the problem
                is.

                • 5. Re: how to deploy a mdb on jboss?

                  [java] ConnectionFactory: org.jboss.mq.SpyConnectionFactory

                  It is there?

                  Regards,
                  Adrian

                  • 6. Re: how to deploy a mdb on jboss?
                    yjyang

                    Thanks.I have successed,when i tried to use "ConnectionFactory",but when i run the client,it appeared new problem:
                    16:54:50,185 WARN [OILServerILService] Connection failure (1).
                    java.net.SocketException: Connection reset by peer: JVM_recv in socket input str
                    eam read
                    at java.net.SocketInputStream.socketRead0(Native Method)
                    at java.net.SocketInputStream.read(SocketInputStream.java:116)
                    at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
                    at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
                    at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java
                    :2118)
                    at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(Object
                    InputStream.java:2301)
                    at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStre
                    am.java:2368)
                    at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream
                    .java:2440)
                    at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputSt
                    ream.java:2589)
                    at java.io.ObjectInputStream.readByte(ObjectInputStream.java:837)
                    at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.
                    java:205)
                    at java.lang.Thread.run(Thread.java:536)

                    Can you help me to resolve it ?Thanks

                    • 7. Re: how to deploy a mdb on jboss?
                      yjyang

                      Thanks.The previous problem has been resolved.But when i go on to run the client,it appeared the new problem as following:
                      16:54:50,185 WARN [OILServerILService] Connection failure (1).
                      java.net.SocketException: Connection reset by peer: JVM_recv in socket input str
                      eam read
                      at java.net.SocketInputStream.socketRead0(Native Method)
                      at java.net.SocketInputStream.read(SocketInputStream.java:116)
                      at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
                      at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
                      at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java
                      :2118)
                      at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(Object
                      InputStream.java:2301)
                      at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStre
                      am.java:2368)
                      at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream
                      .java:2440)
                      at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputSt
                      ream.java:2589)
                      at java.io.ObjectInputStream.readByte(ObjectInputStream.java:837)
                      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.
                      java:205)
                      at java.lang.Thread.run(Thread.java:536)

                      Can you help me resolve it ?

                      • 8. Re: how to deploy a mdb on jboss?
                        yjyang

                        Thanks.The previous problem has been resolved.But when i go on to run the client,it appeared the new problem as following:
                        16:54:50,185 WARN [OILServerILService] Connection failure (1).
                        java.net.SocketException: Connection reset by peer: JVM_recv in socket input str
                        eam read
                        at java.net.SocketInputStream.socketRead0(Native Method)
                        at java.net.SocketInputStream.read(SocketInputStream.java:116)
                        at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
                        at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
                        at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java
                        :2118)
                        at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(Object
                        InputStream.java:2301)
                        at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStre
                        am.java:2368)
                        at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream
                        .java:2440)
                        at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputSt
                        ream.java:2589)
                        at java.io.ObjectInputStream.readByte(ObjectInputStream.java:837)
                        at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.
                        java:205)
                        at java.lang.Thread.run(Thread.java:536)

                        Can you help me resolve it ?

                        • 9. Re: how to deploy a mdb on jboss?

                          This says the client closed the socket.
                          What happened on the client?

                          Regards,
                          Adrian

                          • 10. Re: how to deploy a mdb on jboss?
                            yjyang

                            thanks.I'm sorry I have bother you so long time.And you always help me to resolve the problem.
                            I will say to you"Thanks"

                            Now when i run the client,it dead