1

I am trying to learn Maven and to that end I want to create a project in Eclipse 4.3 targetting the GAE (latest version: 1.8.4) and using Maven for building/dependency management. I want to include Resteasy and CDI, but for the time being I have problems with Resteasy.

What have I done:

  • Followed this guide (without the Jersey part) to setup a Maven/Eclipse/GAE project. I had to change the Java source and target configuration to 1.7 and it worked great.

  • To include Resteasy:

    • Added the following dependencies:

      <dependency>
          <groupId>org.jboss.resteasy</groupId>
          <artifactId>resteasy-jaxrs</artifactId>
          <version>2.3.7.Final</version>
      </dependency>
      <dependency>
          <groupId>org.jboss.resteasy</groupId>
          <artifactId>resteasy-jaxb-provider</artifactId>
          <version>2.3.7.Final</version>
      </dependency>
      <dependency>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-jaxrs</artifactId>
          <version>1.9.13</version>
      </dependency>
      <dependency>
          <groupId>org.jboss.resteasy</groupId>
          <artifactId>resteasy-jackson-provider</artifactId>
          <version>2.3.7.Final</version>
      </dependency>
      
    • Implemented javax.ws.rs.core.Application.

    • And the following configuration in web.xml:

      <servlet>
          <servlet-name>Resteasy</servlet-name>
          <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
          <init-param>
              <param-name>javax.ws.rs.Application</param-name>
              <param-value>npara.expenses.server.JaxRsApplication</param-value>
          </init-param>
      </servlet>
      <servlet-mapping>
          <servlet-name>Resteasy</servlet-name>
          <url-pattern>/api/*</url-pattern>
      </servlet-mapping>
      

When running the project, using the launch configuration created by Maven, I get the following exception:

java.lang.ClassNotFoundException:
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher

The HttpServletDispatcher is located in resteasy-jaxrs-2.3.7.Final.jar, which is correctly placed in WEB-INF/lib. I already have created a similar project using GAE, Resteasy, CDI without Maven (manual JAR management) and this exact configuration and it works perfectly.

Any help appreciated!

4

1 に答える 1

0

使いやすいJerseyを使ってみてください。

<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-core</artifactId>
    <version>1.9.1</version>
</dependency>
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-server</artifactId>
    <version>1.9.1</version>
</dependency>
于 2013-12-11T19:01:38.050 に答える