Hi, I'm hoping this is an easy fix, I think it has to do with Configuration, but I can't find anything to answer the question. I'm trying to set up a simple servlet that dump text into the topic/testTopic topic that is configured on JBoss 4.0.4RC1. I've pretty much pulled the code out of Ch6 of the documentation and adjusted it for Web App use. See Source:
| public void setupPubSub() throws JMSException, NamingException | { | InitialContext iniCtx = new InitialContext(); | TopicConnectionFactory tcf = (TopicConnectionFactory)iniCtx.lookup("java:comp/env/jms/ConnectionFactory"); | if (tcf == null) | System.out.println("tcf is null"); | else | System.out.println("tcf is NOT null"); | | conn = tcf.createTopicConnection(); | topic = (Topic) iniCtx.lookup("java:comp/env/jms/testTopic"); | if (topic == null) | System.out.println("topic is null"); | else | System.out.println("topic is NOT null"); | session = conn.createTopicSession(false, | TopicSession.AUTO_ACKNOWLEDGE); | conn.start(); | } | | A NullPointerException is thrown at: conn = tcf.createTopicConnection(); The "if" block directly above it confirms that tcf is indeed null. Originally I had been having problems getting the naming correct through the jboss-web.xml, and web.xml, however that all seems to be working now. FYI: the "topic" returned is not null, so I know that call works anyway. It seems that I am getting the naming correct, but for some reason the object returned by the lookup is null. Help please. web.xml (parts): | <resource-ref> | <description> | Testing the reference info for a TopicConnection Factory | </description> | <res-ref-name>jms/ConnectionFactory</res-ref-name> | <res-type>javax.jms.TopicConnectionFactory</res-type> | <res-auth>Container</res-auth> | </resource-ref> | | <resource-env-ref> | <resource-env-ref-name>jms/testTopic</resource-env-ref-name> | <resource-env-ref-type>javax.jms.Topic</resource-env-ref-type> | </resource-env-ref> | jboss-web.xml: | <jboss-web> | <!-- Jboss web XML file to set mapping for JMS to test topic --> | | <resource-ref> | <res-ref-name>jms/ConnectionFactory</res-ref-name> | <res-type>javax.jms.TopicConnectionFactory</res-type> | <jndi-name>java:ConnectionFactory</jndi-name> | </resource-ref> | | <resource-env-ref> | <resource-env-ref-name>jms/testTopic</resource-env-ref-name> | <jndi-name>java:topic/testTopic</jndi-name> | </resource-env-ref> | </jboss-web> | Thanks, Mark Loper [EMAIL PROTECTED] View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3933368#3933368 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3933368 ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user