activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Pilone <>
Subject Re: Newbie to activemq
Date Wed, 12 Sep 2012 19:10:31 GMT
If I had to guess I would say you're having a class loader issue because the same class is
reachable via two different classes. This can be a common problem in a  container (like Tomcat)
if the class is on both the container's class path and bundled in a web application. Containers
have different rules (and sometimes configuration options) related to class loader isolation
for web applications because the specification is a little ambiguous in some areas.

I'd check which JARs you have in the class path and see how o.s.c.i.Resource is getting resolved
by two different loaders.


[cid:F8024659-7071-4AB3-B5BD-0D603C9B2075] | Mike Pilone | Software Architect, Distribution
|<> | o: 202-513-2679  m: 703-969-7493

From: Saikat Kanjilal <<>>
Reply-To: "<>" <<>>
Date: Wednesday, September 12, 2012 2:00 PM
To: "<>" <<>>
Subject: RE: Newbie to activemq

So I was able to get past the issue below by just trying to get the local install for jndi
with tomcat working.  However I am now seeing the following issue in the tomcat stack trace:

Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(Lorg/springframework/core/io/Resource;)V"
the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current
class, org/apache/activemq/xbean/XBeanBrokerFactory$1, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader)
for resolved class, org/apache/xbean/spring/context/ResourceXmlApplicationContext, have different
Class objects for the type org/springframework/core/io/Resource used in the signature

Does this mean that the version of xbean-spring is incorrect, has anyone run into this before?


Subject: RE: Newbie to activemq
Date: Tue, 11 Sep 2012 08:29:25 -0700
I will increase the logging level in spring and see what I can find, also I have no idea whether
the initial context factory class is visible or not, I guess I'd like to understand why it
wouldn't be visible or figure out how this visibility is reconciled, is this something where
spring cannot see tomcat's environment, pardon my ignorance on this, I'll be reading docs
on JNDI setup in Tomcat as well as spring docs, it would be great if someone who already has
this setup working could help give a pointer.  Could this be an issue where I need to copy
the individual activemq jar files to the tomcat/lib directory instead of the activemq-all-versionnumber.jar,
see this thread (
Also to provide more details around my setup:
Wikis referenced: (,
version: 6.0.35spring version: 3.0.5activemq version: 5.6.0maven (not that this matters but
I'll put this here anyway): 2.2.1Use Case: Consumer running on same JVM as producer, consumer
needs to read off the queue and make an http call to update a cache, producer needs to read
from a relational db and populate/update the queue
> Date: Tue, 11 Sep 2012 10:52:01 +0100
> Subject: Re: Newbie to activemq
> From:<>
> To:<>
> see if you can increase the logging level for spring. It may just be a
> class loading issue trying to resolve the initial context factory.
> Are you certain that the activemq initial context factory class is
> visible to your spring context?
> On 11 September 2012 07:51, Saikat Kanjilal <<>>
> >
> > Yes I saw that link already, however we are using spring in our infrastructure and
unfortunately changing to Camel is currently not an option for me.  I feel like I am pretty
close , just need to figure out whether this is a tomcat jndi issue or a spring issue, the
error message is not really clear :)
> >
> >> From:<>
> >> Date: Tue, 11 Sep 2012 08:47:23 +0200
> >> Subject: Re: Newbie to activemq
> >> To:<>
> >>
> >> Hi
> >>
> >> If you use Camel to communicate with JMS / ActiveMQ, then we have an
> >> example how to embed AMQ + Camel in Tomcat (eg a WAR app). You can
> >> take a look at this:
> >>
> >>
> >>
> >>
> >> On Tue, Sep 11, 2012 at 8:44 AM, Saikat Kanjilal <<>>
> >> >
> >> > Hello all,I'm new to activemq but not to java and spring and I would much
appreciate some help, I am trying to get activemq running with spring and in embedded mode
with Tomcat version 6.    I have followed the following wikis (,
and gone through each of the steps, however in both cases I end up with the following stack
> >> > org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'connectionFactory': Invocation of init method failed; nested exception is
javax.naming.NamingException: Cannot create resource instance
> >> >
> >> > It seems like either my JNDI setup is not correct in tomcat or there is
some other spring issue.   Also note that I am trying to get the consumer and the producer
to run on the same jvm.
> >> > I am running active mq version 5.6.0 with spring 3.0.5.
> >> >
> >> > Looking forward to your help.
> >> > Regards
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> FuseSource
> >> Email:<>
> >> Web:
> >> Twitter: davsclaus, fusenews
> >> Blog:
> >> Author of Camel in Action:
> >
> --

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