<!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="http://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 Messaging Issue
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/mmuthu">Muthukumaran Manickavasagam</a> in <i>JBoss Messaging</i> - <a href="http://community.jboss.org/message/552965#552965">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I'm trying to bring up my hello world MDB in JBOSS 5.1 to see how i can get our messaging application into JBOSS 5.1 Messaging. The simple hellow world MDB gives me a wired issue. The MDB deployed fine and no problem in starting the JBOSS 5.1 AS. However when i tried to send a message from a client (servlet) which is also running in different JBOSS instance is always throwing the following exception while creating a session.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><code>09:03:24,790 ERROR [STDERR] java.lang.NullPointerException<br/>09:03:24,790 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:87)<br/>09:03:24,790 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)<br/>09:03:24,791 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br/>09:03:24,791 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)<br/>09:03:24,791 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)<br/>09:03:24,791 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br/>09:03:24,791 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.jboss.jms.client.delegate.ClientConnectionDelegate.createSessionDelegate(ClientConnectionDelegate.java)<br/>09:03:24,791 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.jboss.jms.client.JBossConnection.createSessionInternal(JBossConnection.java:269)<br/>09:03:24,791 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.jboss.jms.client.JBossConnection.createQueueSession(JBossConnection.java:165)<br/></code></p><p><code></code></p><p>However when i try to connect from a standalone JAVA program the messaging works fine. I have no clue on what i should do now. The following are the configuration,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>ejb-jar.xml:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><code>&lt;message-driven&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;ejb-name&gt;HelloWorldMDB&lt;/ejb-name&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;ejb-class&gt;com.yodlee.messaging.mdbs.HelloWorldMDB&lt;/ejb-class&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;transaction-type&gt;Container&lt;/transaction-type&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;message-driven-destination&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;destination-type&gt;javax.jms.Queue&lt;/destination-type&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;subscription-durability&gt;Durable&lt;/subscription-durability&gt;&lt;/message-driven-destination&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;resource-ref&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;res-ref-name&gt;HelloWorldMDB&lt;/res-ref-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;res-type&gt;javax.jms.QueueConnectionFactory&lt;/res-type&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;res-auth&gt;Container&lt;/res-auth&gt;&lt;/resource-ref&gt; <br/>&lt;/message-driven&gt;</code></p><p><code></code></p><p><code>jboss.xml:</code></p><p><code></code></p><p><code><code>&lt;message-driven&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ejb-name&gt;HelloWorldMDB&lt;/ejb-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;destination-jndi-name&gt;queue/HelloWorldQueue&lt;/destination-jndi-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;mdb-user&gt;mqm&lt;/mdb-user&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;mdb-passwd&gt;mqm&lt;/mdb-passwd&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;resource-ref&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;res-ref-name&gt;HelloWorldMDB&lt;/res-ref-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;jndi-name&gt;MDBDLQCF&lt;/jndi-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/resource-ref&gt;<br/>&lt;/message-driven&gt;<br/></code></code></p><p><code><code>The client code which i use it in servelt and stand alone program is exactly same like below,</code></code></p><p><code><code></code></code></p><p><code><code><code>Properties env = new Properties();<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; String queueName = "queue/HelloWorldQueue";<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; String CFname = "ConnectionFactory";<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put(Context.PROVIDER_URL, "jnp://....:1099");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.put(Context.INITIAL_CONTEXT_FACTORY,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; "org.jnp.interfaces.NamingContextFactory");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; env<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .put(Context.URL_PKG_PREFIXES,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; "org.jboss.naming:org.jnp.interfaces");<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; InitialContext ctx = new InitialContext(env);<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Looking up for queue");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(ctx.lookup(queueName).getClass().getName());<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Queue destination = (Queue) ctx.lookup(queueName);<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(destination.getQueueName());<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Looking up for connection factory");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(ctx.lookup(CFname).getClass().getName());<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnectionFactory qcf = (QueueConnectionFactory)ctx.lookup(CFname);<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("getting connection");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueConnection conn = qcf.createQueueConnection("abc", "abc");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("creating session");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueSession queueSession = conn.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);<br/><br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueSender sender = queueSession.createSender(destination);<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TextMessage message = queueSession.createTextMessage();<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; message.setText("Test Message");<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Sending Message...");<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sender.send(message);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Finished Sending Message.");<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sender.close();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; conn.close();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; queueSession.close();<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (Exception e) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/></code></code></code></p><p><code><code><code></code></code></code><code><code><code><p>Can you help me fixing this problem? Do you need any other information to debug? I'm using JBOSS Messaging 1.4.6 GA version.</p></code></code></code></p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/552965#552965">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Messaging at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>