与guice有关的问题

时间:2014-09-11 20:32:59

标签: tomcat guice

我遇到了在本地运行网络应用程序时遇到的问题,特别是在将它部署到tomcat时。我知道有很多人发布了信息,但遗憾的是没有一个对我有帮助。但是,tomcat的版本是否与guice问题有关?因为我们使用一个不同版本的tomcat,用于远程部署我们在本地使用的Web应用程序。具体来说,我尝试在本地部署时收到此错误:

自定义提供程序出错。

如果有人有兴趣帮助我,我可以提供详细信息。但是现在我需要知道tomcat版本是否是罪魁祸首。

感谢, Mukhtar Farid

这是堆栈跟踪:

108) Error in custom provider, java.lang.NullPointerException

  at org.eframeworks.layers.infrastructure.persistence.PersistenceModule.internalConfigure(PersistenceModule.java:357)
  while locating org.eframeworks.layers.infrastructure.factory.FactoryConfiguration
    for parameter 1 at org.eframeworks.layers.infrastructure.factory.GuicedObjectFactory.<init>(GuicedObjectFactory.java:49)
  at org.eframeworks.layers.infrastructure.factory.GuicedObjectFactory.class(GuicedObjectFactory.java:49)
  while locating org.eframeworks.layers.infrastructure.factory.GuicedObjectFactory
  at org.eframeworks.layers.infrastructure.persistence.PersistenceModule.internalConfigure(PersistenceModule.java:390)
  while locating org.apache.ibatis.reflection.factory.ObjectFactory
    for field at org.eframeworks.layers.infrastructure.persistence.ConfigurationProvider.objectFactory(ConfigurationProvider.java:236)
  at org.eframeworks.layers.infrastructure.persistence.ConfigurationProvider.class(ConfigurationProvider.java:43)
  while locating org.eframeworks.layers.infrastructure.persistence.ConfigurationProvider
  at org.eframeworks.layers.infrastructure.persistence.PersistenceModule.internalConfigure(PersistenceModule.java:382)
  while locating org.apache.ibatis.session.Configuration
    for parameter 0 at org.mybatis.guice.session.SqlSessionFactoryProvider.createNewSqlSessionFactory(SqlSessionFactoryProvider.java:64)
  at org.mybatis.guice.session.SqlSessionFactoryProvider.class(SqlSessionFactoryProvider.java:31)
  while locating org.mybatis.guice.session.SqlSessionFactoryProvider
  at org.eframeworks.layers.infrastructure.persistence.PersistenceModule.internalConfigure(PersistenceModule.java:385)
  while locating org.apache.ibatis.session.SqlSessionFactory
    for parameter 0 at org.mybatis.guice.session.SqlSessionManagerProvider.createNewSqlSessionManager(SqlSessionManagerProvider.java:55)
  at org.mybatis.guice.session.SqlSessionManagerProvider.class(SqlSessionManagerProvider.java:31)
  while locating org.mybatis.guice.session.SqlSessionManagerProvider
  at org.eframeworks.layers.infrastructure.persistence.PersistenceModule.configure(PersistenceModule.java:187)
  while locating org.apache.ibatis.session.SqlSessionManager
    for field at org.mybatis.guice.mappers.MapperProvider.sqlSessionManager(MapperProvider.java:40)
  while locating org.mybatis.guice.mappers.MapperProvider
  at com.google.inject.util.Providers$3.initialize(Providers.java:101)
  at org.eframeworks.layers.infrastructure.persistence.PersistenceModule.bindMapper(PersistenceModule.java:213)
Caused by: java.lang.NullPointerException
    at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:147)
    at com.google.inject.internal.ConstantFactory.get(ConstantFactory.java:35)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    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:84)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:53)
    at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:110)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:94)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:53)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    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.SingleMethodInjector.inject(SingleMethodInjector.java:83)
    at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:110)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:94)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:53)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    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.SingleMethodInjector.inject(SingleMethodInjector.java:83)
    at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:110)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:94)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:53)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:53)
    at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:110)
    at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:75)
    at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:73)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:73)
    at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:60)
    at com.google.inject.internal.InjectorImpl.injectMembers(InjectorImpl.java:944)
    at com.google.inject.util.Providers$3.initialize(Providers.java:101)
    at com.google.inject.util.Providers$3$$FastClassByGuice$$14d1a0ba.invoke(<generated>)
    at com.google.inject.internal.cglib.reflect.$FastMethod.invoke(FastMethod.java:53)
    at com.google.inject.internal.SingleMethodInjector$1.invoke(SingleMethodInjector.java:56)
    at com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:90)
    at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:110)
    at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:75)
    at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:73)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
    at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:73)
    at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:147)
    at com.google.inject.internal.Initializer.injectAll(Initializer.java:92)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:173)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
    at com.google.inject.Guice.createInjector(Guice.java:95)
    at com.google.inject.Guice.createInjector(Guice.java:72)
    at org.eframeworks.layers.controller.webapp.WebAppListener.getInjector(WebAppListener.java:86)
    at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)
    at org.eframeworks.layers.controller.webapp.WebAppListener.contextInitialized(WebAppListener.java:128)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)

现在我对Guice并不熟悉,但我知道一些Java ......并且看到这个错误,这个异常显然是由于指定了一个空指针而产生的。但是我想知道我是不是只使用了旧版本Guice ...或者是一个无关的解决方案。对此事的任何帮助将不胜感激:)! 干杯, Mukhtar Farid

1 个答案:

答案 0 :(得分:1)

此堆栈跟踪看起来像this Guice bug,由this commit修复。不幸的是,自那时起Guice还没有稳定发布,但是如果你可以使用4.0测试版,那就试试吧。如果您需要帮助解决问题,也可以对错误here发表评论;我不太了解触发它的条件。