jboss-javassist / javassist

Java bytecode engineering toolkit
www.javassist.org
Other
4.1k stars 695 forks source link

Javassist doesn't work on Google AppEngine #87

Open lukaszlenart opened 8 years ago

lukaszlenart commented 8 years ago

I was trying to use the latest Apache Struts with the latest OGNL library which is using javassist-3.20.0-GA on the Google AppEngine but it throws RuntimeExceptions. I don't know what's the real reason for that, just read somewhere that Javassist requires to read Class as a resource which is prohibited on GAE.

To solve that problem I had to switch to older version of Javassist, i.e. javassist-3.18.2-GA

chibash commented 8 years ago

OK, but I cannot make any comments without knowing what the RuntimeException was. Can you put its message here?

lukaszlenart commented 8 years ago

Sure but that won't help ;-)

Uncaught exception from servlet
java.lang.ExceptionInInitializerError
    at com.gruuf.web.InitListener.contextInitialized(InitListener.java:20)
    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.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:206)
    at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:179)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:136)
    at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:469)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:439)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:446)
    at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:256)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:310)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:302)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:443)
    at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:235)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException
    at com.google.appengine.runtime.Request.process-efc197d449224f3f(Request.java)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:375)
    at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:159)
    at com.gruuf.web.InitListener.contextInitialized(InitListener.java:20)
    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:439)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:446)
    at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:256)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:310)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:302)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:443)
    ... 1 more
lukaszlenart commented 8 years ago

It took me two days to figure out what was the main reason - as you see, stacktrace wasn't very helpful :\

lukaszlenart commented 8 years ago

Thanks to this https://issues.jboss.org/browse/WELD-616 I have switched to older version of Javassist and resolved the problem. I know the issue is a bit old but it was the only hint I have found.

chibash commented 8 years ago

Thanks for the info. I'll try to fix it. Anyway, since Java 9 Jigsaw has completely broken the current class-file loading mechanism of Javassist, I must do something.