JBoss Community

JBOSS Messaging Issue

created by Muthukumaran Manickavasagam in JBoss Messaging - View the full discussion

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.

 

09:03:24,790 ERROR [STDERR] java.lang.NullPointerException
09:03:24,790 ERROR [STDERR]     at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:87)
09:03:24,790 ERROR [STDERR]     at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
09:03:24,791 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
09:03:24,791 ERROR [STDERR]     at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
09:03:24,791 ERROR [STDERR]     at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
09:03:24,791 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
09:03:24,791 ERROR [STDERR]     at org.jboss.jms.client.delegate.ClientConnectionDelegate.createSessionDelegate(ClientConnectionDelegate.java)
09:03:24,791 ERROR [STDERR]     at org.jboss.jms.client.JBossConnection.createSessionInternal(JBossConnection.java:269)
09:03:24,791 ERROR [STDERR]     at org.jboss.jms.client.JBossConnection.createQueueSession(JBossConnection.java:165)

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,

 

ejb-jar.xml:

 

<message-driven>
      <ejb-name>HelloWorldMDB</ejb-name>
      <ejb-class>com.yodlee.messaging.mdbs.HelloWorldMDB</ejb-class>
      <transaction-type>Container</transaction-type>
      <message-driven-destination>
        <destination-type>javax.jms.Queue</destination-type>
        <subscription-durability>Durable</subscription-durability></message-driven-destination>
      <resource-ref>
        <res-ref-name>HelloWorldMDB</res-ref-name>
        <res-type>javax.jms.QueueConnectionFactory</res-type>
        <res-auth>Container</res-auth></resource-ref>
</message-driven>

jboss.xml:

<message-driven>
                <ejb-name>HelloWorldMDB</ejb-name>
                <destination-jndi-name>queue/HelloWorldQueue</destination-jndi-name>
                <mdb-user>mqm</mdb-user>
                <mdb-passwd>mqm</mdb-passwd>
                <resource-ref>
                        <res-ref-name>HelloWorldMDB</res-ref-name>
                        <jndi-name>MDBDLQCF</jndi-name>
                </resource-ref>
</message-driven>

The client code which i use it in servelt and stand alone program is exactly same like below,

Properties env = new Properties();

        String queueName = "queue/HelloWorldQueue";
        String CFname = "ConnectionFactory";

        env.put(Context.PROVIDER_URL, "jnp://....:1099");
        env.put(Context.INITIAL_CONTEXT_FACTORY,
                "org.jnp.interfaces.NamingContextFactory");
        env
                .put(Context.URL_PKG_PREFIXES,
                        "org.jboss.naming:org.jnp.interfaces");

        try {
            InitialContext ctx = new InitialContext(env);

            System.out.println("Looking up for queue");
            System.out.println(ctx.lookup(queueName).getClass().getName());
            Queue destination = (Queue) ctx.lookup(queueName);

            System.out.println(destination.getQueueName());

            System.out.println("Looking up for connection factory");
            System.out.println(ctx.lookup(CFname).getClass().getName());
            QueueConnectionFactory qcf = (QueueConnectionFactory)ctx.lookup(CFname);

            System.out.println("getting connection");
            QueueConnection conn = qcf.createQueueConnection("abc", "abc");
            System.out.println("creating session");
            QueueSession queueSession = conn.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);


            QueueSender sender = queueSession.createSender(destination);

            TextMessage message = queueSession.createTextMessage();

            message.setText("Test Message");

            System.out.println("Sending Message...");

            sender.send(message);
            System.out.println("Finished Sending Message.");

            sender.close();
            conn.close();
            queueSession.close();

        } catch (Exception e) {
            e.printStackTrace();
        }

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.

Reply to this message by going to Community

Start a new discussion in JBoss Messaging at Community