Upgrading to Google App Engine Java SDK 1.2.8

December 7th, 2009 by Tahir Akram Leave a reply »

I was getting following exception while trying to code my first interaction with JPA in Google App Engine.

org.datanucleus.metadata.InvalidMetaDataException:
Error in MetaData for field "user" in class "com.engineplay.datastore.pojos.UserPrefs" : this is declared as com.google.appengine.api.users.User with "persistence-modifier=none" yet has either "default-fetch-group=true" or "primary-key=true" specified! These should be false.

After some searching I came to know that I should upgrade my App Engine SDK. To get datanucleus-enhancer-1.1.4.jar. But when I upgraded my SDK from 1.2.0 to 1.2.8. I got following exception.

java.lang.RuntimeException: Unable to locate the App Engine agent. Please use dev_appserver, KickStart,  or set the jvm flag: "-javaagent:<sdk_root>/lib/agent/appengine-agent.jar"
at com.google.appengine.tools.development.DevAppServerFactory.testAgentIsInstalled(DevAppServerFactory.java:102)
at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:77)
at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:38)
Caused by: java.lang.NoClassDefFoundError: com/google/appengine/tools/development/agent/AppEngineDevAgent
at com.google.appengine.tools.development.DevAppServerFactory.testAgentIsInstalled(DevAppServerFactory.java:98)
... 6 more
Caused by: java.lang.ClassNotFoundException: com.google.appengine.tools.development.agent.AppEngineDevAgent
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
... 7 more

I got two problems to fix. First the JPA enhancer was not working and second I was unable to start my server through Eclipse.

Running the server was looking straight forward from the exception that I need to add extra VM arguments for all of my applications. Remember this, your previous application will not work unless you add these VM arguments seprately in their launcher configurations.

Following are the steps to do that.

1. Right click the project and select Run As –> Open Run Dialog.

gae-add-vm-arguments

2. Copy the message which you are getting in exception. This is exactly the same that we need to add in VM arguments section. The only addition we need to do is to add our SDK path.

gae-added-vm-arguments

3. Now if you run or debug your project. You server will run perfectly.

gae-server-run-success

4 comments

  1. Govind says:

    Many thanks I was also getting this.

  2. Tahir Akram says:

    You welcome Govind. I am happy it helps you. :)

  3. Sivaram says:

    Thanks this s really helpful. Great work dude.

Trackbacks /
Pingbacks

  1. pligg.com

Leave a Reply