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 Fri, 26 May 2006 21:18:58 GMT
Thanks for the suggestion. Unfortunately, when the AMQ/lib jar files  
are deployed to Tomcat session.createProducer(dest) still throws  
'Error java.lang.LinkageError: loader constraints violated when  
linking javax/jms/Destination'

A couple of other observations:
1. If I declare my Connection to be a jms/Connection rather than an  
AMQConnection, as I've seen in some examples, connection.start()  
throws 'java.lang.LinkageError: Class javax/jms/Connection violates  
loader constraints' before I ever get to the createProducer() call.
2. With Tomcat 5.5.15 and AMQ 4.0 (May 8) running on the same box,  
I'm also seeing some 'buggy' interactions between the two. If I try  
to keep AMQ running and build and reinstall my webapp, my build  
process hangs. I then have to restart AMQ and Tomcat to rebuild and  
launch my webapp. On occasion I also end up with some stray java  
processes that must also be killed.

Thanks for any help anyone can provide.

Brad


On May 19, 2006, at 12:25 PM, amerigo5 wrote:
>
> Can you try adding the jar files from $ACTIVEMQ_HOME/lib/?
> --
> View this message in context: http://www.nabble.com/Connecting+from 
> +Tomcat+5.5.15-t1639639.html#a4475584
> Sent from the ActiveMQ - User forum at Nabble.com.



On May 17, 2006, at 3:35 PM, brad steiner 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


Mime
View raw message