当前位置: 代码迷 >> Java Web开发 >> Guice creation errors解决方案
  详细解决方案

Guice creation errors解决方案

热度:7782   发布时间:2016-04-10 23:41:33.0
Guice creation errors
使用mybatis-guice遇到的问题,下面是错误信息,此错误在tomcat启动时时有时无,很是无奈,特求大神帮忙。
信息: Deploying web application directory alading
com.google.inject.CreationException: Guice creation errors:
1) Error in custom provider, java.lang.NullPointerException
  at org.mybatis.guice.MyBatisModule.bindDataSourceProviderType(MyBatisModule.java:215)
  while locating javax.sql.DataSource
    for field at org.mybatis.guice.environment.EnvironmentProvider.dataSource(EnvironmentProvider.java:57)
  at org.mybatis.guice.environment.EnvironmentProvider.class(EnvironmentProvider.java:32)
  while locating org.mybatis.guice.environment.EnvironmentProvider
  at org.mybatis.guice.MyBatisModule.internalConfigure(MyBatisModule.java:105)
  while locating org.apache.ibatis.mapping.Environment
    for parameter 0 at org.mybatis.guice.configuration.ConfigurationProvider.<init>(ConfigurationProvider.java:116)
  at org.mybatis.guice.configuration.ConfigurationProvider.class(ConfigurationProvider.java:43)
  while locating org.mybatis.guice.configuration.ConfigurationProvider
  at org.mybatis.guice.MyBatisModule.internalConfigure(MyBatisModule.java:106)
  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.mybatis.guice.MyBatisModule.internalConfigure(MyBatisModule.java:107)
  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.mybatis.guice.AbstractMyBatisModule.configure(AbstractMyBatisModule.java:51)
  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.mybatis.guice.AbstractMyBatisModule.bindMapper(AbstractMyBatisModule.java:76)

1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:175)
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 com.google.inject.Guice.createInjector(Guice.java:62)
at com.chinarewards.alading.listener.GuiceSrtuts2Listener.getInjector(GuiceSrtuts2Listener.java:239)
at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NullPointerException
at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:147)
  相关解决方案