在maven-gae-gwt项目中使用guice + requestfactory的情况

时间:2012-01-29 23:55:08

标签: google-app-engine gwt maven guice requestfactory

我正在努力设定我的发展环境而且我遇到了一个大问题。 我将它设置为运行gwt-gae-maven应用程序,该应用程序将使用guice进行依赖项注入和requestfactory来保存数据。 我使用了一个我在这里找到的api https://github.com/etiennep/injected-requestfactory ...它看起来很神奇,但对我来说不适用。试着像http://www.wanderingcanadian.ca/guiced-up-gwt-requestfactory那样做,没有任何作用...... 当我尝试将其作为webapplication运行时,我得到了这个异常并且没有任何作用:

1)自定义提供程序中的错误,java.lang.RuntimeException:

java.lang.reflect.InvocationTargetException
  at com.kradcifer.glazier.server.requestfactory.InjectedRequestFactoryModule.getValidatorFactory(InjectedRequestFactoryModule.java:42)
  while locating javax.validation.ValidatorFactory
  at com.kradcifer.glazier.server.requestfactory.InjectedRequestFactoryModule.getValidator(InjectedRequestFactoryModule.java:59)
  while locating javax.validation.Validator
    for parameter 1 at com.kradcifer.glazier.server.requestfactory.InjectedServiceLayerDecorator.<init>(InjectedServiceLayerDecorator.java:36)
  while locating com.kradcifer.glazier.server.requestfactory.InjectedServiceLayerDecorator
  while locating com.google.web.bindery.requestfactory.server.ServiceLayerDecorator
    for parameter 1 at com.kradcifer.glazier.server.requestfactory.InjectedRequestFactoryServlet.<init>(InjectedRequestFactoryServlet.java:25)
  while locating com.kradcifer.glazier.server.requestfactory.InjectedRequestFactoryServlet

1 error
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:741)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:763)
    at com.google.inject.servlet.ServletDefinition.init(ServletDefinition.java:74)
    at com.google.inject.servlet.ManagedServletPipeline.init(ManagedServletPipeline.java:86)
    at com.google.inject.servlet.ManagedFilterPipeline.initPipeline(ManagedFilterPipeline.java:106)
    at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:168)
    at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:593)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:222)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
    at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:106)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:44)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:43)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:785)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:54)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:44)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:732)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:785)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:728)
    at com.google.inject.spi.ProviderLookup$1.get(ProviderLookup.java:89)
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:95)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:44)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:43)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:785)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:54)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:44)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:79)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:180)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:51)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:79)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:180)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:43)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:785)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:54)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:44)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:732)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:778)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:728)
    ... 25 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:101)
    ... 59 more
Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/validation/Validation
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:372)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
    at com.kradcifer.glazier.server.requestfactory.InjectedRequestFactoryModule.getValidatorFactory(InjectedRequestFactoryModule.java:42)
    ... 64 more
   [WARN] Failed startup of context com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload@7c125c9e{/,C:\Rodrigo\Desenvolvimento\Glazier\glazier\src\main\webapp}
com.google.inject.ProvisionException: Guice provision errors:

1) Error in custom provider, java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
  at com.kradcifer.glazier.server.requestfactory.InjectedRequestFactoryModule.getValidatorFactory(InjectedRequestFactoryModule.java:42)
  while locating javax.validation.ValidatorFactory
  at com.kradcifer.glazier.server.requestfactory.InjectedRequestFactoryModule.getValidator(InjectedRequestFactoryModule.java:59)
  while locating javax.validation.Validator
    for parameter 1 at com.kradcifer.glazier.server.requestfactory.InjectedServiceLayerDecorator.<init>(InjectedServiceLayerDecorator.java:36)
  while locating com.kradcifer.glazier.server.requestfactory.InjectedServiceLayerDecorator
  while locating com.google.web.bindery.requestfactory.server.ServiceLayerDecorator
    for parameter 1 at com.kradcifer.glazier.server.requestfactory.InjectedRequestFactoryServlet.<init>(InjectedRequestFactoryServlet.java:25)
  while locating com.kradcifer.glazier.server.requestfactory.InjectedRequestFactoryServlet

1 error
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:741)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:763)
    at com.google.inject.servlet.ServletDefinition.init(ServletDefinition.java:74)
    at com.google.inject.servlet.ManagedServletPipeline.init(ManagedServletPipeline.java:86)
    at com.google.inject.servlet.ManagedFilterPipeline.initPipeline(ManagedFilterPipeline.java:106)
    at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:168)
    at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:593)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:222)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
    at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:106)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:44)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:43)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:785)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:54)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:44)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:732)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:785)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:728)
    at com.google.inject.spi.ProviderLookup$1.get(ProviderLookup.java:89)
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:95)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:44)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:43)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:785)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:54)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:44)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:79)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:180)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:51)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:79)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:180)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:43)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:785)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:54)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:44)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:732)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:778)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:728)
    ... 25 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:101)
    ... 59 more
Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/validation/Validation
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:372)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
    at com.kradcifer.glazier.server.requestfactory.InjectedRequestFactoryModule.getValidatorFactory(InjectedRequestFactoryModule.java:42)
    ... 64 more

此外,我尝试在没有guice的情况下运行它,直接在web.xml上指定servlet,但是得到了相同的错误(但这次不是在我运行应用程序时,而是在我启动时)。

尝试了很多东西而没有任何效果......总是出现同样的错误。我认为这可能只是一个我看不到的细节......我不能继续,直到我解决它......有人知道如何做?

感谢。

1 个答案:

答案 0 :(得分:0)

无法解决它...我修复它的方法是删除项目并重新启动它...现在它可以工作,不知道出了什么问题。