我的团队使用datanucleus库进行客户端 - 服务器应用程序。我们使用的是3.0.0版。 我们可以通过NetBeans成功构建应用程序。问题是,当运行服务器端应用程序时,我们遇到了这个错误:
Exception in thread "main" javax.jdo.JDOFatalUserException: Class org.datanucleus.jdo.JDOPersistenceManagerFactory was not found.
抛出异常的代码行:
mPMF = JDOHelper.getPersistenceManagerFactory(Utilities.SERVER_JDO_CONFIG_FILE);
我们已经包含了datanucleus-api-jdo-3.0.0-release.jar,它确实包含了麻烦的org.datanucleus.jdo.JDOPersistenceManagerFactory,因此我们不知道这里出了什么问题。
之前有人经历过这个吗? 谢谢。
答案 0 :(得分:0)
如果您使用的是SBT,请连接以下设置......
val deps_database : Seq[Setting[_]] =
Seq(
libraryDependencies ++= Seq(
"javax.jdo" % "jdo-api" % "3.1",
"org.datanucleus" % "datanucleus-core" % "4.0.6", //TODO:: Versions.datanucleus,
"org.datanucleus" % "datanucleus-api-jdo" % "4.0.5",
"org.datanucleus" % "datanucleus-jdo-query" % "4.0.4",
"org.datanucleus" % "datanucleus-rdbms" % "4.0.11",
"org.datanucleus" % "datanucleus-mongodb" % "4.0.5",
"com.h2database" % "h2" % "1.4.185",
"org.mongodb" % "mongo-java-driver" % "2.1.3",
"org.postgresql" % "postgresql" % "1.4-1200-jdbc41" ))
...在您的项目或子模块中,如下所示:
lazy val root =
project.in(file("."))
.settings(buildInfoSettings:_*)
.settings(disablePublishing:_*)
.aggregate(model, data, headless)
lazy val util =
project.in(file("util"))
.settings(publishSettings:_*)
.settings(librarySettings:_*)
.settings(paranoidOptions:_*)
.settings(otestFramework: _*)
.settings(deps_resolvers:_*)
.settings(deps_essential:_*)
lazy val model =
project.in(file("model"))
.settings(publishSettings:_*)
.settings(librarySettings:_*)
.settings(paranoidOptions:_*)
.settings(otestFramework: _*)
.settings(deps_resolvers:_*)
.settings(deps_essential:_*)
.settings(deps_database:_*)
.settings(managedSources:_*)
上看到完整的示例