java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer
當用jersey 1.19建立RESTful服務時,遇到java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer的錯誤訊息。
解決方法:
1.將相關jar檔全複製到web-inf/lib/之內,就可以解決。(asm-3.3.1.jar, jersey-bundle-1.19.jar, jersey-core-1.19.jar, jersey-server-1.19.jar, son-20140107.jar, jsr311-api-1.1.1)
2.the server had no jars in the lib folder. Make sure it has access to all dependencies in: project -> properties -> development assembly -> add -> java build path entries.
正常啟動tomcat產生的訊息如下:
十月 20, 2015 4:35:02 下午 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
十月 20, 2015 4:35:02 下午 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52
十月 20, 2015 4:35:05 下午 com.sun.jersey.api.core.servlet.WebAppResourceConfig init
INFO: Scanning for root resource and provider classes in the Web app resource paths:
/WEB-INF/lib
/WEB-INF/classes
十月 20, 2015 4:35:05 下午 com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class restjerseyexample.FtoCService
class restjerseyexample.CtoFService
十月 20, 2015 4:35:05 下午 com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
十月 20, 2015 4:35:05 下午 com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.19 02/11/2015 05:39 AM'
reference:
http://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/
http://stackoverflow.com/questions/18086218/java-lang-classnotfoundexception-com-sun-jersey-spi-container-servlet-servletco
http://stackoverflow.com/questions/17792277/jersey-java-lang-classnotfoundexception-com-sun-jersey-spi-container-servlet-se
解決方法:
1.將相關jar檔全複製到web-inf/lib/之內,就可以解決。(asm-3.3.1.jar, jersey-bundle-1.19.jar, jersey-core-1.19.jar, jersey-server-1.19.jar, son-20140107.jar, jsr311-api-1.1.1)
2.the server had no jars in the lib folder. Make sure it has access to all dependencies in: project -> properties -> development assembly -> add -> java build path entries.
正常啟動tomcat產生的訊息如下:
十月 20, 2015 4:35:02 下午 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
十月 20, 2015 4:35:02 下午 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52
十月 20, 2015 4:35:05 下午 com.sun.jersey.api.core.servlet.WebAppResourceConfig init
INFO: Scanning for root resource and provider classes in the Web app resource paths:
/WEB-INF/lib
/WEB-INF/classes
十月 20, 2015 4:35:05 下午 com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class restjerseyexample.FtoCService
class restjerseyexample.CtoFService
十月 20, 2015 4:35:05 下午 com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
十月 20, 2015 4:35:05 下午 com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.19 02/11/2015 05:39 AM'
reference:
http://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/
http://stackoverflow.com/questions/18086218/java-lang-classnotfoundexception-com-sun-jersey-spi-container-servlet-servletco
http://stackoverflow.com/questions/17792277/jersey-java-lang-classnotfoundexception-com-sun-jersey-spi-container-servlet-se
留言
張貼留言