How to enable JPA 2.0 on Weblogic

I am experimenting with JPA 2.0 using eclipselink. When I tried to call my webservice, weblogic thrown a nasty error reporting “unknown method” when trying to call EntityManager method.

Well I asked google … it seems that Weblogic is shipped with JPA 1.0 by default. The official doccumentation on weblogic is confusing and provides code which is too complicated for what it really does. All you really to do is modify startWebLogic.cmd file:


and add to beginning:

SET wls_modules=c:\Oracle\Middleware\modules\
set PRE_CLASSPATH=%wls_modules%javax.persistence_1.0.0.0_2-0-0.jar;
Be sure to use your paths. Restart weblogic and you are good to go.