Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I integrate Jersey with Tomcat using Maven

I'm trying to use Jersey to create REST services using tomcat as a container. I'm struggling to figure out what the maven artifacts are.

I'd like to use the jersey servlet to serve manage my service.

<dependencies>

    ...

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-project</artifactId>
        <version>1.11</version>         
    </dependency>       

</dependencies>

<repositories>
    <repository>
        <id>maven-repos</id>
        <name>Glassfish Repos</name>
        <url> http://maven.java.net</url>
    </repository>
</repositories>

Just getting invalid checksum errors, etc...

like image 849
sparkyspider Avatar asked Dec 21 '11 21:12

sparkyspider


2 Answers

ref: jersey user-guide, Chapter 11. Dependencies

artifactId should be 'jersey-server', not 'jersey-project'.

the following dependency is ok to me.

<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-server</artifactId>
    <version>1.11</version>
</dependency>
like image 77
payliu Avatar answered Nov 01 '22 20:11

payliu


The following dependencies work for me:

<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-server</artifactId>
</dependency>
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-servlet</artifactId>
</dependency>

I am using Tomcat as a servlet container for Jersey.

like image 45
Jingguo Yao Avatar answered Nov 01 '22 22:11

Jingguo Yao