Junit EntityManager NullPointerException with 1.7 Upgrade

128 views
Skip to first unread message

Casey

unread,
Jul 7, 2012, 1:01:12 PM7/7/12
to google-a...@googlegroups.com
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>


Any idea what could have changed in the upgrade?

Takashi Matsuo

unread,
Jul 7, 2012, 5:09:30 PM7/7/12
to google-a...@googlegroups.com

Hi Casey,

Have you tried 'Project' -> 'Clean...'?

If it doesn't help, can you file an issue with the reproducible code snippet or project itself?

Thanks,

-- Takashi


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/FWYSUvA-Qx4J.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.



--
Takashi Matsuo

Casey

unread,
Aug 4, 2012, 8:59:04 PM8/4/12
to google-a...@googlegroups.com
It looks like this was an Eclipse or Google Eclipse plugin issue. In the Project > Properties the GAE setting was checked. I even checked and unchecked it to make sure it was turned on. And in fact run and debug modes would work perfectly but the JUnit tests would fail. I just attempted to fix the issue again and I noticed that both the GWT and GAE libraries were missing from the Java path despite the fact that the check boxes in the Google settings were checked. Very weird but now the Junit tests work. 
Reply all
Reply to author
Forward
0 new messages