activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alaa Alnobani" <alaa_nob...@maktoob.com>
Subject Tomcat Integration problem
Date Tue, 27 Mar 2007 09:18:55 GMT
Hi, please I need your help:
 I am new to ActiveMQ and tried to integrate it with tomcat 5.5 so I copied all the necessary
JARS to the common/lib directory in tomcat then I added a  META-INF/context.xml to my web
application directory contaning: 
<Context antiJARLocking="true"> 
    <Resource 
        name="jms/ConnectionFactory" 
        auth="Container" 
        type="org.activemq.ActiveMQConnectionFactory" 
        description="JMS Connection Factory" 
        factory="org.activemq.jndi.JNDIReferenceFactory" 
        brokerURL="ssl://localhost:61616" 
        brokerName="LocalActiveMQBroker" 
        useEmbeddedBroker="false"/> 

    <Resource name="jms/topic/MyTopic" 
        auth="Container" 
        type="org.activemq.message.ActiveMQTopic" 
        factory="org.activemq.jndi.JNDIReferenceFactory" 
        physicalName="MY.TEST.FOO"/> 
</Context> 


then I tried to use it in a servlet like this : 

InitialContext initCtx = new InitialContext(); 
    Context envContext = (Context) initCtx.lookup("java:comp/env"); 
    ConnectionFactory connectionFactory = (ConnectionFactory) envContext.lookup("jms/ConnectionFactory");

    Connection connection = connectionFactory.createConnection(); 
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 
    MessageProducer producer = session.createProducer((Destination) envContext.lookup("jms/topic/MyTopic"));


    Message testMessage = session.createMessage(); 
    testMessage.setStringProperty("testKey", "testValue"); 
    producer.send(testMessage); 
    

When I request the servlet the following exception comes up: 
javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException:
org.activemq.jndi.JNDIReferenceFactory] 

BTW i am using activeMQ version 4.1.0 with tomcat 5.5.17 and Java 1.5.

So what is wrong and what I should I do else??? 

thanks. 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message