OpenJPA, Tomcat6, Spring and Hibernate
Getting all of the above to play together can be tricky. I knocked myself offline for nearly 2 days after the latest upgrade.
The sysdeo Tomcat plugin no longer works when my testapp is installed – the log says the WebAppClassLoader (todo: check name) cannot be found. Something’s messed up the core Tomcat classpath. Fortunately the stand-alone remote debug option still works.
Annotations and Weaving
The test app is using Java 5 annotations on the persistent classes. Persistent classes are “magic”. Before they can actually be used, they have to be re-written to add the additional properties that aid the persistency manager. In the Old Days, that would have meant using some sort of utility that added additional source text to the persistent classes before they were compiled. In our new, more transparent era, this means that after the java source is compiled into classes, the extra embellishments are added to the binary class definition.
There’s 2 ways to do that:
- Permanently modify the class binary file
- Piggyback the embellishments onto the class as it’s being loaded into the JVM.
When I used JDO – and in early OpenJPA, option 1 was used courtesy of a utility known as the enhancer.
Since about October 2007 (give or take), OpenJPA has had the ability to do on-the-fly enhancement, which is option 2 or some facsimile thereof. But there’s a catch.
In order to