Java annotation API not running on Caucho Resin server

Hi,

When I try to run the sample servlet code under Caucho Resin v.4.0.41, I consistently get the following error message.

at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)
Caused by: java.lang.NoClassDefFoundError: com/aspose/words/License
at com.groupdocs.viewer.license.a.a.a(GroupDocsLicense.java:67)
at com.groupdocs.viewer.license.a.a.a(GroupDocsLicense.java:34)
at com.groupdocs.viewer.license.License.setLicense(License.java:57)
at com.groupdocs.viewer.license.License.setLicense(License.java:45)
at com.groupdocs.viewer.handlers.ViewerHandler.(ViewerHandler.java:75)
at com.groupdocs.annotation.api.a.b.(CommonApi.java:49)
at com.groupdocs.annotation.api.shared.CommonApi.(CommonApi.java:49)
at com.groupdocs.annotation.api.shared.WebApi.(WebApi.java:53)
at com.groupdocs.annotation.handler.AnnotationHandler.(AnnotationHandler.java:42)
at com.groupdocs.annotation.handler.AnnotationHandler.(AnnotationHandler.java:31)
at AnnotationServlet.init(AnnotationServlet

The code works under Tomcat. I searched for similar errors, and found one on the Aspose Words forum. The bug was logged as WORDSJAVA-803. I wonder if something similar could be happening with annotations.


Hello Cayle,

Sorry to see you get this problem. We have finally investigated the GroupDocs.Annotation for Java library sample deployment to the Caucho Resin server. Here I provide a list of changes to the servlet sample to make it run under Resin:
  • Add slf4j-simple-1.7.8.jar library to the sample’s lib folder
  • Comment 9 line in the build.xml file, so it looks like
  • Configure web/WEB-INF/application.properties up to your needs
  • Change ImportAnnotationsServlet declaration with its mapping in the web/WEB-INF/web.xml to preserve the correct order
  • Rename “default” to the “resin-file
And there is one more change necessary due to the Resin WebSockets implementation (probably there is problem with it). So, as the Atmosphere framework is using it we have two choices:
  1. Disable Atmosphere (using disableAtmosphere=false in the web/WEB-INF/application.properties)
  2. Force Atmosphere using the “blocking” mode (ref. https://atmosphere.java.net/atmosphere_whitepaper.pdf page 7)

    org.atmosphere.useBlocking
    true
With these changes we were able to successfully run the sample. If you still will have problems, please, provide your modified solution or your changes, so we can check it and help you better.

I’m still getting the same class not found error.

I have attached the zip file of the samples directory.  
I have included the dependency jar files from the lib directory, since I’m not using maven.
[show] java.lang.NoClassDefFoundError: com/aspose/words/License

javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/aspose/words/License
at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:1289)
at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:1201)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:98)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:169)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:232)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
at com.caucho.server.rewrite.MatchFilterChain.doFilter(MatchFilterChain.java:98)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:838)
at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1346)
at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1302)
at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1286)
at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1194)
at com.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:993)
at com.caucho.network.listen.TcpSocketLink.handleAcceptTask(TcpSocketLink.java:945)
at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:114)
at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93)
at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169)
at com.caucho.network.listen.TcpSocketResumeThread.run(TcpSocketResumeThread.java:62)
at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)
Caused by: java.lang.NoClassDefFoundError: com/aspose/words/License
at com.groupdocs.viewer.license.a.a.a(GroupDocsLicense.java:67)
at com.groupdocs.viewer.license.a.a.a(GroupDocsLicense.java:34)
at com.groupdocs.viewer.license.License.setLicense(License.java:57)
at com.groupdocs.annotation.api.a.b.(CommonApi.java:50)
at com.groupdocs.annotation.api.shared.CommonApi.(CommonApi.java:49)
at com.groupdocs.annotation.api.shared.WebApi.(WebApi.java:53)
at com.groupdocs.annotation.handler.AnnotationHandler.(AnnotationHandler.java:42)
at com.groupdocs.annotation.handler.AnnotationHandler.(AnnotationHandler.java:31)
at com.groupdocs.annotation.samples.javaweb.AnnotationServlet.init(AnnotationServlet.java:121)
at javax.servlet.GenericServlet.init(GenericServlet.java:70)
at com.caucho.server.dispatch.ServletConfigImpl.createServletImpl(ServletConfigImpl.java:1354)
at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:1250)
at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:1201)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:98)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:169)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:232)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
at com.caucho.server.rewrite.MatchFilterChain.doFilter(MatchFilterChain.java:98)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:838)
at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1346)
at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1302)
at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1286)
at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1194)
at com.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:993)
at com.caucho.network.listen.TcpSocketLink.handleAcceptTask(TcpSocketLink.java:945)
at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:114)
at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93)
at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169)
at com.caucho.network.listen.TcpSocketResumeThread.run(TcpSocketResumeThread.java:62)
at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)

Hello Cayle,

Indeed, we were able to reproduce the issue. Probably it is some internal library problem that was fixed in the next version, because by mistake previous time I deployed the 1.8.2 version of the GroupDocs.Annotation to the Resin. Those instructions are given for the 1.8.2 version, I realized it later. Sorry for the inconvenience.

You can try to deploy the sample with the GroupDocs.Annotation v.1.8.2 for Java library:
https://github.com/groupdocs/ (now the master branch is updated to the 1.8.2 version)

The library itself temporary (before the release) is available here:
https://drive.google.com/file/d/0B-qDE6NSBs6pV1JGZHNSLTA5aEk/view?usp=sharing

You can use instructions from my previous post to prepare the sample and deploy it.