gwt从2.7升级到2.8.1获取异常未找到DatastoreJDOPersistenceManagerFactory类

时间:2017-05-12 12:29:00

标签: java google-app-engine gwt jdo

我用gwt开发应用程序 我尝试从gwt 2.7升级到2.8.1,并在创建PersistenceManagerFactory时遇到异常 我使用谷歌应用引擎1.9.51 这是我创建PersistenceManagerFactory

的代码
public final class PMF {

    private static PersistenceManagerFactory pmfInstance;

    static {
        Map<String,String> props = new HashMap<>();
        props.put("javax.jdo.PersistenceManagerFactoryClass", "org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory");
        props.put("javax.jdo.option.ConnectionURL", "appengine");
        props.put("javax.jdo.option.NontransactionalRead", "true");
        props.put("javax.jdo.option.NontransactionalWrite", "true");
        props.put("javax.jdo.option.RetainValues", "true");
        props.put("datanucleus.appengine.autoCreateDatastoreTxns", "true");
        pmfInstance = JDOHelper.getPersistenceManagerFactory(props);
    }
   // private static final PersistenceManagerFactory pmfInstance = JDOHelper.getPersistenceManagerFactory( "transactions-optional" ) ;
    private PMF() {
    }

    public static PersistenceManagerFactory get() {
        return pmfInstance;
    }
}

这是我得到的例外

javax.jdo.JDOFatalUserException: Class org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory was not found.|NestedThrowables:|java.lang.ClassNotFoundException: org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory
    at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1175)
    at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
    at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:701)
    at com.darimpo.server.persist.PMF.<clinit>(PMF.java:25)
    at com.darimpo.server.managers.BuildingsManager.getBuildingPlaces(BuildingsManager.java:654)
    at com.darimpo.server.servlets.GreetingServiceImpl.pullBuildingPlaces(GreetingServiceImpl.java:378)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:587)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:333)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:303)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:373)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:95)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)

这是我的类路径

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" output="target/test-classes" path="test">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="com.gwtplugins.gwt.eclipse.core.GWT_CONTAINER"/>
    <classpathentry kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER"/>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/commons-fileupload-1.3.2.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/commons-io-2.5.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/dropbox-core-sdk-V2.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/gagawa-1.0.1.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/GWT FX v0.5.0 MS 1.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/gwt-charts-0.9.10.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/gwt-visualization.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/gwtbootstrap3-0.9.3.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/gwtexporter-2.5.0-SNAPSHOT.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/gwtphonegap-3.5.0.1.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/jackson-annotations-2.7.0.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/jackson-core-2.7.0.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/jackson-databind-2.7.0.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/jxl.jar"/>
    <classpathentry kind="lib" path="/Users/gallavie/Documents/workspace/Darimpo/jars/mgwt-2.0.0.jar"/>
    <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>

我能做些什么来解决这个问题 谢谢

1 个答案:

答案 0 :(得分:0)

提供简单答案的选项太多了。 可能你最好的解决方案是去datanucleus网站并按照他们的&#34;入门&#34;说明。我的立场得到了纠正。道歉。