views:

524

answers:

2

I followed the example at http://blog.hivedevelopment.co.uk/2009/08/google-web-toolkit-gwt-mvp-example.html and built the example GWT application, but then I wanted to build something else, and I plan on using Google AppEngine. I started a new GWT2.0 + AppEngine project and followed the same setup of adding the same libararies, copied and modified most of my code from the example project. My code compiles, but now every time I try to debug my app, I get this exception and nothing works. This exception repeats two more times every time I start the service. I thought I might be missing org.apache.commons.logging.Log, but when I ctrl+click to that path, its part of gwt-dev.jar in the GWT SDK. What do I need to do to fix this?

Jan 26, 2010 5:23:13 AM com.google.apphosting.utils.jetty.JettyLogger warn WARNING: failed com.google.apphosting.utils.jetty.DevAppEngineWebAppContext@460ab1b4{/,/home/asa/Projects/Java/Groceries/Shopping/war} java.lang.NoClassDefFoundError: org/apache/commons/logging/Log at com.asaayers.server.guice.ServerModule.configureHandlers(ServerModule.java:20) at net.customware.gwt.dispatch.server.guice.ActionHandlerModule.configure(ActionHandlerModule.java:38) at com.google.inject.AbstractModule.configure(AbstractModule.java:59) at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223) 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.asaayers.server.guice.MyGuiceServletConfig.getInjector(MyGuiceServletConfig.java:11) at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:43) at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:530) at org.mortbay.jetty.servlet.Context.startContext(Context.java:135) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117) at org.mortbay.jetty.Server.doStart(Server.java:217) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40) at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:188) at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:120) at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:217) at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:86) at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:377) at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:938) at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:690) at com.google.gwt.dev.DevMode.main(DevMode.java:251) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:151) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 31 more

+1  A: 

It seems that Guice uses commons-logging. The tutorial describes how to put a whole bunch of jars in war/WEB-INF/bin. You'll need to download the zip file from the commons-logging site, open it up and find commons-logging-1.1.1.jar, and put that in war/WEB-INF/lib.

Commons-logging will find that you have log4j in your class path, and automatically use that.

John
Thank you, that was exactly what I needed. The tutorial lists a bunch of other jars that I added, but seems to leave out commons-logging. Do you happen to know why I need that jar now, but I didn't seem to need it in the example project?
Asa Ayers
Dhanji says Guice doesn't require commons-logging. It seems the com.asaayers.server.guice.ServerModule class is trying to use it in the configureHandlers() method. Perhaps some configuration option is telling Guice to use commons-logging.
John
A: 

Guice does NOT use commons-logging. Perhaps one of your other libraries uses it. Guice only depends on the core JDK (5.0).

Dhanji R Prasanna