问题
I'm using the Eclipselink bundles from Springsource (version 1.1.0) inside Apache Felix. My (JPA annotated) entity classes get persisted etc., so the basic mechanism works. However, I'm doubting that bytecode weaving is done.
How can I verify if Eclipselink uses weaving on my classes?
Is weaving generally supported when running in Felix? I didn't change anything about my configuration or startup scripts, do I have to?
回答1:
See Eclipse docs - bottom of page;
import org.eclipse.persistence.internal.helper.Helper;
import org.eclipse.persistence.internal.weaving.PersistenceWeaved;
...
if (Helper.classImplementsInterface(MyEntity.class, PersistenceWeaved.class)) {
// MyEntityEntity successfully woven!
...
回答2:
I can see two methods of determining if dynamic weaving is enabled:
set the Log level of EclipseLink in the
persistence.xml
toFINEST
and you'll see in the logs during the initialization of theEntityManagerFactory
/PersistenceUnit
if weaving will be used or not.Identify the jvm process which serves your application. Use OS tools or javatools like jconsole/jvisualvm to determine the command line. If you can spot the eclipselink agent (
-javaagent:eclipselink.jar
) in the vm arguments, dynamic weaving is enabled - otherwise not.
回答3:
I would recommend you use static weaving in this environment.
来源:https://stackoverflow.com/questions/6109858/does-eclipselink-use-dynamic-bytecode-weaving-under-apache-felix