eclipse - Jersey com.sun.jersey.spi.container.servlet.ServletContainer error when using MAVEN -
when i'm attempting build simple test application in eclipse using jersey. when try run app exception:
java.lang.classnotfoundexception: com.sun.jersey.spi.container.servlet.servletcontainer
i've researched answers question here on stack overflow , have verified these things:
it true missing class not exists in jersey-server more. class exists in jersey-servlet (notice "servlet", not "server"). maven dependencies this:
<dependencies> <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-core</artifactid> <version>1.19</version> </dependency> <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-servlet</artifactid> <version>1.19</version> </dependency> <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-server</artifactid> <version>1.19</version> </dependency> </dependencies>
and web.xml looks this
<servlet> <servlet-name>jersey-helloworld-serlvet</servlet-name> <servlet-class> com.sun.jersey.spi.container.servlet.servletcontainer </servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.javacodegeeks.enterprise.rest.jersey</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jersey-helloworld-serlvet</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping>
i can @ project in eclipse , under java resources/libraries/maven dependencies can see file jersey-servlet-1.19.jar , in jar can see com.sun.jersey.spi.container.servlet package , within package can see servletcontainer.class file.
so appears correct, , yet when server (apache 7.0) starts can't find class there.
thank advice may have.
it's eclipse setup issue, not jersey issue.
from thread classnotfoundexception: com.sun.jersey.spi.container.servlet.servletcontainer
right click eclipse project properties -> deployment assembly -> add -> java build path entries -> maven dependencies -> finish.
so eclipse wasn't using maven dependencies when starting apache.
Comments
Post a Comment