Does Eclipselink use (dynamic) bytecode weaving under Apache Felix?

萝らか妹 提交于 2019-12-11 10:43:14

问题


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:

  1. set the Log level of EclipseLink in the persistence.xml to FINEST and you'll see in the logs during the initialization of the EntityManagerFactory/PersistenceUnit if weaving will be used or not.

  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!