Play Framework(2.4)和DB2配置

时间:2016-03-16 17:58:48

标签: scala jdbc playframework playframework-2.0 db2

我正在使用Play 2.4在Scala中开发一个Web应用程序,它需要连接到DB2,Vertica,MySQL等。

Vertica和MySql配置工作正常,但我无法连接到DB2,版本10.5,修订包5。

这是application.conf设置


    db.db2.driver=com.ibm.db2.jcc.DB2Driver
    db.db2.url="jdbc:db2://host:port/database"
     db.db2.username="user"
    db.db2.password="pass"
    db.db2.logStatements=false
    db.db2.initSQL="select 1 from sysibm.sysdummy1"

我正在使用以下类型4 JDBC驱动程序:

db2jcc.jar
db2jcc4.jar

但是,我收到以下错误(为长错误消息道歉):


    Unexpected exception
    CreationException: Unable to create injector, see the following errors:

    1) Error in custom provider, Configuration error: Configuration error[Cannot connect to database [db2]]
      while locating play.api.db.DBApiProvider
      while locating play.api.db.DBApi
        for field at play.api.db.NamedDatabaseProvider.dbApi(DBModule.scala:80)
      while locating play.api.db.NamedDatabaseProvider
      at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
      at play.api.db.DBModule$$anonfun$namedDatabaseBindings$1.apply(DBModule.scala:34):
    Binding(interface play.api.db.Database qualified with QualifierInstance(@play.db.NamedDatabase(value=vertica)) to ProviderTarget(play.api.db.NamedDatabaseProvider@7e90fdad)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
    Caused by: Configuration error: Configuration error[Cannot connect to database [db2]]
        at play.api.Configuration$.configError(Configuration.scala:178)
        at play.api.Configuration.reportError(Configuration.scala:829)
        at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:48)
        at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:42)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at play.api.db.DefaultDBApi.connect(DefaultDBApi.scala:42)
        at play.api.db.DBApiProvider.get$lzycompute(DBModule.scala:72)
        at play.api.db.DBApiProvider.get(DBModule.scala:62)
        at play.api.db.DBApiProvider.get(DBModule.scala:58)
        at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
        at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
        at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
        at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:93)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:80)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:80)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:62)
        at com.google.inject.internal.InjectorImpl.injectMembers(InjectorImpl.java:984)
        at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
        at com.google.inject.util.Providers$GuicifiedProviderWithDependencies$$FastClassByGuice$$2a7177aa.invoke()
        at com.google.inject.internal.cglib.reflect.$FastMethod.invoke(FastMethod.java:53)
        at com.google.inject.internal.SingleMethodInjector$1.invoke(SingleMethodInjector.java:57)
        at com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:91)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:93)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:80)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
        at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:80)
        at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:174)
        at com.google.inject.internal.Initializer.injectAll(Initializer.java:108)
        at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:174)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
        at com.google.inject.Guice.createInjector(Guice.java:96)
        at com.google.inject.Guice.createInjector(Guice.java:73)
        at com.google.inject.Guice.createInjector(Guice.java:62)
        at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:126)
        at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:93)
        at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:153)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:150)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:150)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:121)
        at scala.Option.map(Option.scala:146)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:121)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:119)
        at scala.util.Success.flatMap(Try.scala:230)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:119)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:111)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
        at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:902)
        at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1689)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1644)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
    Caused by: Configuration error: Configuration error[Exception during pool initialization]
        at play.api.Configuration$.configError(Configuration.scala:178)
        at play.api.PlayConfig.reportError(Configuration.scala:1048)
        at play.api.db.HikariCPConnectionPool.create(HikariCPModule.scala:69)
        at play.api.db.PooledDatabase.createDataSource(Databases.scala:199)
        at play.api.db.DefaultDatabase.dataSource$lzycompute(Databases.scala:124)
        at play.api.db.DefaultDatabase.dataSource(Databases.scala:122)
        at play.api.db.DefaultDatabase.getConnection(Databases.scala:143)
        at play.api.db.DefaultDatabase.getConnection(Databases.scala:139)
        at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:44)
        ... 57 more
    Caused by: com.zaxxer.hikari.pool.PoolInitializationException: Exception during pool initialization
        at com.zaxxer.hikari.pool.BaseHikariPool.initializeConnections(BaseHikariPool.java:542)
        at com.zaxxer.hikari.pool.BaseHikariPool.(BaseHikariPool.java:171)
        at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:60)
        at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:48)
        at com.zaxxer.hikari.HikariDataSource.(HikariDataSource.java:80)
        at play.api.db.HikariCPConnectionPool$$anonfun$1.apply(HikariCPModule.scala:58)
        at play.api.db.HikariCPConnectionPool$$anonfun$1.apply(HikariCPModule.scala:54)
        at scala.util.Try$.apply(Try.scala:191)
        at play.api.db.HikariCPConnectionPool.create(HikariCPModule.scala:54)
        ... 63 more
    Caused by: java.sql.SQLException: JDBC4 Connection.isValid() method not supported, connection test query must be configured
        at com.zaxxer.hikari.pool.BaseHikariPool.addConnection(BaseHikariPool.java:441)
        at com.zaxxer.hikari.pool.BaseHikariPool.initializeConnections(BaseHikariPool.java:540)
        ... 71 more

    2) Error in custom provider, Configuration error: Configuration error[Cannot connect to database [db2]]
      while locating play.api.db.DBApiProvider
      while locating play.api.db.DBApi
        for field at play.api.db.NamedDatabaseProvider.dbApi(DBModule.scala:80)
      while locating play.api.db.NamedDatabaseProvider
      at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
      at play.api.db.DBModule$$anonfun$namedDatabaseBindings$1.apply(DBModule.scala:34):
    Binding(interface play.api.db.Database qualified with QualifierInstance(@play.db.NamedDatabase(value=default)) to ProviderTarget(play.api.db.NamedDatabaseProvider@71350336)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
    Caused by: Configuration error: Configuration error[Cannot connect to database [db2]]
        at play.api.Configuration$.configError(Configuration.scala:178)
        at play.api.Configuration.reportError(Configuration.scala:829)
        at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:48)
        at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:42)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at play.api.db.DefaultDBApi.connect(DefaultDBApi.scala:42)
        at play.api.db.DBApiProvider.get$lzycompute(DBModule.scala:72)
        at play.api.db.DBApiProvider.get(DBModule.scala:62)
        at play.api.db.DBApiProvider.get(DBModule.scala:58)
        at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
        at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
        at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
        at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:93)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:80)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:80)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:62)
        at com.google.inject.internal.InjectorImpl.injectMembers(InjectorImpl.java:984)
        at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
        at com.google.inject.util.Providers$GuicifiedProviderWithDependencies$$FastClassByGuice$$2a7177aa.invoke()
        at com.google.inject.internal.cglib.reflect.$FastMethod.invoke(FastMethod.java:53)
        at com.google.inject.internal.SingleMethodInjector$1.invoke(SingleMethodInjector.java:57)
        at com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:91)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:93)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:80)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
        at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:80)
        at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:174)
        at com.google.inject.internal.Initializer.injectAll(Initializer.java:108)
        at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:174)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
        at com.google.inject.Guice.createInjector(Guice.java:96)
        at com.google.inject.Guice.createInjector(Guice.java:73)
        at com.google.inject.Guice.createInjector(Guice.java:62)
        at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:126)
        at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:93)
        at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:153)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:150)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:150)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:121)
        at scala.Option.map(Option.scala:146)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:121)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:119)
        at scala.util.Success.flatMap(Try.scala:230)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:119)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:111)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
        at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:902)
        at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1689)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1644)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
    Caused by: Configuration error: Configuration error[Exception during pool initialization]
        at play.api.Configuration$.configError(Configuration.scala:178)
        at play.api.PlayConfig.reportError(Configuration.scala:1048)
        at play.api.db.HikariCPConnectionPool.create(HikariCPModule.scala:69)
        at play.api.db.PooledDatabase.createDataSource(Databases.scala:199)
        at play.api.db.DefaultDatabase.dataSource$lzycompute(Databases.scala:124)
        at play.api.db.DefaultDatabase.dataSource(Databases.scala:122)
        at play.api.db.DefaultDatabase.getConnection(Databases.scala:143)
        at play.api.db.DefaultDatabase.getConnection(Databases.scala:139)
        at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:44)
        ... 57 more
    Caused by: com.zaxxer.hikari.pool.PoolInitializationException: Exception during pool initialization
        at com.zaxxer.hikari.pool.BaseHikariPool.initializeConnections(BaseHikariPool.java:542)
        at com.zaxxer.hikari.pool.BaseHikariPool.(BaseHikariPool.java:171)
        at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:60)
        at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:48)
        at com.zaxxer.hikari.HikariDataSource.(HikariDataSource.java:80)
        at play.api.db.HikariCPConnectionPool$$anonfun$1.apply(HikariCPModule.scala:58)
        at play.api.db.HikariCPConnectionPool$$anonfun$1.apply(HikariCPModule.scala:54)
        at scala.util.Try$.apply(Try.scala:191)
        at play.api.db.HikariCPConnectionPool.create(HikariCPModule.scala:54)
        ... 63 more
    Caused by: java.sql.SQLException: JDBC4 Connection.isValid() method not supported, connection test query must be configured
        at com.zaxxer.hikari.pool.BaseHikariPool.addConnection(BaseHikariPool.java:441)
        at com.zaxxer.hikari.pool.BaseHikariPool.initializeConnections(BaseHikariPool.java:540)
        ... 71 more

    3) Error in custom provider, Configuration error: Configuration error[Cannot connect to database [db2]]
      while locating play.api.db.DBApiProvider
      while locating play.api.db.DBApi
        for field at play.api.db.NamedDatabaseProvider.dbApi(DBModule.scala:80)
      while locating play.api.db.NamedDatabaseProvider
      at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
      at play.api.db.DBModule$$anonfun$namedDatabaseBindings$1.apply(DBModule.scala:34):
    Binding(interface play.api.db.Database qualified with QualifierInstance(@play.db.NamedDatabase(value=db2)) to ProviderTarget(play.api.db.NamedDatabaseProvider@29f7b19c)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
    Caused by: Configuration error: Configuration error[Cannot connect to database [db2]]
        at play.api.Configuration$.configError(Configuration.scala:178)
        at play.api.Configuration.reportError(Configuration.scala:829)
        at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:48)
        at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:42)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at play.api.db.DefaultDBApi.connect(DefaultDBApi.scala:42)
        at play.api.db.DBApiProvider.get$lzycompute(DBModule.scala:72)
        at play.api.db.DBApiProvider.get(DBModule.scala:62)
        at play.api.db.DBApiProvider.get(DBModule.scala:58)
        at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
        at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
        at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
        at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:93)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:80)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:80)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:62)
        at com.google.inject.internal.InjectorImpl.injectMembers(InjectorImpl.java:984)
        at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
        at com.google.inject.util.Providers$GuicifiedProviderWithDependencies$$FastClassByGuice$$2a7177aa.invoke()
        at com.google.inject.internal.cglib.reflect.$FastMethod.invoke(FastMethod.java:53)
        at com.google.inject.internal.SingleMethodInjector$1.invoke(SingleMethodInjector.java:57)
        at com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:91)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:93)
        at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:80)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
        at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:80)
        at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:174)
        at com.google.inject.internal.Initializer.injectAll(Initializer.java:108)
        at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:174)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
        at com.google.inject.Guice.createInjector(Guice.java:96)
        at com.google.inject.Guice.createInjector(Guice.java:73)
        at com.google.inject.Guice.createInjector(Guice.java:62)
        at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:126)
        at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:93)
        at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:153)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:150)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:150)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:121)
        at scala.Option.map(Option.scala:146)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:121)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:119)
        at scala.util.Success.flatMap(Try.scala:230)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:119)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:111)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
        at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:902)
        at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1689)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1644)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
    Caused by: Configuration error: Configuration error[Exception during pool initialization]
        at play.api.Configuration$.configError(Configuration.scala:178)
        at play.api.PlayConfig.reportError(Configuration.scala:1048)
        at play.api.db.HikariCPConnectionPool.create(HikariCPModule.scala:69)
        at play.api.db.PooledDatabase.createDataSource(Databases.scala:199)
        at play.api.db.DefaultDatabase.dataSource$lzycompute(Databases.scala:124)
        at play.api.db.DefaultDatabase.dataSource(Databases.scala:122)
        at play.api.db.DefaultDatabase.getConnection(Databases.scala:143)
        at play.api.db.DefaultDatabase.getConnection(Databases.scala:139)
        at play.api.db.DefaultDBApi$$anonfun$connect$1.apply(DefaultDBApi.scala:44)
        ... 57 more
    Caused by: com.zaxxer.hikari.pool.PoolInitializationException: Exception during pool initialization
        at com.zaxxer.hikari.pool.BaseHikariPool.initializeConnections(BaseHikariPool.java:542)
        at com.zaxxer.hikari.pool.BaseHikariPool.(BaseHikariPool.java:171)
        at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:60)
        at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:48)
        at com.zaxxer.hikari.HikariDataSource.(HikariDataSource.java:80)
        at play.api.db.HikariCPConnectionPool$$anonfun$1.apply(HikariCPModule.scala:58)
        at play.api.db.HikariCPConnectionPool$$anonfun$1.apply(HikariCPModule.scala:54)
        at scala.util.Try$.apply(Try.scala:191)
        at play.api.db.HikariCPConnectionPool.create(HikariCPModule.scala:54)
        ... 63 more
    Caused by: java.sql.SQLException: JDBC4 Connection.isValid() method not supported, connection test query must be configured
        at com.zaxxer.hikari.pool.BaseHikariPool.addConnection(BaseHikariPool.java:441)
        at com.zaxxer.hikari.pool.BaseHikariPool.initializeConnections(BaseHikariPool.java:540)
        ... 71 more

    3 errors
    
