You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Paul Smith <ps...@aconex.com> on 2007/06/21 01:02:44 UTC

Basic Spring+AMQ+XBean+embededbroker problem

Ok, well I'm officially stumped, but I can't get a basic Spring+AMQ  
4.1.1+XBeans with embedded broker test harness to work using the  
configuration outlined here:

http://activemq.apache.org/how-do-i-embed-a-broker-inside-a- 
connection.html

I get a ClassNotFoundException (see [1]).  Now, _obviously_ I'm  
missing something in the class path, but I cannot work out what is  
missing.  I looked at the AMQ pom.xml to see if something jumped out,  
but I can't work it out.   I'm familiar with Maven and Spring  
recently getting on board the bandwagon, but definitely no expert, so  
I'm sure this is related to that.

My test harness has these dependencies in it's pom:

   <dependencies>
     <dependency>
       <groupId>org.apache.activemq</groupId>
       <artifactId>activemq-core</artifactId>
       <version>4.1.1</version>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring</artifactId>
       <version>2.0.5</version>
     </dependency>
     <dependency>
       <groupId>org.apache.xbean</groupId>
       <artifactId>xbean-spring-v2</artifactId>
       <version>2.8</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>3.8.2</version>
       <scope>test</scope>
     </dependency>

To maximize my chances of help, I've even created a simple mavenized  
test project to demonstrate:

http://people.apache.org/~psmith/activemqspringtestbed.tar.gz

What am I missing?  I'm fully prepared to be slapped in the face with  
the obvious.

[1] Exception

org.springframework.beans.factory.BeanDefinitionStoreException:  
Unexpected exception parsing XML document from class path resource  
[config.xml]; nested exception is  
org.springframework.beans.BeanInstantiationException: Could not  
instantiate bean class  
[org.apache.xbean.spring.context.v2.XBeanNamespaceHandler]:  
Constructor threw exception; nested exception is  
java.lang.IllegalStateException: Unable to create namespace handler  
for: v2c
Caused by: org.springframework.beans.BeanInstantiationException:  
Could not instantiate bean class  
[org.apache.xbean.spring.context.v2.XBeanNamespaceHandler]:  
Constructor threw exception; nested exception is  
java.lang.IllegalStateException: Unable to create namespace handler  
for: v2c
Caused by: java.lang.IllegalStateException: Unable to create  
namespace handler for: v2c
	at  
org.apache.xbean.spring.context.v2.XBeanV2Helper.createNamespaceHandler( 
XBeanV2Helper.java:48)
....
Caused by: java.lang.ClassNotFoundException:  
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
....
	at  
org.apache.xbean.spring.context.v2.XBeanV2Helper.createNamespaceHandler( 
XBeanV2Helper.java:45)
	... 46 more






Re: Basic Spring+AMQ+XBean+embededbroker problem

Posted by James Strachan <ja...@gmail.com>.
On 6/21/07, Paul Smith <ps...@aconex.com> wrote:
>
> On 21/06/2007, at 5:55 PM, James Strachan wrote:
>
> > This line was the giveaway...
> >
> >
> > On 6/21/07, Paul Smith <ps...@aconex.com> wrote:
> > [snip]
> >
> >> Caused by: java.lang.ClassNotFoundException:
> >> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler
> >>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> >>         at java.security.AccessController.doPrivileged(Native Method)
> >
> >
>
> I knew it would be!
>
> > Try adding this dependency...
> >
> >    <dependency>
> >      <groupId>org.apache.xbean</groupId>
> >      <artifactId>xbean-spring</artifactId>
> >      <version>2.8</version>
> >    </dependency>
> >
>
> ahhhhhhhh.  I mean I spent _ages_ searching mvnrepository.com.
> There's unfortunately about 400 million different options with search
> terms 'xbean' and 'spring', and I have to swear I thought I tried
> that combo (maybe not 2.8 version).
>
> Thanks muchly for your help.

You're welcome :)

We should maybe create a maven artifact for a java project using
ActiveMQ with the pom set just right etc...
-- 
James
-------
http://macstrac.blogspot.com/

Re: Basic Spring+AMQ+XBean+embededbroker problem

Posted by Paul Smith <ps...@aconex.com>.
On 21/06/2007, at 5:55 PM, James Strachan wrote:

> This line was the giveaway...
>
>
> On 6/21/07, Paul Smith <ps...@aconex.com> wrote:
> [snip]
>
>> Caused by: java.lang.ClassNotFoundException:
>> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler
>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>>         at java.security.AccessController.doPrivileged(Native Method)
>
>

I knew it would be!

> Try adding this dependency...
>
>    <dependency>
>      <groupId>org.apache.xbean</groupId>
>      <artifactId>xbean-spring</artifactId>
>      <version>2.8</version>
>    </dependency>
>

ahhhhhhhh.  I mean I spent _ages_ searching mvnrepository.com.   
There's unfortunately about 400 million different options with search  
terms 'xbean' and 'spring', and I have to swear I thought I tried  
that combo (maybe not 2.8 version).

Thanks muchly for your help.



Re: Basic Spring+AMQ+XBean+embededbroker problem

Posted by James Strachan <ja...@gmail.com>.
This line was the giveaway...


On 6/21/07, Paul Smith <ps...@aconex.com> wrote:
[snip]

> Caused by: java.lang.ClassNotFoundException:
> org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>         at java.security.AccessController.doPrivileged(Native Method)


Try adding this dependency...

    <dependency>
      <groupId>org.apache.xbean</groupId>
      <artifactId>xbean-spring</artifactId>
      <version>2.8</version>
    </dependency>


As xbean-spring was built to support both spring 1.x and 2.x so its in
2 modules, the core and the spring 2 specific stuff.

>From 3.x onwards, xbean-spring just depends on spring 2 so AFAIK its one module

-- 
James
-------
http://macstrac.blogspot.com/