<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
JBoss AS 6 EJB-JMS Configuration from glassfish
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/cgmedina">cgmedina</a> in <i>Beginner's Corner</i> - <a href="https://community.jboss.org/message/754312#754312">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi I'm newbie on JBoss AS 6.1 Final and it would be really helpful if you guys could read and reply.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>As I mentioned on a previous post, I'm trying to migrate a fully deployed working application from Glassfish to JBoss.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>In this particular moment I'm trying to deploy an EJB package which uses the following JMS instances:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><ul><li>A jms connectionfactory which is called UtilityProcessMessageFactory</li><li>Three jms queues which are called UtilityProcessRequestMessageQueue, UtilityProcessReplyMessageQueue and UtilityProcessReturnMessageQueue</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The functioning of my classes is very simple</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have a stateless sessionbean called UtilityProcessMessengerBean which declares the resources sent to my MDB as follows:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Stateless</p><p>public class UtilityProcessMessengerBean implements UtilityProcessMessengerLocal {</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Resource(name = "jms/UtilityProcessMessageFactory")</p><p>    private ConnectionFactory connectionFactory;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Resource(name = "jms/UtilityProcessRequestMessageQueue")</p><p>    private Queue requestQueue;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Resource(name = "jms/UtilityProcessReplyMessageQueue")</p><p>    private Queue replyQueue;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Resource(name = "jms/UtilityProcessReturnMessageQueue")</p><p>    private Queue returnQueue;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @EJB</p><p>    MessengerLocal messenger;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Override</p><p>    public ObjectMessage send(Serializable message) throws JMSException {</p><p>        MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);</p><p>        return messenger.send(context, message);</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Override</p><p>    public ObjectMessage send(Serializable message, Long requestTimeToLive) throws JMSException {</p><p>        MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);</p><p>        return messenger.send(context, message, requestTimeToLive);</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Override</p><p>    public ObjectMessage sendRequest(Serializable message) throws JMSException {</p><p>        MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);</p><p>        return messenger.sendRequest(context, message);</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Override</p><p>    public ObjectMessage sendRequest(Serializable message, Long requestTimeToLive, Long replyTimeToWait) throws JMSException {</p><p>        MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);</p><p>        return messenger.sendRequest(context, message, requestTimeToLive, replyTimeToWait);</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Override</p><p>    public ObjectMessage sendReply(Serializable message, Message request) throws JMSException {</p><p>        MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);</p><p>        return messenger.sendReply(context, message, request);</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Override</p><p>    public ObjectMessage sendReturn(Message message) throws JMSException {</p><p>        MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);</p><p>        return messenger.sendReturn(context, message);</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    @Override</p><p>    public ObjectMessage receiveReply(Message request) throws JMSException {</p><p>        MessengerContext context = new MessengerContext(connectionFactory, requestQueue, replyQueue, returnQueue);</p><p>        return messenger.receiveReply(context, request);</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I had the following configuration file on glassfish and it worked ok:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><?xml version="1.0" encoding="UTF-8"?></p><p><span><!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "</span><a class="jive-link-external-small" href="http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd" target="_blank">http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd</a><span>"></span></p><p><sun-ejb-jar></p><p>  <enterprise-beans></p><p>    <ejb></p><p>      <ejb-name>UtilityProcessMessengerBean</ejb-name></p><p>      <resource-ref></p><p>        <res-ref-name>jms/UtilityProcessMessageFactory</res-ref-name></p><p>        <jndi-name>jms/UtilityProcessMessageFactory</jndi-name></p><p>      </resource-ref></p><p>      <message-destination-ref></p><p>        <message-destination-ref-name>jms/UtilityProcessRequestMessageQueue</message-destination-ref-name></p><p>        <jndi-name>jms/UtilityProcessRequestMessageQueue</jndi-name></p><p>      </message-destination-ref></p><p>      <message-destination-ref></p><p>        <message-destination-ref-name>jms/UtilityProcessReplyMessageQueue</message-destination-ref-name></p><p>        <jndi-name>jms/UtilityProcessReplyMessageQueue</jndi-name></p><p>      </message-destination-ref></p><p>      <message-destination-ref></p><p>        <message-destination-ref-name>jms/UtilityProcessReturnMessageQueue</message-destination-ref-name></p><p>        <jndi-name>jms/UtilityProcessReturnMessageQueue</jndi-name></p><p>      </message-destination-ref></p><p>    </ejb></p><p>    <ejb></p><p>      <ejb-name>UtilityProcessRequestMessageBean</ejb-name></p><p>        <bean-pool></p><p>           <pool-idle-timeout-in-seconds>300</pool-idle-timeout-in-seconds></p><p>           <resize-quantity>2</resize-quantity></p><p>           <steady-pool-size>2</steady-pool-size></p><p>           <max-pool-size>2</max-pool-size></p><p>        </bean-pool></p><p>    </ejb></p><p>  </enterprise-beans></p><p></sun-ejb-jar></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I tried to make something similar on jboss but neither of my trials have been successful</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>First I tried to declare my connectionFactory and queues on HornetQ using the hornetq-jms.xml file as follows:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p> <connection-factory name="UtilityProcessMessageFactory"></p><p>      <connectors></p><p>         <connector-ref connector-name="netty"/></p><p>      </connectors></p><p>      <entries></p><p>         <entry name="jms/UtilityProcessMessageFactory"/></p><p>      </entries></p><p>   </connection-factory></p><p>   <queue name="UtilityProcessRequestMessageQueue"></p><p>         <entry name="jms/UtilityProcessRequestMessageQueue"/></p><p>   </queue></p><p>   <queue name="UtilityProcessReplyMessageQueue"></p><p>         <entry name="jms/UtilityProcessReplyMessageQueue"/></p><p>   </queue></p><p>   <queue name="UtilityProcessReturnMessageQueue"></p><p>         <entry name="jms/UtilityProcessReturnMessageQueue"/></p><p>   </queue></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>When I tried to deploy my ejb jar, JBoss returned the following message:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.GA]</p><p>          at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.GA]</p><p>          at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.Final]</p><p>          at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:107) [:0.2.2]</p><p>          at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:135) [:6.0.0.Final]</p><p>          at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]</p><p>          at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]</p><p>          at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]</p><p>          at java.lang.Thread.run(Thread.java:662) [:1.6.0_25]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><?xml version="1.0" encoding="UTF-8"?></p><p><jboss></p><p>  <enterprise-beans></p><p>    <session> </p><p>      <ejb-name>UtilityProcessMessengerBean</ejb-name></p><p>      <resource-ref></p><p>        <res-ref-name>jms/UtilityProcessMessageFactory</res-ref-name></p><p>        <jndi-name>jms/UtilityProcessMessageFactory</jndi-name></p><p>        <res-type>javax.jms.QueueConnectionFactory</res-type></p><p>      </resource-ref></p><p>      <message-destination-ref></p><p>        <message-destination-ref-name>jms/UtilityProcessRequestMessageQueue</message-destination-ref-name></p><p>        <jndi-name>jms/UtilityProcessRequestMessageQueue</jndi-name></p><p>      </message-destination-ref></p><p>      <message-destination-ref></p><p>        <message-destination-ref-name>jms/UtilityProcessReplyMessageQueue</message-destination-ref-name></p><p>        <jndi-name>jms/UtilityProcessReplyMessageQueue</jndi-name></p><p>      </message-destination-ref></p><p>      <message-destination-ref></p><p>        <message-destination-ref-name>jms/UtilityProcessReturnMessageQueue</message-destination-ref-name></p><p>        <jndi-name>jms/UtilityProcessReturnMessageQueue</jndi-name></p><p>      </message-destination-ref></p><p>    </session></p><p>    <message-driven></p><p>      <ejb-name>UtilityProcessRequestMessageBean</ejb-name></p><p>        <bean-pool></p><p>           <pool-idle-timeout-in-seconds>300</pool-idle-timeout-in-seconds></p><p>           <resize-quantity>2</resize-quantity></p><p>           <steady-pool-size>2</steady-pool-size></p><p>           <max-pool-size>2</max-pool-size></p><p>        </bean-pool></p><p>    </message-driven></p><p>  </enterprise-beans>     </p><p></jboss></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>It continues returning the same message: it can't find my connectionFactory, what am I doing wrong? </p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/754312#754312">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>