Friday, July 31, 2009

I am working on a private project these days. It should give myfear.com and myfear.de a new meaning. Therefore I am trying out Google's Appengine.Beeing forced to more or less full blown JEE5 in my dayly work, I wanted to try out something new. Having worked with older Spring versions some time ago, I feelt it was time to give this another shot. And so I ended up, trying Spring's newest milestone release on the GAE.

At the end of the day, I solved many problems on the road and everything worked fine. Here is a brief summary of what I had to change/find out:

1) GAE does not support full blown JEE. Therefore you have to be very sensible for using the right combination of technologies. If you try to use spring completely you will fail. The following list of jar files did the job for me:antlr-3.0.1.jaraopalliance-1.0.jarasm-2.1.jarasm-commons-2.1.jarcommons-beanutils-1.7.0.jarcommons-collections-3.1.jarcommons-lang.jarcommons-logging.jarorg.springframework.aop-3.0.0.M3.jarorg.springframework.asm-3.0.0.M3.jarorg.springframework.aspects-3.0.0.M3.jarorg.springframework.beans-3.0.0.M3.jarorg.springframework.context-3.0.0.M3.jarorg.springframework.core-3.0.0.M3.jarorg.springframework.expression-3.0.0.M3.jarorg.springframework.jdbc-3.0.0.M3.jarorg.springframework.orm-3.0.0.M3.jarorg.springframework.transaction-3.0.0.M3.jarorg.springframework.web-3.0.0.M3.jarorg.springframework.web.servlet-3.0.0.M3.jar

2) Setting up the persistance.xml is straight forward but remember to rename the persistance-unit in jdoconfig.xml. Both should have different names!

5) If you try to use the injected entityManager without any transaction, then you would most likely get an NucleusUserException: Object Manager has been closed. You can prevent this, using @Service and @Transactional in your service layer.

6)Nearly the same could happen, if you do not call queryResult.size() on your query.getResultList(). The error was reported several times. There seems to exist only this "workaround".

7) Using EL Expressions in your JSP forces you to use a little addon to the jsp page definition: