NoClassDefFoundError on a class provided by jersey-core (UriComponent$Type)

1.6k Views Asked by At

I am using WebLogic 10.2c. My webapp containing a jax-rs resource works fine in the grizzley but when it is deployed into WebLogic according to http://docs.oracle.com/cd/E17904_01/web.1111/e13734/rest.htm, it throws a NoClassDefFoundError as shown below. The weird thing is that this class can indeed be loaded by my webapp with class.forName() done in my servlet. So, somehow that class has become unavailable for jersey itself. Any idea on how to troubleshoot? I've tried using jersey as a shared library (and thus not including into my .war file) and including jersey into my .war file. Either makes any difference.

Error 500--Internal Server Error
java.lang.NoClassDefFoundError: com/sun/jersey/api/uri/UriComponent$Type
     at com.sun.jersey.api.uri.UriBuilderImpl.appendPath(UriBuilderImpl.java:497)
     at com.sun.jersey.api.uri.UriBuilderImpl.appendPath(UriBuilderImpl.java:485)
     at com.sun.jersey.api.uri.UriBuilderImpl.replacePath(UriBuilderImpl.java:244)
     at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:687)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
     at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
     at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
     at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
     at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:352)
     at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:235)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3284)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
     at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
     at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
     at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
     at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089)
     at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
     at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1512)
     at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
     at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
1

There are 1 best solutions below

0
On

Cleaning the project. Top menu -- Project --> clean. then Restart the server. This worked for me.