Wednesday 11 April 2012

Jersey 1.8 and Spring 3.0 Integration Problem

When I am trying to integrate Jersey 1.8 with Spring 3.0.5. The integration use to fail with below exception
 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.annotation.internalAsyncAnnotationProcessor': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/interceptor/AsyncExecutionInterceptor

java.lang.ClassNotFoundException: org.springframework.aop.interceptor.AsyncExecutionInterceptor
 
Reason: The reason for this problem is. Jersey spring integration library "jersey-spring" is downloading older version of aop "spring-aop-2.5.6.SEC03.jar". If you exclude it. The problem should be solved.
Solution: Update the pom.xml to exclude the dependency "spring-aop"

  org.springframework
  spring-aop


Now Dependency section should look like.

   com.sun.jersey.contribs
   jersey-spring
   1.8
   
    
     org.springframework
     spring
    
    
     org.springframework
     spring-core
    
    
     org.springframework
     spring-web
    
    
     org.springframework
     spring-beans
    
    
     org.springframework
     spring-context
    
    
     org.springframework
     spring-aop
     
   
  

2 comments:

  1. Please educate me...
    I wonder what would be the convenience of the referred integration.

    Spring framework supports RESTful be its own.

    Thank you
    jD @ http://pragmatikroo.blogspot.com

    ReplyDelete
    Replies
    1. Hi,

      We want to expose our REST Services in OData(http://www.odata.org/) format. This make our REST services easily integrate with other applications that follow OData Convention.

      The OData4j library that we are using uses JAX-RS part of Jersey and we need entire infrastructure controlled by Spring.

      OData->REST (JAX-RS)->Jersey->Spring.


      If you don’t need any additional flavors. You can directly use REST api provided by Spring.

      Best Regards,
      lac

      Delete