I am trying to write a simple MDB and a JUNIT Test client to send a mesage
to the listener. I followed the examples in creating the MDB and the
client. MDB deploys ok. Queue is specified in the jboss.jcml. When I run
the client I am getting a .naming exception on the connectionFactory. These
are my setups. What am I
doing wrong? Any help is much appreciated
Version : JBoss-2.4.3_Tomcat-3.2.3
My MDB ejb-jar file
-------------------------
<?xml version="1.0" encoding="Cp1252"?>
<ejb-jar>
<description>MailListener MDB</description>
<display-name>MailListener</display-name>
<enterprise-beans>
<message-driven>
<ejb-name>MailListener</ejb-name>
<ejb-class>com.catarc.ejb.maillistener.MailListener</ejb-class>
<message-selector></message-selector>
<transaction-type>Bean</transaction-type>
<acknowledge-mode>Auto-acknowledge</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
</message-driven>
</enterprise-beans>
</ejb-jar>
My jboss.xml
----------------
<?xml version="1.0" encoding="Cp1252"?>
<jboss>
<enterprise-beans>
<message-driven>
<ejb-name>MailListener</ejb-name>
<configuration-name>Standard Message Driven Bean</configuration-name>
<destination-jndi-name>queue/mailQueue</destination-jndi-name>
</message-driven>
</enterprise-beans>
</jboss>
My maillistener.xml
-----------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<application>
<display-name>MailListener</display-name>
<module>
<web>
<web-uri>MailListener.war</web-uri>
<context-root>/MailListener</context-root>
</web>
</module>
<module>
<ejb>MailListener.jar</ejb>
</module>
</application>
My jboss.jcml
---------------
<mbean code="org.jboss.mq.server.QueueManager" name="JBossMQ:service=Queue,name=mailQueue"/>
My client setup
------------------
protected void setUp() {
try {
h.put(Context.INITIAL_CONTEXT_FACTORY , "org.jnp.interfaces.NamingContextFactory");
h.put(Context.PROVIDER_URL , "localhost:1099"
);
h.put(Context.URL_PKG_PREFIXES , "org.jnp.interfaces");
h.put("java.naming.rmi.security.manager", "yes");
//h.put(Context.URL_PKG_PREFIXES , "org.jboss.naming");
context = new InitialContext(h);
assert(context != null);
// I am getting a null for queFactory
queueFactory = (QueueConnectionFactory)context.lookup("ConnectionFactory");
assert(queueFactory != null);
queueConnection = queueFactory.createQueueConnection();
assert(queueConnection != null);
queueSession = queueConnection.createQueueSession(
false,
Session.AUTO_ACKNOWLEDGE);
assert(queueSession != null);
queue = (Queue)context.lookup("queue/mailQueue");
assert(queue != null);
queueSender = queueSession.createSender(queue);
}catch (JMSException e) {
System.out.println("JMS Exception ="+e.getMessage());
}catch (NamingException e) {
System.out.println("Naming Exception ="+e.getMessage());
}catch (Exception e) {
System.out.println("Exception ="+e.getMessage());
}
}
My server log info.
-------------------
[QueueManager] Initializing
[JMSServer] addDestination: QUEUE.mailQueue, JMSDestination:QUEUE.mailQueue
[Container factory] Bound MailList to MailList
[ContainerManagement] Initializing
[ContainerManagement] Initialized
[ContainerManagement] Starting
[ContainerManagement] Started
[Container factory] Deployed application: file:/C:/jboss/JBoss-2.4.3_Tomcat-3.2.3/jboss/tmp/deploy/Default/maillist.jar
[J2EE Deployer Default] J2EE application: file:/C:/dev.catarc/team/ejbdeploy/maillist.jar
is deployed.
[AutoDeployer] Auto deploy of file:/C:/dev.catarc/team/ejbdeploy/maillistener.jar
[J2EE Deployer Default] Module maillistener.jar is not running
[J2EE Deployer Default] Destroying application maillistener.jar
[J2EE Deployer Default] Report of undeployment of J2EE application: file:/C:/dev.catarc/team/ejbdeploy/maillistener.jar
could not be reported.
[J2EE Deployer Default] Deploy J2EE application: file:/C:/dev.catarc/team/ejbdeploy/maillistener.jar
[J2eeDeployer] Create application maillistener.jar
[J2eeDeployer] install EJB module maillistener.jar
[Container factory] Deploying:file:/C:/jboss/JBoss-2.4.3_Tomcat-3.2.3/jboss/tmp/deploy/Default/maillistener.jar
[Verifier] Verifying file:/C:/jboss/JBoss-2.4.3_Tomcat-3.2.3/jboss/tmp/deploy/Default/maillistener.jar/ejb1034.jar
[Container factory] Deploying MailListener
[Container factory] Begin java:comp/env for EJB: MailListener
[Container factory] TCL: java.net.URLClassLoader@673783
[Container factory] End java:comp/env for EJB: MailListener
[JMSContainerInvoker] initializing
[JMSContainerInvoker] looking up provider adapter: java:/DefaultJMSProvider
[JMSContainerInvoker] provider adapter: org.jboss.jms.jndi.JBossMQProvider@4e2db0
[JBossMQProvider] no provider url; connecting to local JNDI
[JBossMQProvider] created context: javax.naming.InitialContext@198046
[JMSContainerInvoker] context: javax.naming.InitialContext@198046
[JMSContainerInvoker] jndiSuffix: mailQueue
[JMSContainerInvoker] Got destination type Queue for MailListener
[ConnectionFactoryHelper] using connection factory: org.jboss.mq.SpyXAConnectionFactory@6881b6
[ConnectionFactoryHelper] using username/password: null/null