Here is the application log output just before the above server errors:
<pre>
(Server started, use Ctrl+D to stop and go back to the console...)

[info] - application - Creating Pool for datasource 'default'
[info] - play.api.db.DefaultDBApi - Database [default] connected at jdbc:mysql://mdc2vra001/memsqldb
[info] - application - Creating Pool for datasource 'vertica'
[info] - play.api.db.DefaultDBApi - Database [vertica] connected at jdbc:vertica://mdcvtprod:5433/marsvprod?ResultBufferSize=1048567
[info] - application - Creating Pool for datasource 'db2'
[info] - application - Creating Pool for datasource 'default'
[info] - play.api.db.DefaultDBApi - Database [default] connected at jdbc:mysql://mdc2vra001/memsqldb
[info] - application - Creating Pool for datasource 'vertica'
[info] - play.api.db.DefaultDBApi - Database [vertica] connected at jdbc:vertica://mdcvtprod:5433/marsvprod?ResultBufferSize=1048567
[info] - application - Creating Pool for datasource 'db2'
[info] - application - Creating Pool for datasource 'default'
[info] - play.api.db.DefaultDBApi - Database [default] connected at jdbc:mysql://mdc2vra001/memsqldb
[info] - application - Creating Pool for datasource 'vertica'
[info] - play.api.db.DefaultDBApi - Database [vertica] connected at jdbc:vertica://mdcvtprod:5433/marsvprod?ResultBufferSize=1048567
[info] - application - Creating Pool for datasource 'db2'
[error] - application - 

! @6pe5dpoi1 - Internal server error, for (GET) [/] ->

play.api.UnexpectedException: Unexpected exception[CreationException: Unable to create injector, see the following errors:

我是Play应用程序开发的新手。任何帮助将非常感谢。

我也尝试了以下但是得到了类似的错误


    db2jcc.jar
    db2jcc_license_cu.jar

我错过了什么? :(

提前感谢任何建议。

-Chandan

1 个答案:

答案 0 :(得分:2)

我猜你错过了这个:

  

引起:java.sql.SQLException:不支持JDBC4 Connection.isValid()方法,必须配置连接测试查询

由于您同时提供JDBC 3.0(db2jcc.jar)和JDBC 4.0(db2jcc4.jar)驱动程序,因此无法保证将加载两个驱动程序中的哪一个。

确保JDBC 4功能仅在类路径中保留db2jcc4.jar