Results 1 to 5 of 5

Thread: jersey-spring integration problems

  1. #1
    Join Date
    Jan 2011
    Posts
    8

    Exclamation jersey-spring integration problems

    Hello dear members,

    It's my first post in the spring community as I just started to use it in a fresh new project.

    I'm interesting to integrate jersey dependencies to build restful web services in the greenhouse project and I'm in front of a strange problem:
    When I try to insert maven dependency, like this:

    <!-- Jersey -->
    <dependency>
    <groupId>com.sun.jersey.contribs</groupId>
    <artifactId>jersey-spring</artifactId>
    <version>1.5-ea09</version>
    </dependency>

    in the pom.xml . Then nothing compile anymore!

    I'm following the tutorial here that explain Spring & Jersey integration:
    http://marciogarcia.com/?p=151

    Could somebody try to help me please ?

    Thank you and happy new year ! ;-)

  2. #2
    Join Date
    Dec 2006
    Posts
    12

    Default Repository for Jersey

    Have you included the repository in your pom.xml?

    <repository>
    <id>maven2-repository.dev.java.net</id>
    <name>Java.net Repository for maven</name>
    <url>http://download.java.net/maven/2/</url>
    </repository>

    Gary

  3. #3
    Join Date
    Jan 2011
    Posts
    8

    Thumbs up pom.xml ok

    Thank you for you reply garyj,

    but the repo java-dev was already defined in the pom.

    What is strange is that, I just checkout the master repo of greenhouse, then just add the jersey-spring dependency (without editing any files) and nothing compile anymore!

    and internal dependencies of jersey-spring artifact are not the same that are already defined in the original greenhouse pom.xml

    Quote Originally Posted by garyj View Post
    Have you included the repository in your pom.xml?

    <repository>
    <id>maven2-repository.dev.java.net</id>
    <name>Java.net Repository for maven</name>
    <url>http://download.java.net/maven/2/</url>
    </repository>

    Gary
    One of the first maven error is:

    [aspectj:compile {execution: default}]
    [ERROR] The type org.springframework.context.SmartLifecycle cannot be resolved. It is indirectly referenced from required .class files
    [WARNING] advice defined in org.springframework.orm.jpa.aspectj.JpaExceptionTr anslatorAspect has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.scheduling.aspectj.AbstractAsy ncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDriv enStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethod MockingControl has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethod MockingControl has not been applied [Xlint:adviceDidNotMatch]
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Compiler errors :
    error at public class AsyncHttpRequestHandlingMessageAdapter extends AbstractEndpoint
    ^^^^^^^^^^^^^^^
    /greenhouse/src/main/java/org/springframework/integration/comet/AsyncHttpRequestHandlingMessageAdapter.java:62:0:: 0 The type org.springframework.context.SmartLifecycle cannot be resolved. It is indirectly referenced from required .class files




    If I use the STS IDE, just adding the dependency give me a lot of errors that was not mentioned before.

  4. #4
    Join Date
    Aug 2004
    Posts
    1,072

    Default

    I've not tried this yet, but is it possible that the Jersey dependency is transitively drawing in some older version of Spring, confusing the classpath with multiple versions of Spring? I've had this kind of thing happen before and it was a simple (although annoying) matter of adding in some exclusions to keep out the transitive dependencies.

    Okay, I take that back...I just tried it and it looks like the Jersery dependency is pulling in Spring 2.5.6 dependencies along with the Spring 3.1 (SNAPSHOT) dependencies and thereby confusing the classpath with multiple versions of Spring. (It seems that the 2.5.6 final dependencies trump the 3.1 snapshot dependencies.)

    I changed the dependency to look like the following and it built fine:

    <!-- Jersey -->
    <dependency>
    <groupId>com.sun.jersey.contribs</groupId>
    <artifactId>jersey-spring</artifactId>
    <version>1.5-ea09</version>
    <exclusions>
    <exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    </exclusion>
    <exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    </exclusion>
    <exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    </exclusion>
    <exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    </exclusion>
    <exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aop</artifactId>
    </exclusion>
    </exclusions>
    </dependency>
    Craig Walls
    Spring Social Project Lead

  5. #5
    Join Date
    Jan 2011
    Posts
    8

    Default

    thank you very much habuma for your solution, it works fine for me !

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •