10 Replies Latest reply: Jul 4, 2011 9:53 AM by 859018 RSS

    WebLogic 10.0 + JPA 2.0 = errors

    782360
      Hi,

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

      Thanks.
        • 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
          Note

          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)
          http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic
          • 2. Re: WebLogic 10.0 + JPA 2.0 = errors
            david.karr
            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
              787175
              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?

              -Fred
              • 4. Re: WebLogic 10.0 + JPA 2.0 = errors
                782360
                Hi,

                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!
                Mihai
                • 5. Re: WebLogic 10.0 + JPA 2.0 = errors
                  748884
                  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"/>
                  </bean>

                  and in weblogic-application.xml:

                  <prefer-application-packages>
                  <package-name>antlr.*</package-name>
                  <package-name>org.apache.commons.*</package-name>
                  <package-name>org.apache.xmlbeans.*</package-name>
                  <package-name>org.springframework.*</package-name>
                  <package-name>org.hibernate.*</package-name>
                  <package-name>javax.persistence.*</package-name>
                  </prefer-application-packages
                  • 6. Re: WebLogic 10.0 + JPA 2.0 = errors
                    david.karr
                    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
                      828503
                      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!
                      Tal.
                      • 8. Re: WebLogic 10.0 + JPA 2.0 = errors
                        612864
                        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.
                        http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html

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

                        In 10.3.3.0 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 10.3.4.0 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 10.3.4.0 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
                        http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Enabling_JPA2_support
                        OTN download
                        http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html
                        Patching
                        http://download.oracle.com/docs/cd/E18476_01/doc.220/e18480/weblogicchap.htm
                        Documentation
                        http://download.oracle.com/docs/cd/E17904_01/web.1111/e13852/toc.htm
                        Supported Oracle WebLogic Server Versions
                        http://download.oracle.com/docs/cd/E15315_06/help/oracle.eclipse.tools.weblogic.doc/html/SupportedServerVersions.html
                        TopLink JPA 2.0 Specific documentation/patching
                        http://download.oracle.com/docs/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309
                        EclipseLink Wiki: JPA 2.0 using EclipseLink on WebLogic analysis (XSD, Weaving, DI of @PersistenceContext)
                        http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Enabling_JPA2_support

                        thank you
                        /Michael O'Brien
                        http://www.eclipselink.org
                        • 9. Re: WebLogic 10.0 + JPA 2.0 = errors
                          872988
                          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,
                          Ben
                          • 10. Re: WebLogic 10.0 + JPA 2.0 = errors
                            859018
                            Ben,
                            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.

                            http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Oracle_WebLogic_Server_10.3.1.0
                            http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/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)
                            http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#DI_1.1:_Alternative_3:_Application_Level_Shared_Library_-InUse
                            http://download.oracle.com/docs/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309

                            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
                            http://www.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
                            http://www.eclipse.org/forums/index.php/m/692428/#msg_692428