2

我的团队将 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,所以我们不知道这里出了什么问题。

以前有人经历过吗?之前谢谢。

4

1 回答 1

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:_*)

您可以在以下位置查看完整示例:http: //github.com/frgomes/poc-scala-datanucleus

于 2015-06-05T22:36:44.333 回答