0 Replies Latest reply on Aug 17, 2012 2:19 PM by cgmedina

    JBoss AS 6 EJB-JMS Configuration from glassfish

    cgmedina Newbie

      Hi I'm newbie on JBoss AS 6.1 Final and it would be really helpful if you guys could read and reply.

       

      As I mentioned on a previous post, I'm trying to migrate a fully deployed working application from Glassfish to JBoss.

       

      In this particular moment I'm trying to deploy an EJB package which uses the following JMS instances:

       

      • A jms connectionfactory which is called UtilityProcessMessageFactory
      • Three jms queues which are called UtilityProcessRequestMessageQueue, UtilityProcessReplyMessageQueue and UtilityProcessReturnMessageQueue

       

      The functioning of my classes is very simple

       

      I have a stateless sessionbean called UtilityProcessMessengerBean which declares the resources sent to my MDB as follows:

       

      Stateless

      public class UtilityProcessMessengerBean implements UtilityProcessMessengerLocal {

       

       

          @Resource(name = "jms/UtilityProcessMessageFactory")

          private ConnectionFactory connectionFactory;

       

       

          @Resource(name = "jms/UtilityProcessRequestMessageQueue")

          private Queue requestQueue;

       

       

          @Resource(name = "jms/UtilityProcessReplyMessageQueue")

          private Queue replyQueue;

       

       

          @Resource(name = "jms/UtilityProcessReturnMessageQueue")

          private Queue returnQueue;

       

       

          @EJB

          MessengerLocal messenger;

       

       

          @Override

          public ObjectMessage send(Serializable message) throws JMSException {

              MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);

              return messenger.send(context, message);

          }

       

       

          @Override

          public ObjectMessage send(Serializable message, Long requestTimeToLive) throws JMSException {

              MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);

              return messenger.send(context, message, requestTimeToLive);

          }

       

       

          @Override

          public ObjectMessage sendRequest(Serializable message) throws JMSException {

              MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);

              return messenger.sendRequest(context, message);

          }

       

       

          @Override

          public ObjectMessage sendRequest(Serializable message, Long requestTimeToLive, Long replyTimeToWait) throws JMSException {

              MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);

              return messenger.sendRequest(context, message, requestTimeToLive, replyTimeToWait);

          }

       

       

          @Override

          public ObjectMessage sendReply(Serializable message, Message request) throws JMSException {

              MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);

              return messenger.sendReply(context, message, request);

          }

       

       

          @Override

          public ObjectMessage sendReturn(Message message) throws JMSException {

              MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);

              return messenger.sendReturn(context, message);

          }

       

       

          @Override

          public ObjectMessage receiveReply(Message request) throws JMSException {

              MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);

              return messenger.receiveReply(context, request);

          }

       

       

      I had the following configuration file on glassfish and it worked ok:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">

      <sun-ejb-jar>

        <enterprise-beans>

          <ejb>

            <ejb-name>UtilityProcessMessengerBean</ejb-name>

            <resource-ref>

              <res-ref-name>jms/UtilityProcessMessageFactory</res-ref-name>

              <jndi-name>jms/UtilityProcessMessageFactory</jndi-name>

            </resource-ref>

            <message-destination-ref>

              <message-destination-ref-name>jms/UtilityProcessRequestMessageQueue</message-destination-ref-name>

              <jndi-name>jms/UtilityProcessRequestMessageQueue</jndi-name>

            </message-destination-ref>

            <message-destination-ref>

              <message-destination-ref-name>jms/UtilityProcessReplyMessageQueue</message-destination-ref-name>

              <jndi-name>jms/UtilityProcessReplyMessageQueue</jndi-name>

            </message-destination-ref>

            <message-destination-ref>

              <message-destination-ref-name>jms/UtilityProcessReturnMessageQueue</message-destination-ref-name>

              <jndi-name>jms/UtilityProcessReturnMessageQueue</jndi-name>

            </message-destination-ref>

          </ejb>

          <ejb>

            <ejb-name>UtilityProcessRequestMessageBean</ejb-name>

              <bean-pool>

                 <pool-idle-timeout-in-seconds>300</pool-idle-timeout-in-seconds>

                 <resize-quantity>2</resize-quantity>

                 <steady-pool-size>2</steady-pool-size>

                 <max-pool-size>2</max-pool-size>

              </bean-pool>

          </ejb>

        </enterprise-beans>

      </sun-ejb-jar>

       

      I tried to make something similar on jboss but neither of my trials have been successful

       

      First I tried to declare my connectionFactory and queues on HornetQ using the hornetq-jms.xml file as follows:

       

       

      <connection-factory name="UtilityProcessMessageFactory">

            <connectors>

               <connector-ref connector-name="netty"/>

            </connectors>

            <entries>

               <entry name="jms/UtilityProcessMessageFactory"/>

            </entries>

         </connection-factory>

         <queue name="UtilityProcessRequestMessageQueue">

               <entry name="jms/UtilityProcessRequestMessageQueue"/>

         </queue>

         <queue name="UtilityProcessReplyMessageQueue">

               <entry name="jms/UtilityProcessReplyMessageQueue"/>

         </queue>

         <queue name="UtilityProcessReturnMessageQueue">

               <entry name="jms/UtilityProcessReturnMessageQueue"/>

         </queue>

       

      When I tried to deploy my ejb jar, JBoss returned the following message:

       

      Deployment "vfs:///C:/JBoss/server/default/deploy/mhzap101-ejb-core.jar" is in error due to the following reason(s): java.lang.RuntimeException: Neither any mapped-name/lookup/jndi-name specified nor any ResourceProvider could process resource-ref named env/jms/UtilityProcessMessageFactory of type javax.jms.ConnectionFactory

       

       

                at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.GA]

                at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.GA]

                at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.Final]

                at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:107) [:0.2.2]

                at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:135) [:6.0.0.Final]

                at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]

                at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

                at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

                at java.lang.Thread.run(Thread.java:662) [:1.6.0_25]

       

      Then I continued reading and I read that I had to modify my jboss.xml file (which is created by glassfish with no parameters). So I tried to make something equivalent to my sun-resources.jar file:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss>

        <enterprise-beans>

          <session>

            <ejb-name>UtilityProcessMessengerBean</ejb-name>

            <resource-ref>

              <res-ref-name>jms/UtilityProcessMessageFactory</res-ref-name>

              <jndi-name>jms/UtilityProcessMessageFactory</jndi-name>

              <res-type>javax.jms.QueueConnectionFactory</res-type>

            </resource-ref>

            <message-destination-ref>

              <message-destination-ref-name>jms/UtilityProcessRequestMessageQueue</message-destination-ref-name>

              <jndi-name>jms/UtilityProcessRequestMessageQueue</jndi-name>

            </message-destination-ref>

            <message-destination-ref>

              <message-destination-ref-name>jms/UtilityProcessReplyMessageQueue</message-destination-ref-name>

              <jndi-name>jms/UtilityProcessReplyMessageQueue</jndi-name>

            </message-destination-ref>

            <message-destination-ref>

              <message-destination-ref-name>jms/UtilityProcessReturnMessageQueue</message-destination-ref-name>

              <jndi-name>jms/UtilityProcessReturnMessageQueue</jndi-name>

            </message-destination-ref>

          </session>

          <message-driven>

            <ejb-name>UtilityProcessRequestMessageBean</ejb-name>

              <bean-pool>

                 <pool-idle-timeout-in-seconds>300</pool-idle-timeout-in-seconds>

                 <resize-quantity>2</resize-quantity>

                 <steady-pool-size>2</steady-pool-size>

                 <max-pool-size>2</max-pool-size>

              </bean-pool>

          </message-driven>

        </enterprise-beans>    

      </jboss>

       

      It continues returning the same message: it can't find my connectionFactory, what am I doing wrong?