Hi all,

I am using grails 1.3.5 and the latest app-engine and gorm-jpa
plugins. I created a User class and a UserIntegrationTest to test it.
However, I am getting a error in the reports:
****
Could not open JPA EntityManager for transaction; nested exception is
java.lang.NullPointerException: No API environment is registered for
this thread.

org.springframework.transaction.CannotCreateTransactionException:
Could not open JPA EntityManager for transaction; nested exception is
java.lang.NullPointerException: No API environment is registered for
this thread.
Caused by: java.lang.NullPointerException: No API environment is
registered for this thread.
        at
com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:
108)
        at
com.google.appengine.api.datastore.BaseDatastoreService.beginTransaction(BaseDatastoreService.java:
125)
        at
org.datanucleus.store.appengine.RuntimeExceptionWrappingDatastoreService.beginTransaction(RuntimeExceptionWrappingDatastoreService.java:
209)
        at
org.datanucleus.store.appengine.jpa.DatastoreEntityTransactionImpl.begin(DatastoreEntityTransactionImpl.java:
49)
        at _GrailsTest_groovy$_run_closure4.doCall(_GrailsTest_groovy:
269)
        at _GrailsTest_groovy$_run_closure4.call(_GrailsTest_groovy)
        at _GrailsTest_groovy$_run_closure2.doCall(_GrailsTest_groovy:
226)
        at _GrailsTest_groovy
$_run_closure1_closure21.doCall(_GrailsTest_groovy:185)
        at _GrailsTest_groovy$_run_closure1.doCall(_GrailsTest_groovy:
172)
        at TestApp$_run_closure1.doCall(TestApp.groovy:101)
        at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
        at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
        at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
        at gant.Gant.withBuildListeners(Gant.groovy:427)
        at gant.Gant.this$2$withBuildListeners(Gant.groovy)
        at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown
Source)
        at gant.Gant.dispatch(Gant.groovy:415)
        at gant.Gant.this$2$dispatch(Gant.groovy)
        at gant.Gant.invokeMethod(Gant.groovy)
        at gant.Gant.executeTargets(Gant.groovy:590)
        at gant.Gant.executeTargets(Gant.groovy:589)
****

Domain class is defined as:

package com.jothub

import javax.persistence.*;
// import com.google.appengine.api.datastore.Key;

@Entity
class User implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    Long id

    static constraints = { id visible:false }

    @Basic
    String emailAddress;

    @Basic
    String password;

}

The Test is defined as:

package com.jothub

import grails.test.*

class UserIntegrationTests extends GrailsUnitTestCase {
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testFirstSave() {
        User user = new User(emailAddress: '[email protected]', password:
'secret')
        assertNotNull user.save()
        assertNotNull user.id

        User foundUser = User.get(user.id)
        assertEquals '[email protected]', foundUser.emailAddress
    }

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to