Announcement Announcement Module
Collapse
No announcement yet.
Spring AOP not working in ServiceMix@JBoss Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring AOP not working in ServiceMix@JBoss

    Hi,

    I am trying to use Spring-AOP in my ServiceMix environment, which is deployed to a JBoss server.

    I've tried to use <aop:aspectj-autoproxy/> style AOP as well as <aop:config> style AOP.

    With both approaches I'm running into the same kind of problem, receiving the following exceptions:

    Spring-AOP ApectJ style:
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyC reator': Initialization of bean failed; nested exception is java.lang.AbstractMethodError: org.springframework.aop.aspectj.autoproxy.
    AspectJAwareAdvisorAutoProxyCreator.findCandidateA dvisors()Ljava/util/List;
    at org.springframework.beans.factory.support.
    AbstractAutowireCapableBeanFactory.
    createBean(AbstractAutowireCapableBeanFactory.java :443)

    Sprinf-AOP XML style:
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyC reator': Initialization of bean failed; nested exception is java.lang.AbstractMethodError
    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.internalAutoProxyC reator'.
    Why? No clue.

    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 Service Unit. 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.swifttra nsformation-service</groupId>
    <artifactId>swifttransformation-service</artifactId>
    <version>1.0</version>
    </parent>
    <groupId>oliver.osiris.playground.sandbox.swifttra nsformation-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>

    Any idea what I am doing wrong?
    Some classloading problem?

    Thanks a lot in advance!

    Cheers,

    Oliver.

  • #2
    Quick update...

    As expected 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.

    Comment

    Working...
    X