You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by okuntze <ol...@union-investment.de> on 2007/06/25 13:54:21 UTC

Spring AOP integration in ServiceMix

Hi,

I'm trying to use Spring AOP in my ServiceMix runtime.

Since I'm apparently doing something basic terribly wrong, it would be great
if you could help me out with some info.

I have an aspect like this:

<code>
package de.mycompany.myproject;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
public class MonitoringAspect {
	@Pointcut("execution(* de.mycompany.myproject..*.*(..)))")
	public Object doSomething() {
		throw new RuntimeException("Im doSomething Advice!!!");
	}
}
</code>

Furthermore I have a corresponding xbean file:

<code>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
	xmlns:aop="http://www.springframework.org/schema/aop" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
	<aop:aspectj-autoproxy/>
	<bean class="de.mycompany.myproject.MonitoringAspect"
id="swiftTransformationMonitoringAspect"/>
</beans>
</code>

And finally I have a POM like this:

<code>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>oliver.osiris.playground.sandbox</groupId>
		<artifactId>sandbox</artifactId>
		<version>1.0</version>
	</parent>

<groupId>oliver.osiris.playground.sandbox.swifttransformation-monitoring</groupId>
	<artifactId>swifttransformation-aspect</artifactId>
	<name>Osiris :: sandbox :: swifttransformation-monitoring ::
swifttransformation-aspect</name>
	<packaging>jbi-shared-library</packaging>
	<version>1.0</version>
	<url>${site.root}//sandbox/</url>
	<dependencies>
		<dependency>
			<groupId>aspectj</groupId>
			<artifactId>aspectjrt</artifactId>
			<version>1.5.3</version>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.servicemix.tooling</groupId>
				<artifactId>jbi-maven-plugin</artifactId>
				<version>${servicemix-version}</version>
				<extensions>true</extensions>
			</plugin>
		</plugins>
	</build>
</project>
</code>

So what I am doing is: Using the POM to build a ServiceMix shared library
containing the aspect class and the Spring xbean configuration.

Unfortunately the advice ist never executed.

What am I doing wrong?

Thanks a lot in advance for your help!

Cheers,

Oliver. 
-- 
View this message in context: http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11285308
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Spring AOP integration in ServiceMix

Posted by okuntze <ol...@union-investment.de>.
Thanks for the prompt answer, Bruce!

I think I am lacking some understanding of the basics here.

I am trying to advise some classes that belong to my SUs. Since my JBI
components are managed by ServiceMix and ServiceMix uses the Spring
container, I thought that if I am in a ServiceMix context I can only use
Spring AOP by somehow telling ServiceMix "Hey, here is my aspect and her is
my Spring xbean config. Now, please pass this info to the Spring container
and let Spring handle the AOP stuff.".
That is also the reason why I am building a shared library. I thought, if I
have to pass aspects to the Spring container which in turn is "under the
hood" of ServiceMix, I have to use ServiceMix "technology". I thought
ServiceMix would then "see" "Ah, this is Spring AOP stuff. I have to pass
this to the Spring container.". Since SAs/SUs and shared libs are the
deployable ServiceMix artefacts I know, I chose a shared lib to pass my AOP
stuff to ServiceMix.

How should one use AOP in a ServiceMix environment?
We need runtime weaving. Loadtime and compiletime weaving are no options. So
I thought, let's use Spring AOP if ServiceMix uses Spring. As I can see, the
latest ServiceMix uses Spring 2 with all its nice AOP improvements.

Should I directly use the Spring container used by ServiceMix? I.e. is my
aproach to "go through the ServiceMix layer" wrong? Are the ServiceMix
components managed by the Spring container so that instead of using the
"going through the ServiceMix layer" I should directly configure the Spring
container used by ServieMix?

Questions over questions. ;-)

Again, thanks a lot in advance!

Cheers,

Oliver.


bsnyder wrote:
> 
> On 6/25/07, okuntze <ol...@union-investment.de> wrote:
>>
>> Hi,
>>
>> I'm trying to use Spring AOP in my ServiceMix runtime.
>>
>> Since I'm apparently doing something basic terribly wrong, it would be
>> great
>> if you could help me out with some info.
>>
>> I have an aspect like this:
>>
>> <code>
>> package de.mycompany.myproject;
>>
>> import org.aspectj.lang.annotation.Aspect;
>> import org.aspectj.lang.annotation.Pointcut;
>>
>> @Aspect
>> public class MonitoringAspect {
>>         @Pointcut("execution(* de.mycompany.myproject..*.*(..)))")
>>         public Object doSomething() {
>>                 throw new RuntimeException("Im doSomething Advice!!!");
>>         }
>> }
>> </code>
>>
>> Furthermore I have a corresponding xbean file:
>>
>> <code>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>>         xmlns:aop="http://www.springframework.org/schema/aop"
>>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
>>         <aop:aspectj-autoproxy/>
>>         <bean class="de.mycompany.myproject.MonitoringAspect"
>> id="swiftTransformationMonitoringAspect"/>
>> </beans>
>> </code>
>>
>> And finally I have a POM like this:
>>
>> <code>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <project xmlns="http://maven.apache.org/POM/4.0.0"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>         <modelVersion>4.0.0</modelVersion>
>>         <parent>
>>                 <groupId>oliver.osiris.playground.sandbox</groupId>
>>                 <artifactId>sandbox</artifactId>
>>                 <version>1.0</version>
>>         </parent>
>>
>> <groupId>oliver.osiris.playground.sandbox.swifttransformation-monitoring</groupId>
>>         <artifactId>swifttransformation-aspect</artifactId>
>>         <name>Osiris :: sandbox :: swifttransformation-monitoring ::
>> swifttransformation-aspect</name>
>>         <packaging>jbi-shared-library</packaging>
>>         <version>1.0</version>
>>         <url>${site.root}//sandbox/</url>
>>         <dependencies>
>>                 <dependency>
>>                         <groupId>aspectj</groupId>
>>                         <artifactId>aspectjrt</artifactId>
>>                         <version>1.5.3</version>
>>                 </dependency>
>>         </dependencies>
>>         <build>
>>                 <plugins>
>>                         <plugin>
>>                                
>> <groupId>org.apache.servicemix.tooling</groupId>
>>                                 <artifactId>jbi-maven-plugin</artifactId>
>>                                 <version>${servicemix-version}</version>
>>                                 <extensions>true</extensions>
>>                         </plugin>
>>                 </plugins>
>>         </build>
>> </project>
>> </code>
>>
>> So what I am doing is: Using the POM to build a ServiceMix shared library
>> containing the aspect class and the Spring xbean configuration.
>>
>> Unfortunately the advice ist never executed.
>>
>> What am I doing wrong?
> 
> Are the beans you're trying to advise instantiated explicitly by
> Spring? Also, why are you building a shared library?
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache Geronimo - http://geronimo.apache.org/
> Apache ActiveMQ - http://activemq.org/
> Apache ServiceMix - http://servicemix.org/
> Castor - http://castor.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11300870
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Spring AOP integration in ServiceMix

Posted by oliver kuntze <ol...@union-investment.de>.
Hi Guillaume,

thanks for the insight!

It would be great if you could comment on my reply to Bruce's answer.

How can I use AOP in a ServiceMix runtime environment?

Thanks in advance!

Cheers,

Oliver. 



gnodet wrote:
> 
> Yeah, shared libraries are meant to be used by components, not service
> units.
> Though servicemix 3.2 is able to include SL in SU classloaders using the
>    <classpath>
>      <library> xxx </library>
>    </classpath>
> 
> 
> 
> 
> On 6/26/07, Bruce Snyder <br...@gmail.com> wrote:
>>
>> On 6/25/07, okuntze <ol...@union-investment.de> wrote:
>> >
>> > Hi,
>> >
>> > I'm trying to use Spring AOP in my ServiceMix runtime.
>> >
>> > Since I'm apparently doing something basic terribly wrong, it would be
>> great
>> > if you could help me out with some info.
>> >
>> > I have an aspect like this:
>> >
>> > <code>
>> > package de.mycompany.myproject;
>> >
>> > import org.aspectj.lang.annotation.Aspect;
>> > import org.aspectj.lang.annotation.Pointcut;
>> >
>> > @Aspect
>> > public class MonitoringAspect {
>> >         @Pointcut("execution(* de.mycompany.myproject..*.*(..)))")
>> >         public Object doSomething() {
>> >                 throw new RuntimeException("Im doSomething Advice!!!");
>> >         }
>> > }
>> > </code>
>> >
>> > Furthermore I have a corresponding xbean file:
>> >
>> > <code>
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >         xmlns:aop="http://www.springframework.org/schema/aop"
>> >         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
>> >         <aop:aspectj-autoproxy/>
>> >         <bean class="de.mycompany.myproject.MonitoringAspect"
>> > id="swiftTransformationMonitoringAspect"/>
>> > </beans>
>> > </code>
>> >
>> > And finally I have a POM like this:
>> >
>> > <code>
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <project xmlns="http://maven.apache.org/POM/4.0.0"
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> >         <modelVersion>4.0.0</modelVersion>
>> >         <parent>
>> >                 <groupId>oliver.osiris.playground.sandbox</groupId>
>> >                 <artifactId>sandbox</artifactId>
>> >                 <version>1.0</version>
>> >         </parent>
>> >
>> >
>> <groupId>oliver.osiris.playground.sandbox.swifttransformation-monitoring
>> </groupId>
>> >         <artifactId>swifttransformation-aspect</artifactId>
>> >         <name>Osiris :: sandbox :: swifttransformation-monitoring ::
>> > swifttransformation-aspect</name>
>> >         <packaging>jbi-shared-library</packaging>
>> >         <version>1.0</version>
>> >         <url>${site.root}//sandbox/</url>
>> >         <dependencies>
>> >                 <dependency>
>> >                         <groupId>aspectj</groupId>
>> >                         <artifactId>aspectjrt</artifactId>
>> >                         <version>1.5.3</version>
>> >                 </dependency>
>> >         </dependencies>
>> >         <build>
>> >                 <plugins>
>> >                         <plugin>
>> >                                 <groupId>org.apache.servicemix.tooling
>> </groupId>
>> >
>> <artifactId>jbi-maven-plugin</artifactId>
>> >                                
>> <version>${servicemix-version}</version>
>> >                                 <extensions>true</extensions>
>> >                         </plugin>
>> >                 </plugins>
>> >         </build>
>> > </project>
>> > </code>
>> >
>> > So what I am doing is: Using the POM to build a ServiceMix shared
>> library
>> > containing the aspect class and the Spring xbean configuration.
>> >
>> > Unfortunately the advice ist never executed.
>> >
>> > What am I doing wrong?
>>
>> Are the beans you're trying to advise instantiated explicitly by
>> Spring? Also, why are you building a shared library?
>>
>> Bruce
>> --
>> perl -e 'print
>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> );'
>>
>> Apache Geronimo - http://geronimo.apache.org/
>> Apache ActiveMQ - http://activemq.org/
>> Apache ServiceMix - http://servicemix.org/
>> Castor - http://castor.org/
>>
> 
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Principal Engineer, IONA
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11301040
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Spring AOP integration in ServiceMix

Posted by Guillaume Nodet <gn...@gmail.com>.
Yeah, shared libraries are meant to be used by components, not service
units.
Though servicemix 3.2 is able to include SL in SU classloaders using the
   <classpath>
     <library> xxx </library>
   </classpath>




On 6/26/07, Bruce Snyder <br...@gmail.com> wrote:
>
> On 6/25/07, okuntze <ol...@union-investment.de> wrote:
> >
> > Hi,
> >
> > I'm trying to use Spring AOP in my ServiceMix runtime.
> >
> > Since I'm apparently doing something basic terribly wrong, it would be
> great
> > if you could help me out with some info.
> >
> > I have an aspect like this:
> >
> > <code>
> > package de.mycompany.myproject;
> >
> > import org.aspectj.lang.annotation.Aspect;
> > import org.aspectj.lang.annotation.Pointcut;
> >
> > @Aspect
> > public class MonitoringAspect {
> >         @Pointcut("execution(* de.mycompany.myproject..*.*(..)))")
> >         public Object doSomething() {
> >                 throw new RuntimeException("Im doSomething Advice!!!");
> >         }
> > }
> > </code>
> >
> > Furthermore I have a corresponding xbean file:
> >
> > <code>
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans xmlns="http://www.springframework.org/schema/beans"
> >         xmlns:aop="http://www.springframework.org/schema/aop"
> >         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
> >         <aop:aspectj-autoproxy/>
> >         <bean class="de.mycompany.myproject.MonitoringAspect"
> > id="swiftTransformationMonitoringAspect"/>
> > </beans>
> > </code>
> >
> > And finally I have a POM like this:
> >
> > <code>
> > <?xml version="1.0" encoding="UTF-8"?>
> > <project xmlns="http://maven.apache.org/POM/4.0.0"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> >         <modelVersion>4.0.0</modelVersion>
> >         <parent>
> >                 <groupId>oliver.osiris.playground.sandbox</groupId>
> >                 <artifactId>sandbox</artifactId>
> >                 <version>1.0</version>
> >         </parent>
> >
> > <groupId>oliver.osiris.playground.sandbox.swifttransformation-monitoring
> </groupId>
> >         <artifactId>swifttransformation-aspect</artifactId>
> >         <name>Osiris :: sandbox :: swifttransformation-monitoring ::
> > swifttransformation-aspect</name>
> >         <packaging>jbi-shared-library</packaging>
> >         <version>1.0</version>
> >         <url>${site.root}//sandbox/</url>
> >         <dependencies>
> >                 <dependency>
> >                         <groupId>aspectj</groupId>
> >                         <artifactId>aspectjrt</artifactId>
> >                         <version>1.5.3</version>
> >                 </dependency>
> >         </dependencies>
> >         <build>
> >                 <plugins>
> >                         <plugin>
> >                                 <groupId>org.apache.servicemix.tooling
> </groupId>
> >
> <artifactId>jbi-maven-plugin</artifactId>
> >                                 <version>${servicemix-version}</version>
> >                                 <extensions>true</extensions>
> >                         </plugin>
> >                 </plugins>
> >         </build>
> > </project>
> > </code>
> >
> > So what I am doing is: Using the POM to build a ServiceMix shared
> library
> > containing the aspect class and the Spring xbean configuration.
> >
> > Unfortunately the advice ist never executed.
> >
> > What am I doing wrong?
>
> Are the beans you're trying to advise instantiated explicitly by
> Spring? Also, why are you building a shared library?
>
> Bruce
> --
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache Geronimo - http://geronimo.apache.org/
> Apache ActiveMQ - http://activemq.org/
> Apache ServiceMix - http://servicemix.org/
> Castor - http://castor.org/
>



-- 
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/

Re: Spring AOP integration in ServiceMix

Posted by oliver kuntze <ol...@union-investment.de>.
Quick update...

It was a classloading issue. 

We package all our extended servicemix stuff together with the original
servicemix libs into the servicemix-jboss-deployer service archive to have
as few as possible in the jboss server lib directory but instead to have all
runtime dependencies in one place.

Apparently this approach is preventing us from using Spring-AOP in our
service units.

After copying the Spring-AOP libs to the the jboss server lib directory
Spring finds my AspectJ style annotated aspect classes and auto-proxies
them.

Very happy! :-)

Cheers,

Oliver.


gnodet wrote:
> 
> Try with ServiceMix standalone first, and put spring-aop in the
> lib/optional folder,
> maybe it will help.
> 
> On 6/27/07, oliver kuntze <ol...@union-investment.de> wrote:
>>
>> I just tried out if Spring-AOP none-ApectJ style is working with
>> ServiceMix.
>>
>> I am running into the same kind of error.
>>
>> The exception is:
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean
>> with name 'org.springframework.aop.config.internalAutoProxyCreator':
>> Initialization of bean failed; nested exception is
>> java.lang.AbstractMethodError
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.
>> createBean(AbstractAutowireCapableBeanFactory.java:443)
>>
>> If trying to get Spring-AOP ApectJ style working with ServiceMix you get
>> the
>> following exception:
>> Caused by: org.springframework.beans.factory.BeanCreationException: Error
>> creating bean with name
>> 'org.springframework.aop.config.internalAutoProxyCreator': Initialization
>> of
>> bean failed; nested exception is java.lang.AbstractMethodError:
>> org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.
>> findCandidateAdvisors()Ljava/util/List;
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.
>> createBean(AbstractAutowireCapableBeanFactory.java:443)
>>
>> Apparently Spring's AbstractAutowireCapableBeanFactory is not able to
>> create
>> a bean with name
>> 'org.springframework.aop.config.internalAutoProxyCreator'.
>> Why? No clue.
>>
>> If anybody has ever succeeded in using Spring-AOP in ServiceMix deployed
>> in
>> a JBoss environment, please help.
>>
>> Thanks a lot!
>>
>> Cheers,
>>
>> Oliver.
> 

-- 
View this message in context: http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11356591
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Spring AOP integration in ServiceMix

Posted by Guillaume Nodet <gn...@gmail.com>.
Try with ServiceMix standalone first, and put spring-aop in the
lib/optional folder,
maybe it will help.

