I am trying to deploy the RESTful webservices on liberty profile 8.5.5.2. I have enabled the jaxrs-1.1
feature in server and I am using Java 1.7. When I start the server it gives me following error:
[ERROR ] Uncaught.init.exception.thrown.by.servlet
JAX-RS Servlet
accessms
java.lang.NoClassDefFoundError: org/apache/wink/server/handlers/HandlersFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:275)
at [internal classes]
at org.apache.wink.server.internal.DeploymentConfiguration.initHandlers(DeploymentConfiguration.java:456)
at org.apache.wink.server.internal.DeploymentConfiguration.init(DeploymentConfiguration.java:169)
at org.apache.wink.server.internal.servlet.RestServlet.getDeploymentConfiguration(RestServlet.java:184)
at org.apache.wink.server.internal.servlet.RestServlet.createRequestProcessor(RestServlet.java:129)
at org.apache.wink.server.internal.servlet.RestServlet.init(RestServlet.java:94)
at javax.servlet.GenericServlet.init(GenericServlet.java:161)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:325)
at [internal classes]
[ERROR ] SRVE0266E: Error occured while initializing servlets: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:395)
at [internal classes]
Caused by: java.lang.NoClassDefFoundError: org/apache/wink/server/handlers/HandlersFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:275)
at [internal classes]
at org.apache.wink.server.internal.DeploymentConfiguration.initHandlers(DeploymentConfiguration.java:456)
at org.apache.wink.server.internal.DeploymentConfiguration.init(DeploymentConfiguration.java:169)
at org.apache.wink.server.internal.servlet.RestServlet.getDeploymentConfiguration(RestServlet.java:184)
at org.apache.wink.server.internal.servlet.RestServlet.createRequestProcessor(RestServlet.java:129)
at org.apache.wink.server.internal.servlet.RestServlet.init(RestServlet.java:94)
at javax.servlet.GenericServlet.init(GenericServlet.java:161)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:325)
... 1 more
Following is the entry in my web.xml file:
<servlet>
<servlet-name>JAX-RS Servlet</servlet-name>
<servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.example.RestfulResourceLoader</param-value>
</init-param>
<init-param>
<param-name>propertiesLocation</param-name>
<param-value>mobilehandler.properties</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JAX-RS Servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
What other configuration I need to do in order remove this error?
WebSphere Liberty supports JAX-RS 1.1, so you dont need to provide servlet class, just use the following fragment in web.xml:
See also:
UPDATE
The
HandlersFactory
is from third party libraries, try to add the following classloader (in theserver.xml
) to your application to make library visible.