Announcement Announcement Module
Collapse
No announcement yet.
jersey-spring integration problems Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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

      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.

      Comment


      • #4
        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>

        Comment


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

          Comment

          Working...
          X