0

I have a number of JUnit tests in my project that test my DataStore services. For the past two years, they've been working just fine and I've been able to successfully insert, query, and delete entities through unit tests. A couple of days ago I upgraded to App Engine 1.7 and all of a sudden all of my tests throw a NullPointerException because

Persistence.createEntityManagerFactory("transactions-optional") returns null. My persistence.xml file contains the following configuration which like I said, has worked perfectly up until the upgrade.

<persistence-unit name="transactions-optional">
    <provider>org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider</provider> 
    <properties> 
        <property name="datanucleus.NontransactionalRead" value="true"/> 
        <property name="datanucleus.NontransactionalWrite" value="true"/> 
        <property name="datanucleus.ConnectionURL" value="appengine"/> 
    </properties> 
</persistence-unit>

Also, I walked through the GAE testing setup article and I do have all of the required jar files on my class path. Any idea what could have changed in the upgrade?

4

1 回答 1

1

看起来这是一个 Eclipse 或 Google Eclipse 插件问题。在 Project > Properties 中检查了 GAE 设置。我什至检查并取消检查它以确保它已打开。事实上,运行和调试模式可以完美运行,但 JUnit 测试会失败。我只是试图再次解决这个问题,但我注意到 Java 路径中缺少 GWT 和 GAE 库,尽管 Google 设置中的复选框已被选中。很奇怪,但现在 Junit 测试工作了。

于 2012-08-05T00:59:49.240 回答