10 Replies Latest reply on Jul 4, 2011 2:53 PM by 859018

    WebLogic 10.0 + JPA 2.0 = errors


      Is there a known way to add support for JPA 2.0 in Weblogic 10.0?

        • 1. Re: WebLogic 10.0 + JPA 2.0 = errors
          user161771 - oracle
          Please see document ID 1091853.1 on support.oracle.com


          Questions and Answers

          Does WebLogic Server 10.3 provide full support for JPA 2.0?

          No! WebLogic Server 10.3.x is compliant to the Java EE 5 specification which includes EJB 3.0 Java Persistence (JPA 1.0). WebLogic Server 10.3.x has the generic Java archive (persistence.jar) with the JPA 1.0 API interfaces on a very deep level of the class loading hierarchy. This persistence.jar library does define the JPA API support that is available.

          Though WebLogic Server 10.3.2 ships with EclipseLink 1.2.0, which has JPA 2.0 preview support, and WebLogic Server 10.3.3 ships with EclipseLink 2.0.2, which is JPA Provider fully compliant to JPA 2.0 final, only the JPA 1.0 API is available.

          However, there are JPA 2.0 features that do not require new API defined in JPA 2.0. Such features can be used :

          New mappings if the XML mapping descriptor is used instead of mapping annotations for such mappings.
          New features of JP QL.
          Semantic changes of existing JPA 1.0 API
          e.g. JPA 2.0 Criteria API is not supported in current patch levels of WebLogic Server 10.3 (10.3.0, 10.3.1, 10.3.2, 10.3.3) because it requires a new API defined in JPA 2.0

          The following page on the EclipseLink site explains approaches that make JPA 2.0 API available on current patch levels of WebLogic Server 10.3. Oracle considers an environment configured according to such approaches as not supported!

          Running JPA 2.0 API on WebLogic 10.3 (Not Supported)
          • 2. Re: WebLogic 10.0 + JPA 2.0 = errors
            As I've recently struggled with the same question, I found out from Oracle Support that the upcoming WebLogic 10.3.4 will supposedly have full support for JPA 2.0. I was attempting to do this with OpenJPA 2.x, so I'm hoping I won't have any additional obstacles when we finally get 10.3.4 installed.
            • 3. Re: WebLogic 10.0 + JPA 2.0 = errors
              any sort of ETA on when openjpa 2.0.0 will be supported?
              You say WL 10.3.4, but when (days/weeks/months)?
              Has anyone discovered a workaround untill then?

              I have seen
              [http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#DI_1.1:_Solution|this] ... but it seems very sketchy...
              Does it work for openjpa 2.0.0?

              • 4. Re: WebLogic 10.0 + JPA 2.0 = errors

                I've solved this problem prefixing the WEBLOGIC_CLASSPATH with the JPA 2.0 jar (@see "commEnv.cmd" file). Now, I'm trying to
                not touch this file and add JPA2 support using an EAR (instead of WAR). If you have any suggestions, please reply.

                Best regards!
                • 5. Re: WebLogic 10.0 + JPA 2.0 = errors
                  well, the thread is a bit old, but if anybody is still struggling with jpa2 an wls 10.3, here is a simple solution: The problem can be fixed if you rename persistence.xml to some other name, say foo.xml and thus bypassing weblogic autodiscovery. I dit it with spring 3.0.4 (spring <3 don't work)

                  <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
                  <property name="dataSource" ref="dataSource"/>
                  <property name="persistenceUnitName" value="foo"/>
                  <property name="persistenceXmlLocation" value="classpath:META-INF/foo.xml"/>

                  and in weblogic-application.xml:

                  • 6. Re: WebLogic 10.0 + JPA 2.0 = errors
                    That's astounding. Considering all the pain I and other people have had trying to get JPA 2.0 to work in WL 10.3.x, you're saying that it works perfectly fine if you just use a different name than "persistence.xml"? Did you make any other tweaks besides those settings in your weblogic-application.xml?

                    What exact minor version of WebLogic are you using? I had heard that 10.3.4 would be the first version that officlally supports JPA 2.0. It doesn't appear to be out yet.
                    • 7. Re: WebLogic 10.0 + JPA 2.0 = errors
                      Hi all,
                      Does it mean that we can work with HIbernate on Weblogic without Spring?
                      in case it is possible - can someone please let me know how? We keep getting errors while deploying the EAR file.

                      thanks in advance!
                      • 8. Re: WebLogic 10.0 + JPA 2.0 = errors
                        See the recent OTN post from 20110115 detailing the latest release of Oracle WebLogic Server and some retesting of the previous issues related to JSR-317 JPA 2.0 support below.
                        Re: Deploy Hibernate based EAR file on Weblogic 10.3.3?
                        The latest release of Oracle WebLogic Server has been available on OTN at the following location since 20110115.

                        This release provides support for JSR-317 JPA 2.0 container managed applications using the QWG8 patch or a manual prepending classpath change.

                        In you were required to use the FilteringClassLoader via the *<wls:prefer-application-packages>* addition to your application managed persistence unit - this workaround as well as the persistence.xml renaming one is now fully deprecated and not required in for both application and container managed persistence contexts.
                        As of 20110115 the 5 outstanding issues below look to be fixed by applying the http://download.oracle.com/docs/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309 patch for QWG8 or manually prepending to the WebLogic server classpath.
                        commEnv.cmd: line 67
                        @rem Set BEA Home
                        set BEA_HOME=C:\opt\wls1034r20110115
                        @rem Enable JPA 2.0 functionality on WebLogic Server 10.3.4 with the following patch line for commEnv.cmd:67
                        set PRE_CLASSPATH=%BEA_HOME%\modules\javax.persistence_1.0.0.0_2-0-0.jar;%BEA_HOME%\modules\com.oracle.jpa2support_1.0.0.0_2-0.jar
                        A JPA 2.0 EE application using EclipseLink as the JPA2 persistence provider on WebLogic is detailed in the analysis section below
                        1) JPA 2.0 XSD parsing - verified
                        2) New JPA 2.0 schema elements like <shared-cache-mode>NONE</shared-cache-mode> - verified
                        3) JPA 2.0 runtime API like a entityManager.getMetamodel(); call on the Servlet or Stateless session bean - verified
                        4) JPA 2.0 weaving/instrumentation - this will require a more detailed lazy model and more debugging to fully verify
                        5) Dependency Injection of a container managed JPA 2.0 entityManager on a EJB component like a stateless session bean - verified
                        OTN download
                        Supported Oracle WebLogic Server Versions
                        TopLink JPA 2.0 Specific documentation/patching
                        EclipseLink Wiki: JPA 2.0 using EclipseLink on WebLogic analysis (XSD, Weaving, DI of @PersistenceContext)

                        thank you
                        /Michael O'Brien
                        • 9. Re: WebLogic 10.0 + JPA 2.0 = errors
                          Hi Michael,

                          Your depth of information in this post is superb. Thank you.

                          However, most of the hope for getting JPA 2.0 provider=EclipseLink rests with using WebLogic 10.3.4 other 10.3.x versions face much tougher challenges.

                          I am using WLS 10.3.1. My problem is best described here http://www.eclipse.org/forums/index.php/m/692428/#msg_692428

                          Is there any hope for getting JPA 2.0 provider=EclispeLink working on WLS 10.3.1?

                          IMPORTANT: I would have to get it working without modifying WLS 10.3.1 server instance's global settings (i.e. CLASSPATH, etc)

                          THanks Michael,
                          • 10. Re: WebLogic 10.0 + JPA 2.0 = errors
                            Unfortunately, prior to WebLogic 10.3.4 you only have application managed persistence available for JPA 2.0. My page below details what can be done for older versions of WebLogic.


                            The issue with injection/instrumentation/proxying of a container managed JPA 2.0 @PersistenceContext is that the DI code in WebLogic needs to be aware of the JPA 2.0 EM and EMF (the 10.3.1 API was not forward compatible - you would need to hack the Spring based AOP injection code and the referenced EMFProxyImpl areas - and partiallly upgrade in effect to 10.3.4).
                            See the following patch to the 20110115 initial release for the code changes related to (XSD, weaving and injection)

                            Note: if you don't require the JPA 2.0 additions to the persistence schema like shared-cache-mode NONE then use the 1.0 xsd to avoid the parse error.

                            thank you
                            Michael O'Brien
                            michael.f.obrien at eclipselink.org

                            cross references
                            WebLogic 10.0 + JPA 2.0 = errors
                            new app .ear with JPA 2.0 provider=eclipseLink deployed to WLS 10.3.1