activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brad steiner <bstei...@thehungersite.com>
Subject Re: Connecting from Tomcat 5.5.15
Date Wed, 07 Jun 2006 19:56:07 GMT
Thanks for the suggestion James, just putting the AMQ jar in WEB-INF/ 
lib works like a champ, despite the other JMS/J2EE jars on my classpath.

On to the real JMS fun . . .

Thanks Aplenty
Brad


On May 30, 2006, at 7:02 AM, James Strachan wrote:

> Seems like you are getting loader constraints when trying to use the
> JMS API - rather than ActiveMQ. Have you tried just putting the
> ActiveMQ jars into your WEB-INF/lib? Are there any other JMS/J2EE jars
> on the classpath that could be causing the problem?
>
> On 5/17/06, brad steiner <bsteiner@thehungersite.com> wrote:
>> ActiveMQ Users
>>
>> We are exploring the use of ActiveMQ as part of our IT infrastructure
>> but have run into some difficulties connecting to a standalone AMQ
>> server from Tomcat 5.5.15 with both the 4.0 release and the May 8th
>> 2006 build (on MacOS X, JVM 1.5, using Struts 1.2.9). Using the
>> latter, I've added incubator-activemq-4.0.jar to $CATALINA_HOME/
>> common/lib, included it in my class path, and added the following  
>> code:
>>
>> << in META-INF/context.xml >>
>>
>> <Context antiJARLocking="true">
>>      <Resource
>>          name="jms/ConnectionFactory"
>>          auth="Container"
>>          type="org.apache.activemq.ActiveMQConnectionFactory"
>>          description="JMS Connection Factory"
>>          factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>          brokerURL="tcp://localhost:61616"
>>          brokerName="LocalActiveMQBroker"
>>          useEmbeddedBroker="false"/>
>>
>>      <Resource name="jms/someTopic"
>>          auth="Container"
>>          type="org.apache.activemq.command.ActiveMQTopic"
>>          factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>          physicalName="TEST_TOPIC.FOO"/>
>>
>>      <Resource name="jms/aQueue"
>>          auth="Container"
>>          type="org.apache.activemq.command.ActiveMQQueue"
>>          factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>          physicalName="TEST.FOO"/>
>> </Context>
>>
>>
>> << in my struts action class >>
>>
>> Context initContext = new InitialContext();
>> Context envContext = (Context) initContext.lookup("java:comp/env");
>> ActiveMQConnectionFactory connectionFactory =
>> (ActiveMQConnectionFactory) envContext.lookup("jms/ 
>> ConnectionFactory");
>> ActiveMQConnection connection = (ActiveMQConnection)
>> connectionFactory.createConnection();
>>
>> connection.start();
>>
>> ActiveMQSession session = (ActiveMQSession) connection.createSession
>> (false, Session.AUTO_ACKNOWLEDGE);
>> ActiveMQDestination dest = (ActiveMQDestination) session.createQueue
>> ("TEST.FOO");
>> ActiveMQMessageProducer producer = (ActiveMQMessageProducer)
>> session.createProducer(dest);   /* throws Threw Error
>> java.lang.LinkageError: loader constraints violated when linking
>> javax/jms/Destination */
>>
>> producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
>> ActiveMQTextMessage message = (ActiveMQTextMessage)
>> session.createTextMessage("Struts Action Sent This Message");
>> producer.send(message);
>> session.close();
>> connection.close();
>>
>> The result is that session.createProducer(dest) throws 'Error
>> java.lang.LinkageError: loader constraints violated when linking
>> javax/jms/Destination'. I've spent several days tracking down javax/
>> jms/Destination declarations in jars on my classpath and removing
>> them but continue to get the same result. I've also tried declaring
>> my ActiveMQXxx variables as the javax/jms superclass of each, as in
>> many of the examples I've seen, but get ClassCastExceptions on the
>> connection factory lookup. ActiveMQ would be great addition to our
>> infrastructure so I'm hopeful that someone knows of a solution to
>> this little bump in the road.
>>
>> Thanks in Advance,
>>
>> Brad Steiner
>> Senior Software Engineer
>> The GreaterGood Network
>>
>>
>
>
> -- 
>
> James
> -------
> http://radio.weblogs.com/0112098/


Mime
View raw message