NoClassDefFoundError: Could not initialize class org.jboss.errai.jaxrs.ErraiProvider
xybrek Sep 16, 2013 12:50 PMI'm having some issue running my GWT/Errai app in GAE (Google App Engine). Also not sure why my app cannot initialize ErraiProvider?
Error:
Uncaught exception from servlet
java.lang.NoClassDefFoundError: Could not initialize class org.jboss.errai.jaxrs.ErraiProvider
at com.google.appengine.runtime.Request.process-c75f0be3ef583674(Request.java)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:33)
at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:132)
at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:1801)
at org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyReader(ResteasyProviderFactory.java:681)
at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1128)
at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1085)
at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1029)
at org.jboss.resteasy.spi.ResteasyDeployment.registerProvider(ResteasyDeployment.java:508)
at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:316)
at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:226)
at org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextInitialized(ResteasyBootstrap.java:28)
at org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener.contextInitialized(GuiceResteasyBootstrapServletContextListener.java:22)
at com.myapp.server.guice.CustomGuiceResteasyBootstrapServletContextListener.contextInitialized(CustomGuiceResteasyBootstrapServletContextListener.java:48)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:435)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:442)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:186)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:306)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:298)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:439)
at java.lang.Thread.run(Thread.java:722)
Code (Resteasy):
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
ServletContext context = servletContextEvent.getServletContext();
if (context != null) {
if (context.getInitParameter("user-base-url") != null) {
userBaseUrl = context.getInitParameter("user-base-url");
}
String override = System.getProperty("staticBaseUrl");
if (override != null || context.getInitParameter("static-base-url") != null) {
staticBaseUrl = (override != null) ? override : context.getInitParameter("static-base-url");
}
}
super.contextInitialized(servletContextEvent); // <--- Line 48
}
Update:
This is my application web XML config:
<context-param>
<param-name>resteasy.guice.modules</param-name>
<param-value>com.myapp.server.guice.ServeModule</param-value>
</context-param>
<context-param>
<param-name>resteasy.providers</param-name>
<param-value>org.jboss.errai.jaxrs.ErraiProvider</param-value>
</context-param>
<listener>
<listener-class>
com.myapp.server.guice.CustomGuiceResteasyBootstrapServletContextListener
</listener-class>
</listener>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/</param-value>
</context-param>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>