openJPA on Java SE

无人久伴 提交于 2019-12-04 07:14:05

Just a pointer: You need to enhance your classes e.g. at runtime via -javaagent:yourlib.jar or even while compiling. You could learn more on this topic here:

"The second and recommended way get runtime enhancement is to provide a javaagent when launching the JVM that OpenJPA is going run in."

I just went through the exercise of getting OpenJPA 2.1.0 to run on Tomcat 7.0. I was simply unable to get run-time enhancement to work under Tomcat so I gave up and decided to use build-time enhancement. I am developing my code under Eclipse so I followed the instructions here:

http://openjpa.apache.org/enhancement-with-eclipse.html

Note however that the instructions on this page are for generic java projects. If you are working with Dynamic Web Projects, be sure to specify the build directory argument correctly. I used -Dbuild.dir=build/classes which is the typical location for the compiled code.

One more annoying quirk you have to live with. You must manually invoke the builder using the "Project > Build Project" menu item. When the enhancer runs, it modifies the previously built classes. Consequently, you need to hit F5 or Refresh for the project before you publish to Tomcat.

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