当我尝试将 Play 2.3 应用程序配置为使用 hikaricp 时,我不断收到以下堆栈跟踪
java.lang.RuntimeException: java.lang.ClassNotFoundException: "com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
com.zaxxer.hikari.util.PoolUtilities.createInstance(PoolUtilities.java:105)
com.zaxxer.hikari.pool.HikariPool.initializeDataSource(HikariPool.java:518)
com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:137)
com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:102)
com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:80)
com.edulify.play.hikaricp.HirakiCPDBApi$$anonfun$1.apply(HirakiCPDBApi.scala:36)
com.edulify.play.hikaricp.HirakiCPDBApi$$anonfun$1.apply(HirakiCPDBApi.scala:32)
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
scala.collection.immutable.Set$Set1.foreach(Set.scala:79)
scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
scala.collection.AbstractSet.scala$collection$SetLike$$super$map(Set.scala:47)
scala.collection.SetLike$class.map(SetLike.scala:92)
scala.collection.AbstractSet.map(Set.scala:47)
我的 build.sbt 包含 mysql-connector,它应该在类路径中
name := """myapp"""
version := "2.3-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.1"
resolvers += Resolver.url("Edulify Repository", url("http://edulify.github.io/modules/releases/"))(Resolver.ivyStylePatterns)
libraryDependencies ++= Seq(
javaCore,
"mysql" % "mysql-connector-java" % "5.1.18",
javaJdbc,
"org.codehaus.jackson" % "jackson-mapper-asl" % "1.9.13",
"com.lowagie" % "itext" % "2.1.7",
"net.sf.jasperreports" % "jasperreports" % "5.2.0",
"org.mindrot" % "jbcrypt" % "0.3m",
javaEbean,
cache,
javaWs,
"com.edulify" %% "play-hikaricp" % "1.4.1"
)
这也是我的 conf/play.plugins 文件:
200:com.edulify.play.hikaricp.HikariCPPlugin
任何帮助,将不胜感激
〜尼克