Monday, May 4, 2009

Troubleshooting the GAE deployment:

I have alot of issues developing for GAE. So, I'll try to collect the issues I run into for later reference.

Issue: JPA not working.

Possible errors:
  • Query with name "jpa.query.get.user.by.username" was not found!
This one is quite obvious. The datanucleus enhancer has not been run properly on the classes you deploy, hence, it won't work.

Issue: The datanucleus is not running properly.

Possible errors:
  • Encountered a problem: Unexpected exception
    Please see the logs [/tmp/enhance1003542528074135516.log] for further information.

Well, if you check the logs you'll find the problem. Generally, it is because the App Engine datanucleus jar is referenced multiple times in the projekt. Possible sources:
  • The GAE SDK (this is the correct one)
  • war/WEB-INF/lib (the plugin, and maven, may copy the jar here)
  • ~/.m2/repository/???/ (maven handled reference, if you are using it

Issue: Persistence unit does not load

Possible errors:
  • No Persistence provider for EntityManager named transactions-optional

This is because you removed the jar from war/WEB-INF/lib to fix the previous error.

So, how to solve the above evil circle. Well, sometimes eclipse gets the bright idea to reference the "web app libraries", that is the jars in war/WEB-INF/lib. You have to remove that reference from the project build path, it it'll sort of the issues. You can however never reference GAE datanucleus provider in the POM if you are working in Eclipse and have an SDK attached to the project. Unfortunately, you cannot use the plugin to deploy the application if the SDK is not connected...

No comments:

Post a Comment