Adding and configuring guice in a large web app on GAE
I hit the maximum url-patterns that one can have in the web.xml and I looked towards guice to offer a workaround. If I could get it to work, everything would be fine. All I want to do is set up a server so that I can re-route url-patterns to new serv Here's what the relevant parts of my web.xml look like:
<filter>
<filter-name>guiceFilter</filter-name>
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>guiceFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>com.google.truxmap.server.guice.MyGuiceServletContextListener</listener-class>
</listener>
And the stack trace for the error I'm receiving:
Failed startup of context com.google.apphosting.utils.jetty.RuntimeAppEngineWebAppContext@1435ec9{/,/base/data/home/apps/foodtrucksmap/5.348199425225253754}
com.google.inject.CreationException: Guice creation errors:
1) An exception was caught and reported. Message: Unable to get members for class com.google.inject.AbstractModule
at com.google.inject.InjectorShell$Builder.build(InjectorShell.java:135)
Caused by: java.lang.SecurityException: Unable to get members for class com.google.inject.AbstractModule
at com.google.appengine.runtime.Request.process-47bc6af27ac147aa(Request.java)
at java.lang.Class.getDeclaredMethods(Class.java:252)
at com.google.inject.internal.ProviderMethodsModule.getProviderMethods(ProviderMethodsModule.java:78)
at com.google.inject.internal.ProviderMethodsModule.configure(ProviderMethodsModule.java:70)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:232)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.InjectorShell$Builder.build(InjectorShell.java:135)
at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:102)
at com.google.inject.Guice.createInjector(Guice.java:92)
at com.google.inject.Guice.createInjector(Guice.java:69)
at com.google.inject.Guice.createInjector(Guice.java:59)
at com.google.truxmap.server.guice.MyGuiceServletContextListener.getInjector(MyGuiceServletContextListener.java:14)
at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:43)
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.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:435)
at com.google.net.rpc.impl.Server$RpcTask.runInContext(Server.java:572)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:448)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:688)
at com.goog开发者_C百科le.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:326)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:318)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:446)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
... 30 more
Caused by: java.lang.NoClassDefFoundError: [Lorg/aopalliance/intercept/MethodInterceptor;
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2444)
... 30 more
Caused by: java.lang.ClassNotFoundException: org.aopalliance.intercept.MethodInterceptor
at com.google.appengine.runtime.Request.process-47bc6af27ac147aa(Request.java)
... 30 more
Thanks so much for the help!
It seems that you just need to resolve dependency on aopalliance library. Put aopalliance.jar into your WEB-INF/lib folder.
精彩评论