This content has been marked as final. Show 1 reply
My understanding from http://wiki.eclipse.org/EclipseLink/Examples/JPA/Tomcat_Web_Tutorial was that Tomcat was not a Java EE 5 compatible server. This means that Tomcat isn't creating the EMF for the application, and so there is no way for the provider to register the ClassTransformer used for weaving with the application classloader before it has loaded the application entity classes. Placing the agent and persistence unit on the classpath of the server only registers the transformer with the server classloader, not the classloader that gets used to load the application.
I don't know anyone to look to far into it or how far they got before deciding just to use static weaving. You might also be able to use Spring with in Tomcat as the JPA container and configure Tomcat to use its custom application classloader - which it can then be instrumented with a transformer for weaving as described here:
If you are interested, if it works with Spring using a custom classloader it should be possible, but I don't know Tomcat or Spring internals to be of much assistance. If you decide to look into it, see the EclipseLink PersistenceProvider class createContainerEntityManagerFactory method for what containers call to get the transformer to register with the classloader.