On 6/27/07, oliver kuntze <ol...@union-investment.de> wrote:
>
> I just tried out if Spring-AOP none-ApectJ style is working with ServiceMix.
>
> I am running into the same kind of error.
>
> The exception is:
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'org.springframework.aop.config.internalAutoProxyCreator':
> Initialization of bean failed; nested exception is
> java.lang.AbstractMethodError
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.
> createBean(AbstractAutowireCapableBeanFactory.java:443)
>
> If trying to get Spring-AOP ApectJ style working with ServiceMix you get the
> following exception:
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name
> 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of
> bean failed; nested exception is java.lang.AbstractMethodError:
> org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.
> findCandidateAdvisors()Ljava/util/List;
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.
> createBean(AbstractAutowireCapableBeanFactory.java:443)
>
> Apparently Spring's AbstractAutowireCapableBeanFactory is not able to create
> a bean with name 'org.springframework.aop.config.internalAutoProxyCreator'.
> Why? No clue.
>
> If anybody has ever succeeded in using Spring-AOP in ServiceMix deployed in
> a JBoss environment, please help.
>
> Thanks a lot!
>
> Cheers,
>
> Oliver.
>
>
>
> oliver kuntze wrote:
> >
> > Could it be that because of the way ServiceMix@JBoss does the
> > classloading, currently it is not possible to use Spring-AOP (at least
> > AspectJ annotation style)?
> >
> > I googled the following exception I get
> > java.lang.AbstractMethodError:
> > org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.
> > findCandidateAdvisors()Ljava/util/List;
> > All the posts are dealing with classloading or lib version
> > incompatibilities, most of them dealing with ASM in the CGLIB jar (which
> > is also used be JBoss' Hibernate).
> >
> > So I took a look at the POM for spring-aop.jar (Version 2.0.1, the one
> > that is also packaged in my ServiceMix distribution) and inluced all jars
> > listed in the dependency section in my
> > servicemix-jboss-deployer-3.1-incubating.sar and in my SU. I also tried
> > only putting them in the servicemix-jboss-deployer-3.1-incubating.sar and
> > only putting them in the SU.
> >
> > The POM looks like this:
> > <code>
> > <?xml version="1.0" encoding="UTF-8"?>
> > <project xmlns="http://maven.apache.org/POM/4.0.0"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> >       <modelVersion>4.0.0</modelVersion>
> >       <parent>
> >
> > <groupId>oliver.osiris.playground.sandbox.swifttransformation-service</groupId>
> >               <artifactId>swifttransformation-service</artifactId>
> >               <version>1.0</version>
> >       </parent>
> >
> > <groupId>oliver.osiris.playground.sandbox.swifttransformation-service</groupId>
> >       <artifactId>swifttransformation-jsr181-su</artifactId>
> >       <name>Osiris :: sandbox :: swifttransformation-service ::
> > swifttransformation-jsr181-su :: SU</name>
> >       <packaging>jbi-service-unit</packaging>
> >       <version>1.0</version>
> >       <url>${site.root}//swifttransformation-service/</url>
> >       <dependencies>
> >               <dependency>
> >                       <groupId>aopalliance</groupId>
> >                       <artifactId>aopalliance</artifactId>
> >                       <version>1.0</version>
> >               </dependency>
> >               <dependency>
> >                       <groupId>aspectj</groupId>
> >                       <artifactId>aspectjrt</artifactId>
> >                       <version>1.5.2a</version>
> >                       <scope>provided</scope>
> >               </dependency>
> >               <dependency>
> >                       <groupId>aspectj</groupId>
> >                       <artifactId>aspectjweaver</artifactId>
> >                       <version>1.5.2a</version>
> >               </dependency>
> >               <dependency>
> >                       <groupId>cglib</groupId>
> >                       <artifactId>cglib-nodep</artifactId>
> >                       <version>2.1_3</version>
> >               </dependency>
> >               <dependency>
> >                       <groupId>commons-attributes</groupId>
> >                       <artifactId>commons-attributes-api</artifactId>
> >                       <version>2.2</version>
> >               </dependency>
> >               <dependency>
> >                       <groupId>commons-attributes</groupId>
> >                       <artifactId>commons-attributes-compiler</artifactId>
> >                       <version>2.2</version>
> >               </dependency>
> >               <dependency>
> >                       <groupId>commons-logging</groupId>
> >                       <artifactId>commons-logging</artifactId>
> >                       <version>1.1</version>
> >               </dependency>
> >               <dependency>
> >                       <groupId>commons-pool</groupId>
> >                       <artifactId>commons-pool</artifactId>
> >                       <version>1.3</version>
> >               </dependency>
> >               <dependency>
> >                       <groupId>com.jamonapi</groupId>
> >                       <artifactId>jamon</artifactId>
> >                       <version>1.0</version>
> >               </dependency>
> >               <dependency>
> >                       <groupId>oro</groupId>
> >                       <artifactId>oro</artifactId>
> >                       <version>2.0.8</version>
> >               </dependency>
> >               <dependency>
> >                       <groupId>org.springframework</groupId>
> >                       <artifactId>spring-aop</artifactId>
> >                       <version>2.0.1</version>
> >               </dependency>
> >               <dependency>
> >                       <groupId>org.apache.servicemix</groupId>
> >                       <artifactId>servicemix-jsr181</artifactId>
> >                       <version>${servicemix-version}</version>
> >               </dependency>
> >               <dependency>
> >                       <groupId>mycompany.framework</groupId>
> >                       <artifactId>mycompany-shared</artifactId>
> >                       <version>${myproject-version}</version>
> >                       <scope>provided</scope>
> >               </dependency>
> >       </dependencies>
> >       <build>
> >               <plugins>
> >                       <plugin>
> >                               <groupId>org.apache.servicemix.tooling</groupId>
> >                               <artifactId>jbi-maven-plugin</artifactId>
> >                               <version>${servicemix-version}</version>
> >                               <extensions>true</extensions>
> >                               <configuration>
> >                                       <type>service-unit</type>
> >                                       <generateJbiDescriptor>false</generateJbiDescriptor>
> >                               </configuration>
> >                       </plugin>
> >               </plugins>
> >       </build>
> > </project>
> > </code>
> >
> > Help is greatly appreciated!
> > It would be really sad if one could not use Spring-AOP (AspectJ style).
> >
> > Has anyone ever succeeded in getting this up and running?
> >
> > Thanks a lot in advance!
> >
> > Cheers,
> >
> > Oliver.
> >
> >
> > gnodet wrote:
> >>
> >> Not really. Have you tried googling for the exception ?
> >>
> >> On 6/26/07, oliver kuntze <ol...@union-investment.de> wrote:
> >>>
> >>> Perfect! Thanks a lot, Guillaume!
> >>>
> >>> When trying to deploy the advised SU I get the following exception:
> >>>
> >>> <code>
> >>> org.springframework.beans.factory.BeanCreationException: Error creating
> >>> bean
> >>> with name 'org.springframework.aop.config.internalAutoProxyCreator':
> >>> Initialization of bean failed; nested exception is
> >>> java.lang.AbstractMethodError:
> >>> org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.
> >>> findCandidateAdvisors()Ljava/util/List;
> >>> </code>
> >>>
> >>> Still trying...
> >>>
> >>> Do you have any ideas???
> >>>
> >>> Thanks very much!
> >>>
> >>> Cheers,
> >>>
> >>> Oliver.
> >>>
> >>>
> >>>
> >>> gnodet wrote:
> >>> >
> >>> > On 6/26/07, oliver kuntze <ol...@union-investment.de> wrote:
> >>> >>
> >>> >>
> >>> >> Ok, I think I got it.
> >>> >>
> >>> >> When a SU is deployed to a ServiceMix component, the component
> >>> creates a
> >>> >> Spring application context and configures the app according to the
> >>> >> xbean.xml. I.e. every SU is in fact a Spring application.
> >>> >> That means out of the box one is able to use Spring AOP aspects per
> >>> SU.
> >>> >> If
> >>> >> one would like to have aspects for his/her "eai application", that is
> >>> for
> >>> >> a
> >>> >> whole bunch of SAs, than one should extend ServiceMix / Xbean
> >>> somehow so
> >>> >> that a "global" xbean config containing the aspects is added to the
> >>> >> ApplicationContext when the XBean SpringLoader has loaded the
> >>> xbean.xml.
> >>> >> Correct?
> >>> >
> >>> >
> >>> > Exactly !
> >>> >
> >>> > I tried to deploy a SU with an aspect but received the following
> >>> > exception:
> >>> >> BeanDefinitionStoreException: Unrecognized xbean namespace mapping:
> >>> >> http://www.springframework.org/schema/aop
> >>> >>
> >>> >> My xbean.xml looks like this:
> >>> >> <code>
> >>> >> <?xml version="1.0" encoding="UTF-8"?>
> >>> >> <beans xmlns="http://www.springframework.org/schema/beans"
> >>> >>         xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
> >>> >>
> >>> xmlns:swifttransformation="http://mycompany/swifttransformation"
> >>> >>         xmlns:aop="http://www.springframework.org/schema/aop">
> >>> >>
> >>> >>         <aop:aspectj-autoproxy/>
> >>> >>         <bean class="
> >>> >> mycompany.playground.swifttransformation.MonitoringAspect"
> >>> >> id="swiftTransformationMonitoringAspect"/>
> >>> >>
> >>> >>         <jsr181:endpoint endpoint="swift2xml"
> >>> >>                 service="swifttransformation:iso15022-transformation"
> >>> >>
> >>> >> serviceInterface="
> >>> >> mycompany.playground.swifttransformation.SwiftToXmlTransformer"
> >>> >>                 typeMapping="xmlbeans">
> >>> >>                 <jsr181:pojo>
> >>> >>                         <bean
> >>> >>
> >>> class="mycompany.playground.swifttransformation.SwiftToXmlTransformerImpl"
> >>> >> />
> >>> >>                 </jsr181:pojo>
> >>> >>         </jsr181:endpoint>
> >>> >> </beans>
> >>> >> </code>
> >>> >>
> >>> >> The spring.handler file in the spring-beans-2.0.1.jar of my
> >>> ServiceMix
> >>> >> distribution contains the following line:
> >>> >> http\://www.springframework.org/schema/aop=
> >>> >> org.springframework.aop.config.AopNamespaceHandler
> >>> >>
> >>> >> So everything seems to be in place.
> >>> >>
> >>> >> Any ideas why I get the exception?
> >>> >
> >>> >
> >>> > I don't know why the handler is defined in spring-beans while the
> >>> > associated
> >>> > class is not.
> >>> > You should put spring-aop in the SU by adding it to your pom.xml.
> >>> > It should do the trick.
> >>> >
> >>> > Thanks a lot for helping a newbie out!
> >>> >>
> >>> >> Cheers,
> >>> >>
> >>> >> Oliver.
> >>> >>
> >>> >>
> >>> >> gnodet wrote:
> >>> >> >
> >>> >> > I'm not sure to understand all the problems.
> >>> >> > If I had to do AOP inside a SU, I would just consider the SU as a
> >>> >> spring
> >>> >> > application (even if it has to contain a JBI endpoint).
> >>> >> > You can put additional jars needed in the SU and you should be able
> >>> to
> >>> >> use
> >>> >> > AOP.  You don't really need to hack the components
> >>> >> > or the main configuration file.
> >>> >> >
> >>> >> > Or maybe you want to do AOP without configuring it explicitely ?
> >>> This
> >>> >> is
> >>> >> > currently not possible.  I think it should be doable by extending
> >>> >> > the components somehow so that they always load other spring
> >>> >> configuration
> >>> >> > files: for example when a component creates a spring
> >>> >> > ApplicationContext when loading a xbean.xml, it could be configured
> >>> to
> >>> >> > always load an aop.xml configuration file that you would provide
> >>> >> > and which would add all the needed definitions.
> >>> >> >
> >>> >>
> >>> >> --
> >>> >> View this message in context:
> >>> >>
> >>> http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11303312
> >>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>> >>
> >>> >>
> >>> >
> >>> >
> >>> > --
> >>> > Cheers,
> >>> > Guillaume Nodet
> >>> > ------------------------
> >>> > Principal Engineer, IONA
> >>> > Blog: http://gnodet.blogspot.com/
> >>> >
> >>> >
> >>>
> >>> --
> >>> View this message in context:
> >>> http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11305922
> >>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>>
> >>>
> >>
> >>
> >> --
> >> Cheers,
> >> Guillaume Nodet
> >> ------------------------
> >> Principal Engineer, IONA
> >> Blog: http://gnodet.blogspot.com/
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11322643
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/

Re: Spring AOP integration in ServiceMix

Posted by oliver kuntze <ol...@union-investment.de>.
I just tried out if Spring-AOP none-ApectJ style is working with ServiceMix.

I am running into the same kind of error.

The exception is:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.springframework.aop.config.internalAutoProxyCreator':
Initialization of bean failed; nested exception is
java.lang.AbstractMethodError
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.
createBean(AbstractAutowireCapableBeanFactory.java:443)

If trying to get Spring-AOP ApectJ style working with ServiceMix you get the
following exception:
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.aop.config.internalAutoProxyCreator': Initialization of
bean failed; nested exception is java.lang.AbstractMethodError:
org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.
findCandidateAdvisors()Ljava/util/List;
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.
createBean(AbstractAutowireCapableBeanFactory.java:443)

Apparently Spring's AbstractAutowireCapableBeanFactory is not able to create
a bean with name 'org.springframework.aop.config.internalAutoProxyCreator'.
Why? No clue.

If anybody has ever succeeded in using Spring-AOP in ServiceMix deployed in
a JBoss environment, please help.

Thanks a lot!

Cheers,

Oliver.



oliver kuntze wrote:
> 
> Could it be that because of the way ServiceMix@JBoss does the
> classloading, currently it is not possible to use Spring-AOP (at least
> AspectJ annotation style)?
> 
> I googled the following exception I get
> java.lang.AbstractMethodError:
> org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.
> findCandidateAdvisors()Ljava/util/List;
> All the posts are dealing with classloading or lib version
> incompatibilities, most of them dealing with ASM in the CGLIB jar (which
> is also used be JBoss' Hibernate).
> 
> So I took a look at the POM for spring-aop.jar (Version 2.0.1, the one
> that is also packaged in my ServiceMix distribution) and inluced all jars
> listed in the dependency section in my
> servicemix-jboss-deployer-3.1-incubating.sar and in my SU. I also tried
> only putting them in the servicemix-jboss-deployer-3.1-incubating.sar and
> only putting them in the SU.
> 
> The POM looks like this:
> <code>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> 	<modelVersion>4.0.0</modelVersion>
> 	<parent>
> 	
> <groupId>oliver.osiris.playground.sandbox.swifttransformation-service</groupId>
> 		<artifactId>swifttransformation-service</artifactId>
> 		<version>1.0</version>
> 	</parent>
> 
> <groupId>oliver.osiris.playground.sandbox.swifttransformation-service</groupId>
> 	<artifactId>swifttransformation-jsr181-su</artifactId>
> 	<name>Osiris :: sandbox :: swifttransformation-service ::
> swifttransformation-jsr181-su :: SU</name>
> 	<packaging>jbi-service-unit</packaging>
> 	<version>1.0</version>
> 	<url>${site.root}//swifttransformation-service/</url>
> 	<dependencies>
> 		<dependency>
> 			<groupId>aopalliance</groupId>
> 			<artifactId>aopalliance</artifactId>
> 			<version>1.0</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>aspectj</groupId>
> 			<artifactId>aspectjrt</artifactId>
> 			<version>1.5.2a</version>
> 			<scope>provided</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>aspectj</groupId>
> 			<artifactId>aspectjweaver</artifactId>
> 			<version>1.5.2a</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>cglib</groupId>
> 			<artifactId>cglib-nodep</artifactId>
> 			<version>2.1_3</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>commons-attributes</groupId>
> 			<artifactId>commons-attributes-api</artifactId>
> 			<version>2.2</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>commons-attributes</groupId>
> 			<artifactId>commons-attributes-compiler</artifactId>
> 			<version>2.2</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>commons-logging</groupId>
> 			<artifactId>commons-logging</artifactId>
> 			<version>1.1</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>commons-pool</groupId>
> 			<artifactId>commons-pool</artifactId>
> 			<version>1.3</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>com.jamonapi</groupId>
> 			<artifactId>jamon</artifactId>
> 			<version>1.0</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>oro</groupId>
> 			<artifactId>oro</artifactId>
> 			<version>2.0.8</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.springframework</groupId>
> 			<artifactId>spring-aop</artifactId>
> 			<version>2.0.1</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.apache.servicemix</groupId>
> 			<artifactId>servicemix-jsr181</artifactId>
> 			<version>${servicemix-version}</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>mycompany.framework</groupId>
> 			<artifactId>mycompany-shared</artifactId>
> 			<version>${myproject-version}</version>
> 			<scope>provided</scope>
> 		</dependency>
> 	</dependencies>
> 	<build>
> 		<plugins>
> 			<plugin>
> 				<groupId>org.apache.servicemix.tooling</groupId>
> 				<artifactId>jbi-maven-plugin</artifactId>
> 				<version>${servicemix-version}</version>
> 				<extensions>true</extensions>
> 				<configuration>
> 					<type>service-unit</type>
> 					<generateJbiDescriptor>false</generateJbiDescriptor>
> 				</configuration>
> 			</plugin>
> 		</plugins>
> 	</build>
> </project>
> </code>
> 
> Help is greatly appreciated!
> It would be really sad if one could not use Spring-AOP (AspectJ style).
> 
> Has anyone ever succeeded in getting this up and running?
> 
> Thanks a lot in advance!
> 
> Cheers,
> 
> Oliver.
> 
> 
> gnodet wrote:
>> 
>> Not really. Have you tried googling for the exception ?
>> 
>> On 6/26/07, oliver kuntze <ol...@union-investment.de> wrote:
>>>
>>> Perfect! Thanks a lot, Guillaume!
>>>
>>> When trying to deploy the advised SU I get the following exception:
>>>
>>> <code>
>>> org.springframework.beans.factory.BeanCreationException: Error creating
>>> bean
>>> with name 'org.springframework.aop.config.internalAutoProxyCreator':
>>> Initialization of bean failed; nested exception is
>>> java.lang.AbstractMethodError:
>>> org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.
>>> findCandidateAdvisors()Ljava/util/List;
>>> </code>
>>>
>>> Still trying...
>>>
>>> Do you have any ideas???
>>>
>>> Thanks very much!
>>>
>>> Cheers,
>>>
>>> Oliver.
>>>
>>>
>>>
>>> gnodet wrote:
>>> >
>>> > On 6/26/07, oliver kuntze <ol...@union-investment.de> wrote:
>>> >>
>>> >>
>>> >> Ok, I think I got it.
>>> >>
>>> >> When a SU is deployed to a ServiceMix component, the component
>>> creates a
>>> >> Spring application context and configures the app according to the
>>> >> xbean.xml. I.e. every SU is in fact a Spring application.
>>> >> That means out of the box one is able to use Spring AOP aspects per
>>> SU.
>>> >> If
>>> >> one would like to have aspects for his/her "eai application", that is
>>> for
>>> >> a
>>> >> whole bunch of SAs, than one should extend ServiceMix / Xbean 
>>> somehow so
>>> >> that a "global" xbean config containing the aspects is added to the
>>> >> ApplicationContext when the XBean SpringLoader has loaded the
>>> xbean.xml.
>>> >> Correct?
>>> >
>>> >
>>> > Exactly !
>>> >
>>> > I tried to deploy a SU with an aspect but received the following
>>> > exception:
>>> >> BeanDefinitionStoreException: Unrecognized xbean namespace mapping:
>>> >> http://www.springframework.org/schema/aop
>>> >>
>>> >> My xbean.xml looks like this:
>>> >> <code>
>>> >> <?xml version="1.0" encoding="UTF-8"?>
>>> >> <beans xmlns="http://www.springframework.org/schema/beans"
>>> >>         xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
>>> >>        
>>> xmlns:swifttransformation="http://mycompany/swifttransformation"
>>> >>         xmlns:aop="http://www.springframework.org/schema/aop">
>>> >>
>>> >>         <aop:aspectj-autoproxy/>
>>> >>         <bean class="
>>> >> mycompany.playground.swifttransformation.MonitoringAspect"
>>> >> id="swiftTransformationMonitoringAspect"/>
>>> >>
>>> >>         <jsr181:endpoint endpoint="swift2xml"
>>> >>                 service="swifttransformation:iso15022-transformation"
>>> >>
>>> >> serviceInterface="
>>> >> mycompany.playground.swifttransformation.SwiftToXmlTransformer"
>>> >>                 typeMapping="xmlbeans">
>>> >>                 <jsr181:pojo>
>>> >>                         <bean
>>> >>
>>> class="mycompany.playground.swifttransformation.SwiftToXmlTransformerImpl"
>>> >> />
>>> >>                 </jsr181:pojo>
>>> >>         </jsr181:endpoint>
>>> >> </beans>
>>> >> </code>
>>> >>
>>> >> The spring.handler file in the spring-beans-2.0.1.jar of my
>>> ServiceMix
>>> >> distribution contains the following line:
>>> >> http\://www.springframework.org/schema/aop=
>>> >> org.springframework.aop.config.AopNamespaceHandler
>>> >>
>>> >> So everything seems to be in place.
>>> >>
>>> >> Any ideas why I get the exception?
>>> >
>>> >
>>> > I don't know why the handler is defined in spring-beans while the
>>> > associated
>>> > class is not.
>>> > You should put spring-aop in the SU by adding it to your pom.xml.
>>> > It should do the trick.
>>> >
>>> > Thanks a lot for helping a newbie out!
>>> >>
>>> >> Cheers,
>>> >>
>>> >> Oliver.
>>> >>
>>> >>
>>> >> gnodet wrote:
>>> >> >
>>> >> > I'm not sure to understand all the problems.
>>> >> > If I had to do AOP inside a SU, I would just consider the SU as a
>>> >> spring
>>> >> > application (even if it has to contain a JBI endpoint).
>>> >> > You can put additional jars needed in the SU and you should be able
>>> to
>>> >> use
>>> >> > AOP.  You don't really need to hack the components
>>> >> > or the main configuration file.
>>> >> >
>>> >> > Or maybe you want to do AOP without configuring it explicitely ?
>>> This
>>> >> is
>>> >> > currently not possible.  I think it should be doable by extending
>>> >> > the components somehow so that they always load other spring
>>> >> configuration
>>> >> > files: for example when a component creates a spring
>>> >> > ApplicationContext when loading a xbean.xml, it could be configured
>>> to
>>> >> > always load an aop.xml configuration file that you would provide
>>> >> > and which would add all the needed definitions.
>>> >> >
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11303312
>>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > Cheers,
>>> > Guillaume Nodet
>>> > ------------------------
>>> > Principal Engineer, IONA
>>> > Blog: http://gnodet.blogspot.com/
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11305922
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> -- 
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Principal Engineer, IONA
>> Blog: http://gnodet.blogspot.com/
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11322643
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Spring AOP integration in ServiceMix

Posted by oliver kuntze <ol...@union-investment.de>.
Could it be that because of the way ServiceMix@JBoss does the classloading,
currently it is not possible to use Spring-AOP (at least AspectJ annotation
style)?

I googled the following exception I get
java.lang.AbstractMethodError:
org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.
findCandidateAdvisors()Ljava/util/List;
All the posts are dealing with classloading or lib version
incompatibilities, most of them dealing with ASM in the CGLIB jar (which is
also used be JBoss' Hibernate).

So I took a look at the POM for spring-aop.jar (Version 2.0.1, the one that
is also packaged in my ServiceMix distribution) and inluced all jars listed
in the dependency section in my servicemix-jboss-deployer-3.1-incubating.sar
and in my SU. I also tried only putting them in the
servicemix-jboss-deployer-3.1-incubating.sar and only putting them in the
SU.

The POM looks like this:
<code>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<parent>
	
<groupId>oliver.osiris.playground.sandbox.swifttransformation-service</groupId>
		<artifactId>swifttransformation-service</artifactId>
		<version>1.0</version>
	</parent>

<groupId>oliver.osiris.playground.sandbox.swifttransformation-service</groupId>
	<artifactId>swifttransformation-jsr181-su</artifactId>
	<name>Osiris :: sandbox :: swifttransformation-service ::
swifttransformation-jsr181-su :: SU</name>
	<packaging>jbi-service-unit</packaging>
	<version>1.0</version>
	<url>${site.root}//swifttransformation-service/</url>
	<dependencies>
		<dependency>
			<groupId>aopalliance</groupId>
			<artifactId>aopalliance</artifactId>
			<version>1.0</version>
		</dependency>
		<dependency>
			<groupId>aspectj</groupId>
			<artifactId>aspectjrt</artifactId>
			<version>1.5.2a</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>aspectj</groupId>
			<artifactId>aspectjweaver</artifactId>
			<version>1.5.2a</version>
		</dependency>
		<dependency>
			<groupId>cglib</groupId>
			<artifactId>cglib-nodep</artifactId>
			<version>2.1_3</version>
		</dependency>
		<dependency>
			<groupId>commons-attributes</groupId>
			<artifactId>commons-attributes-api</artifactId>
			<version>2.2</version>
		</dependency>
		<dependency>
			<groupId>commons-attributes</groupId>
			<artifactId>commons-attributes-compiler</artifactId>
			<version>2.2</version>
		</dependency>
		<dependency>
			<groupId>commons-logging</groupId>
			<artifactId>commons-logging</artifactId>
			<version>1.1</version>
		</dependency>
		<dependency>
			<groupId>commons-pool</groupId>
			<artifactId>commons-pool</artifactId>
			<version>1.3</version>
		</dependency>
		<dependency>
			<groupId>com.jamonapi</groupId>
			<artifactId>jamon</artifactId>
			<version>1.0</version>
		</dependency>
		<dependency>
			<groupId>oro</groupId>
			<artifactId>oro</artifactId>
			<version>2.0.8</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>2.0.1</version>
		</dependency>
		<dependency>
			<groupId>org.apache.servicemix</groupId>
			<artifactId>servicemix-jsr181</artifactId>
			<version>${servicemix-version}</version>
		</dependency>
		<dependency>
			<groupId>mycompany.framework</groupId>
			<artifactId>mycompany-shared</artifactId>
			<version>${myproject-version}</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.servicemix.tooling</groupId>
				<artifactId>jbi-maven-plugin</artifactId>
				<version>${servicemix-version}</version>
				<extensions>true</extensions>
				<configuration>
					<type>service-unit</type>
					<generateJbiDescriptor>false</generateJbiDescriptor>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>
</code>

Help is greatly appreciated!
It would be really sad if one could not use Spring-AOP (AspectJ style).

Has anyone ever succeeded in getting this up and running?

Thanks a lot in advance!

Cheers,

Oliver.


gnodet wrote:
> 
> Not really. Have you tried googling for the exception ?
> 
> On 6/26/07, oliver kuntze <ol...@union-investment.de> wrote:
>>
>> Perfect! Thanks a lot, Guillaume!
>>
>> When trying to deploy the advised SU I get the following exception:
>>
>> <code>
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean
>> with name 'org.springframework.aop.config.internalAutoProxyCreator':
>> Initialization of bean failed; nested exception is
>> java.lang.AbstractMethodError:
>> org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.
>> findCandidateAdvisors()Ljava/util/List;
>> </code>
>>
>> Still trying...
>>
>> Do you have any ideas???
>>
>> Thanks very much!
>>
>> Cheers,
>>
>> Oliver.
>>
>>
>>
>> gnodet wrote:
>> >
>> > On 6/26/07, oliver kuntze <ol...@union-investment.de> wrote:
>> >>
>> >>
>> >> Ok, I think I got it.
>> >>
>> >> When a SU is deployed to a ServiceMix component, the component creates
>> a
>> >> Spring application context and configures the app according to the
>> >> xbean.xml. I.e. every SU is in fact a Spring application.
>> >> That means out of the box one is able to use Spring AOP aspects per
>> SU.
>> >> If
>> >> one would like to have aspects for his/her "eai application", that is
>> for
>> >> a
>> >> whole bunch of SAs, than one should extend ServiceMix / Xbean  somehow
>> so
>> >> that a "global" xbean config containing the aspects is added to the
>> >> ApplicationContext when the XBean SpringLoader has loaded the
>> xbean.xml.
>> >> Correct?
>> >
>> >
>> > Exactly !
>> >
>> > I tried to deploy a SU with an aspect but received the following
>> > exception:
>> >> BeanDefinitionStoreException: Unrecognized xbean namespace mapping:
>> >> http://www.springframework.org/schema/aop
>> >>
>> >> My xbean.xml looks like this:
>> >> <code>
>> >> <?xml version="1.0" encoding="UTF-8"?>
>> >> <beans xmlns="http://www.springframework.org/schema/beans"
>> >>         xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
>> >>        
>> xmlns:swifttransformation="http://mycompany/swifttransformation"
>> >>         xmlns:aop="http://www.springframework.org/schema/aop">
>> >>
>> >>         <aop:aspectj-autoproxy/>
>> >>         <bean class="
>> >> mycompany.playground.swifttransformation.MonitoringAspect"
>> >> id="swiftTransformationMonitoringAspect"/>
>> >>
>> >>         <jsr181:endpoint endpoint="swift2xml"
>> >>                 service="swifttransformation:iso15022-transformation"
>> >>
>> >> serviceInterface="
>> >> mycompany.playground.swifttransformation.SwiftToXmlTransformer"
>> >>                 typeMapping="xmlbeans">
>> >>                 <jsr181:pojo>
>> >>                         <bean
>> >>
>> class="mycompany.playground.swifttransformation.SwiftToXmlTransformerImpl"
>> >> />
>> >>                 </jsr181:pojo>
>> >>         </jsr181:endpoint>
>> >> </beans>
>> >> </code>
>> >>
>> >> The spring.handler file in the spring-beans-2.0.1.jar of my ServiceMix
>> >> distribution contains the following line:
>> >> http\://www.springframework.org/schema/aop=
>> >> org.springframework.aop.config.AopNamespaceHandler
>> >>
>> >> So everything seems to be in place.
>> >>
>> >> Any ideas why I get the exception?
>> >
>> >
>> > I don't know why the handler is defined in spring-beans while the
>> > associated
>> > class is not.
>> > You should put spring-aop in the SU by adding it to your pom.xml.
>> > It should do the trick.
>> >
>> > Thanks a lot for helping a newbie out!
>> >>
>> >> Cheers,
>> >>
>> >> Oliver.
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > I'm not sure to understand all the problems.
>> >> > If I had to do AOP inside a SU, I would just consider the SU as a
>> >> spring
>> >> > application (even if it has to contain a JBI endpoint).
>> >> > You can put additional jars needed in the SU and you should be able
>> to
>> >> use
>> >> > AOP.  You don't really need to hack the components
>> >> > or the main configuration file.
>> >> >
>> >> > Or maybe you want to do AOP without configuring it explicitely ?
>> This
>> >> is
>> >> > currently not possible.  I think it should be doable by extending
>> >> > the components somehow so that they always load other spring
>> >> configuration
>> >> > files: for example when a component creates a spring
>> >> > ApplicationContext when loading a xbean.xml, it could be configured
>> to
>> >> > always load an aop.xml configuration file that you would provide
>> >> > and which would add all the needed definitions.
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11303312
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Principal Engineer, IONA
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11305922
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Principal Engineer, IONA
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11321095
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Spring AOP integration in ServiceMix

Posted by Guillaume Nodet <gn...@gmail.com>.
Not really. Have you tried googling for the exception ?

On 6/26/07, oliver kuntze <ol...@union-investment.de> wrote:
>
> Perfect! Thanks a lot, Guillaume!
>
> When trying to deploy the advised SU I get the following exception:
>
> <code>
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'org.springframework.aop.config.internalAutoProxyCreator':
> Initialization of bean failed; nested exception is
> java.lang.AbstractMethodError:
> org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.
> findCandidateAdvisors()Ljava/util/List;
> </code>
>
> The POM I am using is:
>
> <code>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>     <modelVersion>4.0.0</modelVersion>
>     <parent>
>
> <groupId>oliver.playground.sandbox.swifttransformation-service</groupId>
>         <artifactId>swifttransformation-service</artifactId>
>         <version>1.0</version>
>     </parent>
>     <groupId>oliver.playground.sandbox.swifttransformation-service</groupId>
>     <artifactId>swifttransformation-jsr181-su</artifactId>
>     <name>Oliver :: sandbox :: swifttransformation-service ::
> swifttransformation-jsr181-su :: SU</name>
>     <packaging>jbi-service-unit</packaging>
>     <version>1.0</version>
>     <url>${site.root}//swifttransformation-service/</url>
>     <dependencies>
>         <dependency>
>                         <groupId>aspectj</groupId>
>                         <artifactId>aspectjweaver</artifactId>
>                         <version>1.5.3</version>
>                 </dependency>
>         <dependency>
>                         <groupId>aspectj</groupId>
>                         <artifactId>aspectjrt</artifactId>
>                         <version>1.5.3</version>
>                 </dependency>
>                 <dependency>
>                 <groupId>org.springframework</groupId>
>                 <artifactId>spring-aop</artifactId>
>                         <version>2.0.1</version>
>                 </dependency>
>         <dependency>
>             <groupId>org.apache.servicemix</groupId>
>             <artifactId>servicemix-jsr181</artifactId>
>             <version>${servicemix-version}</version>
>         </dependency>
>         <dependency>
>             <groupId>mycompany.framework</groupId>
>             <artifactId>mycompany-shared</artifactId>
>             <version>${myproject-version}</version>
>             <scope>provided</scope>
>         </dependency>
>     </dependencies>
>     <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.servicemix.tooling</groupId>
>                 <artifactId>jbi-maven-plugin</artifactId>
>                 <version>${servicemix-version}</version>
>                 <extensions>true</extensions>
>                 <configuration>
>                     <type>service-unit</type>
>                     <generateJbiDescriptor>false</generateJbiDescriptor>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
> </project>
> </code>
>
> Still trying...
>
> Do you have any ideas???
>
> Thanks very much!
>
> Cheers,
>
> Oliver.
>
>
>
> gnodet wrote:
> >
> > On 6/26/07, oliver kuntze <ol...@union-investment.de> wrote:
> >>
> >>
> >> Ok, I think I got it.
> >>
> >> When a SU is deployed to a ServiceMix component, the component creates a
> >> Spring application context and configures the app according to the
> >> xbean.xml. I.e. every SU is in fact a Spring application.
> >> That means out of the box one is able to use Spring AOP aspects per SU.
> >> If
> >> one would like to have aspects for his/her "eai application", that is for
> >> a
> >> whole bunch of SAs, than one should extend ServiceMix / Xbean  somehow so
> >> that a "global" xbean config containing the aspects is added to the
> >> ApplicationContext when the XBean SpringLoader has loaded the xbean.xml.
> >> Correct?
> >
> >
> > Exactly !
> >
> > I tried to deploy a SU with an aspect but received the following
> > exception:
> >> BeanDefinitionStoreException: Unrecognized xbean namespace mapping:
> >> http://www.springframework.org/schema/aop
> >>
> >> My xbean.xml looks like this:
> >> <code>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <beans xmlns="http://www.springframework.org/schema/beans"
> >>         xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
> >>         xmlns:swifttransformation="http://mycompany/swifttransformation"
> >>         xmlns:aop="http://www.springframework.org/schema/aop">
> >>
> >>         <aop:aspectj-autoproxy/>
> >>         <bean class="
> >> mycompany.playground.swifttransformation.MonitoringAspect"
> >> id="swiftTransformationMonitoringAspect"/>
> >>
> >>         <jsr181:endpoint endpoint="swift2xml"
> >>                 service="swifttransformation:iso15022-transformation"
> >>
> >> serviceInterface="
> >> mycompany.playground.swifttransformation.SwiftToXmlTransformer"
> >>                 typeMapping="xmlbeans">
> >>                 <jsr181:pojo>
> >>                         <bean
> >> class="mycompany.playground.swifttransformation.SwiftToXmlTransformerImpl"
> >> />
> >>                 </jsr181:pojo>
> >>         </jsr181:endpoint>
> >> </beans>
> >> </code>
> >>
> >> The spring.handler file in the spring-beans-2.0.1.jar of my ServiceMix
> >> distribution contains the following line:
> >> http\://www.springframework.org/schema/aop=
> >> org.springframework.aop.config.AopNamespaceHandler
> >>
> >> So everything seems to be in place.
> >>
> >> Any ideas why I get the exception?
> >
> >
> > I don't know why the handler is defined in spring-beans while the
> > associated
> > class is not.
> > You should put spring-aop in the SU by adding it to your pom.xml.
> > It should do the trick.
> >
> > Thanks a lot for helping a newbie out!
> >>
> >> Cheers,
> >>
> >> Oliver.
> >>
> >>
> >> gnodet wrote:
> >> >
> >> > I'm not sure to understand all the problems.
> >> > If I had to do AOP inside a SU, I would just consider the SU as a
> >> spring
> >> > application (even if it has to contain a JBI endpoint).
> >> > You can put additional jars needed in the SU and you should be able to
> >> use
> >> > AOP.  You don't really need to hack the components
> >> > or the main configuration file.
> >> >
> >> > Or maybe you want to do AOP without configuring it explicitely ? This
> >> is
> >> > currently not possible.  I think it should be doable by extending
> >> > the components somehow so that they always load other spring
> >> configuration
> >> > files: for example when a component creates a spring
> >> > ApplicationContext when loading a xbean.xml, it could be configured to
> >> > always load an aop.xml configuration file that you would provide
> >> > and which would add all the needed definitions.
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11303312
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Principal Engineer, IONA
> > Blog: http://gnodet.blogspot.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11305922
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/

Re: Spring AOP integration in ServiceMix

Posted by oliver kuntze <ol...@union-investment.de>.
Perfect! Thanks a lot, Guillaume!

When trying to deploy the advised SU I get the following exception:

<code>
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.springframework.aop.config.internalAutoProxyCreator':
Initialization of bean failed; nested exception is
java.lang.AbstractMethodError:
org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.
findCandidateAdvisors()Ljava/util/List;
</code>

The POM I am using is:

<code>
<?xml version="1.0" encoding="ISO-8859-1"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
       
<groupId>oliver.playground.sandbox.swifttransformation-service</groupId>
        <artifactId>swifttransformation-service</artifactId>
        <version>1.0</version>
    </parent>
    <groupId>oliver.playground.sandbox.swifttransformation-service</groupId>
    <artifactId>swifttransformation-jsr181-su</artifactId>
    <name>Oliver :: sandbox :: swifttransformation-service ::
swifttransformation-jsr181-su :: SU</name>
    <packaging>jbi-service-unit</packaging>
    <version>1.0</version>
    <url>${site.root}//swifttransformation-service/</url>
    <dependencies>
    	<dependency>
			<groupId>aspectj</groupId>
			<artifactId>aspectjweaver</artifactId>
			<version>1.5.3</version>
		</dependency>
    	<dependency>
			<groupId>aspectj</groupId>
			<artifactId>aspectjrt</artifactId>
			<version>1.5.3</version>
		</dependency>
		<dependency>
    		<groupId>org.springframework</groupId>
    		<artifactId>spring-aop</artifactId>
   			<version>2.0.1</version>
		</dependency>
        <dependency>
            <groupId>org.apache.servicemix</groupId>
            <artifactId>servicemix-jsr181</artifactId>
            <version>${servicemix-version}</version>
        </dependency>
        <dependency>
            <groupId>mycompany.framework</groupId>
            <artifactId>mycompany-shared</artifactId>
            <version>${myproject-version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.servicemix.tooling</groupId>
                <artifactId>jbi-maven-plugin</artifactId>
                <version>${servicemix-version}</version>
                <extensions>true</extensions>
                <configuration>
                    <type>service-unit</type>
                    <generateJbiDescriptor>false</generateJbiDescriptor>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
</code>

Still trying...

Do you have any ideas???

Thanks very much!

Cheers,

Oliver.



gnodet wrote:
> 
> On 6/26/07, oliver kuntze <ol...@union-investment.de> wrote:
>>
>>
>> Ok, I think I got it.
>>
>> When a SU is deployed to a ServiceMix component, the component creates a
>> Spring application context and configures the app according to the
>> xbean.xml. I.e. every SU is in fact a Spring application.
>> That means out of the box one is able to use Spring AOP aspects per SU.
>> If
>> one would like to have aspects for his/her "eai application", that is for
>> a
>> whole bunch of SAs, than one should extend ServiceMix / Xbean  somehow so
>> that a "global" xbean config containing the aspects is added to the
>> ApplicationContext when the XBean SpringLoader has loaded the xbean.xml.
>> Correct?
> 
> 
> Exactly !
> 
> I tried to deploy a SU with an aspect but received the following
> exception:
>> BeanDefinitionStoreException: Unrecognized xbean namespace mapping:
>> http://www.springframework.org/schema/aop
>>
>> My xbean.xml looks like this:
>> <code>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>>         xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
>>         xmlns:swifttransformation="http://mycompany/swifttransformation"
>>         xmlns:aop="http://www.springframework.org/schema/aop">
>>
>>         <aop:aspectj-autoproxy/>
>>         <bean class="
>> mycompany.playground.swifttransformation.MonitoringAspect"
>> id="swiftTransformationMonitoringAspect"/>
>>
>>         <jsr181:endpoint endpoint="swift2xml"
>>                 service="swifttransformation:iso15022-transformation"
>>
>> serviceInterface="
>> mycompany.playground.swifttransformation.SwiftToXmlTransformer"
>>                 typeMapping="xmlbeans">
>>                 <jsr181:pojo>
>>                         <bean
>> class="mycompany.playground.swifttransformation.SwiftToXmlTransformerImpl"
>> />
>>                 </jsr181:pojo>
>>         </jsr181:endpoint>
>> </beans>
>> </code>
>>
>> The spring.handler file in the spring-beans-2.0.1.jar of my ServiceMix
>> distribution contains the following line:
>> http\://www.springframework.org/schema/aop=
>> org.springframework.aop.config.AopNamespaceHandler
>>
>> So everything seems to be in place.
>>
>> Any ideas why I get the exception?
> 
> 
> I don't know why the handler is defined in spring-beans while the
> associated
> class is not.
> You should put spring-aop in the SU by adding it to your pom.xml.
> It should do the trick.
> 
> Thanks a lot for helping a newbie out!
>>
>> Cheers,
>>
>> Oliver.
>>
>>
>> gnodet wrote:
>> >
>> > I'm not sure to understand all the problems.
>> > If I had to do AOP inside a SU, I would just consider the SU as a
>> spring
>> > application (even if it has to contain a JBI endpoint).
>> > You can put additional jars needed in the SU and you should be able to
>> use
>> > AOP.  You don't really need to hack the components
>> > or the main configuration file.
>> >
>> > Or maybe you want to do AOP without configuring it explicitely ? This
>> is
>> > currently not possible.  I think it should be doable by extending
>> > the components somehow so that they always load other spring
>> configuration
>> > files: for example when a component creates a spring
>> > ApplicationContext when loading a xbean.xml, it could be configured to
>> > always load an aop.xml configuration file that you would provide
>> > and which would add all the needed definitions.
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11303312
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Principal Engineer, IONA
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11305922
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Spring AOP integration in ServiceMix

Posted by Guillaume Nodet <gn...@gmail.com>.
On 6/26/07, oliver kuntze <ol...@union-investment.de> wrote:
>
>
> Ok, I think I got it.
>
> When a SU is deployed to a ServiceMix component, the component creates a
> Spring application context and configures the app according to the
> xbean.xml. I.e. every SU is in fact a Spring application.
> That means out of the box one is able to use Spring AOP aspects per SU. If
> one would like to have aspects for his/her "eai application", that is for
> a
> whole bunch of SAs, than one should extend ServiceMix / Xbean  somehow so
> that a "global" xbean config containing the aspects is added to the
> ApplicationContext when the XBean SpringLoader has loaded the xbean.xml.
> Correct?


Exactly !

I tried to deploy a SU with an aspect but received the following exception:
> BeanDefinitionStoreException: Unrecognized xbean namespace mapping:
> http://www.springframework.org/schema/aop
>
> My xbean.xml looks like this:
> <code>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
>         xmlns:swifttransformation="http://mycompany/swifttransformation"
>         xmlns:aop="http://www.springframework.org/schema/aop">
>
>         <aop:aspectj-autoproxy/>
>         <bean class="
> mycompany.playground.swifttransformation.MonitoringAspect"
> id="swiftTransformationMonitoringAspect"/>
>
>         <jsr181:endpoint endpoint="swift2xml"
>                 service="swifttransformation:iso15022-transformation"
>
> serviceInterface="
> mycompany.playground.swifttransformation.SwiftToXmlTransformer"
>                 typeMapping="xmlbeans">
>                 <jsr181:pojo>
>                         <bean
> class="mycompany.playground.swifttransformation.SwiftToXmlTransformerImpl"
> />
>                 </jsr181:pojo>
>         </jsr181:endpoint>
> </beans>
> </code>
>
> The spring.handler file in the spring-beans-2.0.1.jar of my ServiceMix
> distribution contains the following line:
> http\://www.springframework.org/schema/aop=
> org.springframework.aop.config.AopNamespaceHandler
>
> So everything seems to be in place.
>
> Any ideas why I get the exception?


I don't know why the handler is defined in spring-beans while the associated
class is not.
You should put spring-aop in the SU by adding it to your pom.xml.
It should do the trick.

Thanks a lot for helping a newbie out!
>
> Cheers,
>
> Oliver.
>
>
> gnodet wrote:
> >
> > I'm not sure to understand all the problems.
> > If I had to do AOP inside a SU, I would just consider the SU as a spring
> > application (even if it has to contain a JBI endpoint).
> > You can put additional jars needed in the SU and you should be able to
> use
> > AOP.  You don't really need to hack the components
> > or the main configuration file.
> >
> > Or maybe you want to do AOP without configuring it explicitely ? This is
> > currently not possible.  I think it should be doable by extending
> > the components somehow so that they always load other spring
> configuration
> > files: for example when a component creates a spring
> > ApplicationContext when loading a xbean.xml, it could be configured to
> > always load an aop.xml configuration file that you would provide
> > and which would add all the needed definitions.
> >
>
> --
> View this message in context:
> http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11303312
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/

Re: Spring AOP integration in ServiceMix

Posted by oliver kuntze <ol...@union-investment.de>.
Ok, I think I got it.

When a SU is deployed to a ServiceMix component, the component creates a
Spring application context and configures the app according to the
xbean.xml. I.e. every SU is in fact a Spring application.
That means out of the box one is able to use Spring AOP aspects per SU. If
one would like to have aspects for his/her "eai application", that is for a
whole bunch of SAs, than one should extend ServiceMix / Xbean  somehow so
that a "global" xbean config containing the aspects is added to the
ApplicationContext when the XBean SpringLoader has loaded the xbean.xml.
Correct?

I tried to deploy a SU with an aspect but received the following exception:
BeanDefinitionStoreException: Unrecognized xbean namespace mapping:
http://www.springframework.org/schema/aop

My xbean.xml looks like this:
<code>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
	xmlns:swifttransformation="http://mycompany/swifttransformation"
	xmlns:aop="http://www.springframework.org/schema/aop">
	
	<aop:aspectj-autoproxy/>
	<bean class="mycompany.playground.swifttransformation.MonitoringAspect"
id="swiftTransformationMonitoringAspect"/>
	
	<jsr181:endpoint endpoint="swift2xml"
		service="swifttransformation:iso15022-transformation"
	
serviceInterface="mycompany.playground.swifttransformation.SwiftToXmlTransformer"
		typeMapping="xmlbeans">
		<jsr181:pojo>
			<bean
class="mycompany.playground.swifttransformation.SwiftToXmlTransformerImpl"
/>
		</jsr181:pojo>
	</jsr181:endpoint>
</beans>
</code>

The spring.handler file in the spring-beans-2.0.1.jar of my ServiceMix
distribution contains the following line:
http\://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler

So everything seems to be in place.

Any ideas why I get the exception?

Thanks a lot for helping a newbie out!

Cheers,

Oliver.


gnodet wrote:
> 
> I'm not sure to understand all the problems.
> If I had to do AOP inside a SU, I would just consider the SU as a spring
> application (even if it has to contain a JBI endpoint).
> You can put additional jars needed in the SU and you should be able to use
> AOP.  You don't really need to hack the components
> or the main configuration file.
> 
> Or maybe you want to do AOP without configuring it explicitely ? This is
> currently not possible.  I think it should be doable by extending
> the components somehow so that they always load other spring configuration
> files: for example when a component creates a spring
> ApplicationContext when loading a xbean.xml, it could be configured to
> always load an aop.xml configuration file that you would provide
> and which would add all the needed definitions.
> 

-- 
View this message in context: http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11303312
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Spring AOP integration in ServiceMix

Posted by Guillaume Nodet <gn...@gmail.com>.
I'm not sure to understand all the problems.
If I had to do AOP inside a SU, I would just consider the SU as a spring
application (even if it has to contain a JBI endpoint).
You can put additional jars needed in the SU and you should be able to use
AOP.  You don't really need to hack the components
or the main configuration file.

Or maybe you want to do AOP without configuring it explicitely ? This is
currently not possible.  I think it should be doable by extending
the components somehow so that they always load other spring configuration
files: for example when a component creates a spring
ApplicationContext when loading a xbean.xml, it could be configured to
always load an aop.xml configuration file that you would provide
and which would add all the needed definitions.

On 6/26/07, Kuntze, Oliver (EXT) <Ol...@union-investment.de> wrote:
>
> Thanks for the prompt answer, Bruce!
>
> I think I am lacking some understanding of the basics here.
>
> I am trying to advise some classes that belong to my SUs. Since my JBI
> components are managed by ServiceMix and ServiceMix uses the Spring
> container, I thought that if I am in a ServiceMix context I can only use
> Spring AOP by somehow telling ServiceMix "Hey, here is my aspect and her is
> my Spring xbean config. Now, please pass this info to the Spring container
> and let Spring handle the AOP stuff.".
> That is also the reason why I am building a shared library. I thought, if
> I have to pass aspects to the Spring container which in turn is "under the
> hood" of ServiceMix, I have to use ServiceMix "technology". I thought
> ServiceMix would then "see" "Ah, this is Spring AOP stuff. I have to pass
> this to the Spring container.". Since SAs/SUs and shared libs are the
> deployable ServiceMix artefacts I know, I chose a shared lib to pass my AOP
> stuff to ServiceMix.
>
> How should one use AOP in a ServiceMix environment?
> We need runtime weaving. Loadtime and compiletime weaving are no options.
> So I thought, let's use Spring AOP if ServiceMix uses Spring. As I can see,
> the latest ServiceMix uses Spring 2 with all its nice AOP improvements.
>
> Should I directly use the Spring container used by ServiceMix? I.e. is my
> aproach to "go through the ServiceMix layer" wrong? Are the ServiceMix
> components managed by the Spring container so that instead of using the
> "going through the ServiceMix layer" I should directly configure the Spring
> container used by ServieMix?
>
> Questions over questions. ;-)
>
> Again, thanks a lot in advance!
>
> Cheers,
>
> Oliver.
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Bruce Snyder [mailto:bruce.snyder@gmail.com]
> Gesendet: Dienstag, 26. Juni 2007 07:01
> An: servicemix-users@geronimo.apache.org
> Betreff: Re: Spring AOP integration in ServiceMix
>
> On 6/25/07, okuntze <ol...@union-investment.de> wrote:
> >
> > Hi,
> >
> > I'm trying to use Spring AOP in my ServiceMix runtime.
> >
> > Since I'm apparently doing something basic terribly wrong, it would be
> > great if you could help me out with some info.
> >
> > I have an aspect like this:
> >
> > <code>
> > package de.mycompany.myproject;
> >
> > import org.aspectj.lang.annotation.Aspect;
> > import org.aspectj.lang.annotation.Pointcut;
> >
> > @Aspect
> > public class MonitoringAspect {
> >         @Pointcut("execution(* de.mycompany.myproject..*.*(..)))")
> >         public Object doSomething() {
> >                 throw new RuntimeException("Im doSomething Advice!!!");
> >         }
> > }
> > </code>
> >
> > Furthermore I have a corresponding xbean file:
> >
> > <code>
> > <?xml version="1.0" encoding="UTF-8"?> <beans
> > xmlns="http://www.springframework.org/schema/beans"
> >         xmlns:aop="http://www.springframework.org/schema/aop"
> >         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
> >         <aop:aspectj-autoproxy/>
> >         <bean class="de.mycompany.myproject.MonitoringAspect"
> > id="swiftTransformationMonitoringAspect"/>
> > </beans>
> > </code>
> >
> > And finally I have a POM like this:
> >
> > <code>
> > <?xml version="1.0" encoding="UTF-8"?> <project
> > xmlns="http://maven.apache.org/POM/4.0.0"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> >         <modelVersion>4.0.0</modelVersion>
> >         <parent>
> >                 <groupId>oliver.osiris.playground.sandbox</groupId>
> >                 <artifactId>sandbox</artifactId>
> >                 <version>1.0</version>
> >         </parent>
> >
> > <groupId>oliver.osiris.playground.sandbox.swifttransformation-monitoring
> </groupId>
> >         <artifactId>swifttransformation-aspect</artifactId>
> >         <name>Osiris :: sandbox :: swifttransformation-monitoring ::
> > swifttransformation-aspect</name>
> >         <packaging>jbi-shared-library</packaging>
> >         <version>1.0</version>
> >         <url>${site.root}//sandbox/</url>
> >         <dependencies>
> >                 <dependency>
> >                         <groupId>aspectj</groupId>
> >                         <artifactId>aspectjrt</artifactId>
> >                         <version>1.5.3</version>
> >                 </dependency>
> >         </dependencies>
> >         <build>
> >                 <plugins>
> >                         <plugin>
> >                                 <groupId>org.apache.servicemix.tooling
> </groupId>
> >
> <artifactId>jbi-maven-plugin</artifactId>
> >                                 <version>${servicemix-version}</version>
> >                                 <extensions>true</extensions>
> >                         </plugin>
> >                 </plugins>
> >         </build>
> > </project>
> > </code>
> >
> > So what I am doing is: Using the POM to build a ServiceMix shared
> > library containing the aspect class and the Spring xbean configuration.
> >
> > Unfortunately the advice ist never executed.
> >
> > What am I doing wrong?
>
> Are the beans you're trying to advise instantiated explicitly by Spring?
> Also, why are you building a shared library?
>
> Bruce
> --
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache Geronimo - http://geronimo.apache.org/ Apache ActiveMQ -
> http://activemq.org/ Apache ServiceMix - http://servicemix.org/ Castor -
> http://castor.org/
>



-- 
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/

AW: Spring AOP integration in ServiceMix

Posted by "Kuntze, Oliver (EXT)" <Ol...@union-investment.de>.
Thanks for the prompt answer, Bruce!

I think I am lacking some understanding of the basics here.

I am trying to advise some classes that belong to my SUs. Since my JBI components are managed by ServiceMix and ServiceMix uses the Spring container, I thought that if I am in a ServiceMix context I can only use Spring AOP by somehow telling ServiceMix "Hey, here is my aspect and her is my Spring xbean config. Now, please pass this info to the Spring container and let Spring handle the AOP stuff.".
That is also the reason why I am building a shared library. I thought, if I have to pass aspects to the Spring container which in turn is "under the hood" of ServiceMix, I have to use ServiceMix "technology". I thought ServiceMix would then "see" "Ah, this is Spring AOP stuff. I have to pass this to the Spring container.". Since SAs/SUs and shared libs are the deployable ServiceMix artefacts I know, I chose a shared lib to pass my AOP stuff to ServiceMix.

How should one use AOP in a ServiceMix environment?
We need runtime weaving. Loadtime and compiletime weaving are no options. So I thought, let's use Spring AOP if ServiceMix uses Spring. As I can see, the latest ServiceMix uses Spring 2 with all its nice AOP improvements.

Should I directly use the Spring container used by ServiceMix? I.e. is my aproach to "go through the ServiceMix layer" wrong? Are the ServiceMix components managed by the Spring container so that instead of using the "going through the ServiceMix layer" I should directly configure the Spring container used by ServieMix?

Questions over questions. ;-)

Again, thanks a lot in advance!

Cheers,

Oliver.




-----Ursprüngliche Nachricht-----
Von: Bruce Snyder [mailto:bruce.snyder@gmail.com] 
Gesendet: Dienstag, 26. Juni 2007 07:01
An: servicemix-users@geronimo.apache.org
Betreff: Re: Spring AOP integration in ServiceMix

On 6/25/07, okuntze <ol...@union-investment.de> wrote:
>
> Hi,
>
> I'm trying to use Spring AOP in my ServiceMix runtime.
>
> Since I'm apparently doing something basic terribly wrong, it would be 
> great if you could help me out with some info.
>
> I have an aspect like this:
>
> <code>
> package de.mycompany.myproject;
>
> import org.aspectj.lang.annotation.Aspect;
> import org.aspectj.lang.annotation.Pointcut;
>
> @Aspect
> public class MonitoringAspect {
>         @Pointcut("execution(* de.mycompany.myproject..*.*(..)))")
>         public Object doSomething() {
>                 throw new RuntimeException("Im doSomething Advice!!!");
>         }
> }
> </code>
>
> Furthermore I have a corresponding xbean file:
>
> <code>
> <?xml version="1.0" encoding="UTF-8"?> <beans 
> xmlns="http://www.springframework.org/schema/beans"
>         xmlns:aop="http://www.springframework.org/schema/aop"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
>         <aop:aspectj-autoproxy/>
>         <bean class="de.mycompany.myproject.MonitoringAspect"
> id="swiftTransformationMonitoringAspect"/>
> </beans>
> </code>
>
> And finally I have a POM like this:
>
> <code>
> <?xml version="1.0" encoding="UTF-8"?> <project 
> xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>         <modelVersion>4.0.0</modelVersion>
>         <parent>
>                 <groupId>oliver.osiris.playground.sandbox</groupId>
>                 <artifactId>sandbox</artifactId>
>                 <version>1.0</version>
>         </parent>
>
> <groupId>oliver.osiris.playground.sandbox.swifttransformation-monitoring</groupId>
>         <artifactId>swifttransformation-aspect</artifactId>
>         <name>Osiris :: sandbox :: swifttransformation-monitoring ::
> swifttransformation-aspect</name>
>         <packaging>jbi-shared-library</packaging>
>         <version>1.0</version>
>         <url>${site.root}//sandbox/</url>
>         <dependencies>
>                 <dependency>
>                         <groupId>aspectj</groupId>
>                         <artifactId>aspectjrt</artifactId>
>                         <version>1.5.3</version>
>                 </dependency>
>         </dependencies>
>         <build>
>                 <plugins>
>                         <plugin>
>                                 <groupId>org.apache.servicemix.tooling</groupId>
>                                 <artifactId>jbi-maven-plugin</artifactId>
>                                 <version>${servicemix-version}</version>
>                                 <extensions>true</extensions>
>                         </plugin>
>                 </plugins>
>         </build>
> </project>
> </code>
>
> So what I am doing is: Using the POM to build a ServiceMix shared 
> library containing the aspect class and the Spring xbean configuration.
>
> Unfortunately the advice ist never executed.
>
> What am I doing wrong?

Are the beans you're trying to advise instantiated explicitly by Spring? Also, why are you building a shared library?

Bruce
--
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/ Apache ActiveMQ - http://activemq.org/ Apache ServiceMix - http://servicemix.org/ Castor - http://castor.org/

Re: Spring AOP integration in ServiceMix

Posted by Bruce Snyder <br...@gmail.com>.
On 6/25/07, okuntze <ol...@union-investment.de> wrote:
>
> Hi,
>
> I'm trying to use Spring AOP in my ServiceMix runtime.
>
> Since I'm apparently doing something basic terribly wrong, it would be great
> if you could help me out with some info.
>
> I have an aspect like this:
>
> <code>
> package de.mycompany.myproject;
>
> import org.aspectj.lang.annotation.Aspect;
> import org.aspectj.lang.annotation.Pointcut;
>
> @Aspect
> public class MonitoringAspect {
>         @Pointcut("execution(* de.mycompany.myproject..*.*(..)))")
>         public Object doSomething() {
>                 throw new RuntimeException("Im doSomething Advice!!!");
>         }
> }
> </code>
>
> Furthermore I have a corresponding xbean file:
>
> <code>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:aop="http://www.springframework.org/schema/aop"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
>         <aop:aspectj-autoproxy/>
>         <bean class="de.mycompany.myproject.MonitoringAspect"
> id="swiftTransformationMonitoringAspect"/>
> </beans>
> </code>
>
> And finally I have a POM like this:
>
> <code>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>         <modelVersion>4.0.0</modelVersion>
>         <parent>
>                 <groupId>oliver.osiris.playground.sandbox</groupId>
>                 <artifactId>sandbox</artifactId>
>                 <version>1.0</version>
>         </parent>
>
> <groupId>oliver.osiris.playground.sandbox.swifttransformation-monitoring</groupId>
>         <artifactId>swifttransformation-aspect</artifactId>
>         <name>Osiris :: sandbox :: swifttransformation-monitoring ::
> swifttransformation-aspect</name>
>         <packaging>jbi-shared-library</packaging>
>         <version>1.0</version>
>         <url>${site.root}//sandbox/</url>
>         <dependencies>
>                 <dependency>
>                         <groupId>aspectj</groupId>
>                         <artifactId>aspectjrt</artifactId>
>                         <version>1.5.3</version>
>                 </dependency>
>         </dependencies>
>         <build>
>                 <plugins>
>                         <plugin>
>                                 <groupId>org.apache.servicemix.tooling</groupId>
>                                 <artifactId>jbi-maven-plugin</artifactId>
>                                 <version>${servicemix-version}</version>
>                                 <extensions>true</extensions>
>                         </plugin>
>                 </plugins>
>         </build>
> </project>
> </code>
>
> So what I am doing is: Using the POM to build a ServiceMix shared library
> containing the aspect class and the Spring xbean configuration.
>
> Unfortunately the advice ist never executed.
>
> What am I doing wrong?

Are the beans you're trying to advise instantiated explicitly by
Spring? Also, why are you building a shared library?

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Castor - http://castor.org/