7 Replies Latest reply: Jan 24, 2011 10:18 AM by 612864 RSS

    Server ignoring APP-INF/lib

    819588
      I am attempting to deploy an EAR to use Eclipselink's implementation of JPA 2.0.

      The instructions are provided at [url http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#DI_1.1:_Alternative_3:_Application_Level_Shared_Library_-_In_Use]Eclipselink wiki. This is corroborated on [url http://forums.oracle.com/forums/thread.jspa?threadID=948811]another thread on this forum.

      In short, it includes an APP-INF/lib with a couple of JARs that are referenced in the EAR's manifest.

      However the deploy operation fails with the error
      <Nov 29, 2010 3:56:35 PM EST> <Error> <J2EE> <BEA-160197> <Unable to load descriptor weblogic.utils.classloaders.ChangeAwareClassLoader@23f599 finder:
       weblogic.utils.classloaders.CodeGenClassFinder@c87802 annotation: viporear23@apps/vipor/WEB-INF/lib/_wl_cls_gen.jar!/META-INF/persistence.xml of module apps/vipor. The error is weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND   C:\bea\user_projects\domains\vipor\weblogic.utils.classloaders.ChangeAwareClassLoader@23f599 finder: weblogic.utils.classloaders.CodeGenClassFinder@c87802 annotation: viporear23@apps\vipor\WEB-INF\lib\_wl_cls_gen.jar!\META-INF\persistence.xml:2:3:2:3: problem: cvc-attribute.4: The value '2.0' does not equal the fixed value '1.0' of attribute 'version':<weblogic.utils.classloaders.ChangeAwareClassLoader@23f599 finder: weblogic.utils.classloaders.CodeGenClassFinder@c87802 annotation: viporear23@apps/vipor/WEB-INF/lib/_wl_cls_gen.jar!/META-INF/persistence.xml:2:3>
      The key portion of this error is The value '2.0' does not equal the fixed value '1.0' of attribute 'version'.

      This is exactly the issue I am attempting to correct by creating an EAR and hand-feeding WebLogic the JPA 2.0 JARs. It seems like the JARs in the APP-INF/lib are not being used.

      What am I missing?
        • 1. Re: Server ignoring APP-INF/lib
          612864
          Sri,
          I have this one. Reproducing on 10.3.3.0 - done, reverifying CM and AM workarounds - in progress.
          I will get back to you shortly on the EclipseLink Users post.

          http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg05600.html

          In short for WLS 10.3.3.0 and WLS 10.3.2.0 only:
          1) For an application managed JPA 2.0 persistence unit - follow the instructions to override everything on the server using your EAR (no server modifications)
          http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#DI_1.1:_Alternative_3:_Application_Level_Shared_Library_-InUse

          2) For a container managed JPA 2.0 persistence unit - follow the section that essentially places the JPA 2.0 spec jar above the server-required JPA 1.0 jar (server modifications)

          http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#DI_1.1:_Alternative_2:_Reference_higher_in_the_server_classpath_via_commEnv.cmd

          I will advise when the following...
          Caused By: weblogic.deployment.EnvironmentException: Error loading the persistence descriptor META-INF/persistence.xml from the module org.eclipse.persistence.example.jpa.dataparallel.serviceEJB.jar. See the following stack trace for nested errors: weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND
          C:\wse\wls10330\org.eclipse.persistence.example.jpa.dataparallel.serviceEJB\build\classes\META-INF\persistence.xml:2:3:2:3: problem: cvc-attribute.4: The value '2.0' does not equal the fixed value '1.0' of attribute 'version':<C:\wse\wls10330\org.eclipse.persistence.example.jpa.dataparallel.serviceEJB\build\classes/META-INF/persistence.xml:2:3>

          Works with

          <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">


          thank you
          /michael
          • 2. Re: Server ignoring APP-INF/lib
            612864
            EclipseLink tracking bug for WebLogic proxy factory - discussion, artifacts, wiki links, forensics and configuration continue there.

            http://bugs.eclipse.org/331569

            /thank you
            Michael O'Brien
            • 3. Re: Server ignoring APP-INF/lib
              612864
              Sri,
              I am in the process of updating the tracking bug# 331569 with copies of the eclipse EAR/WAR projects and the EAR for these scenarios. Here are some details on how I got past the 2nd CCE on the org.eclipse.persistence.jpa.PersistenceProvider class you see.
              https://bugs.eclipse.org/bugs/show_bug.cgi?id=331569

              Essentially an SE persistence unit running both JPA 2.0 api and the 2.0 XSD schema work fine. I will next retest the EE case with variations of the 3 types of injection on the SSB or Servlet.
              Update: There are 3 (possibly 4) issues here (all of these may become obsolete when the next WLS version ships)
              Initially I got the same 2.0 schema error and the ClassCastException on org.eclipse.persistence.jpa.PersistenceProvider
              It turns out that my import of the 2 eclipse projects from my bug # 296271 for WebLogic 10.3.2.0 lost their facets(specifically the dynamic web facet) because I associated them with a different WebLogic 10.3.3.0. - this caused the CCE I was experiencing like Sri.
              Anyways, after creating an EAR/Web project combination from scratch in eclipse associated with the 10.3.3.0 instance - I predeployed/deployed/ran fine - even with the 2.0 schema - in SE bootstrap mode (no EE yet).
              Reproduction Procedure:
              redoing project from scratch as I noticed that the war was not at the root of the ear - it was a jar in the app-inf/lib dir - my imported eclipse project was not referenced correctly as a web module facet
              - create empty EAR and WAR project with references
              - download and open my EAR and WAR project code from bug # 296271
              https://bugs.eclipse.org/bugs/show_bug.cgi?id=296271
              - do essentially all the steps in the page below (I paraphrase for re-verification)
              http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#DI_1.1:_Alternative_3:_Application_Level_Shared_Library_-InUse
              - copy applicationService, entity and FrontController servlet code into new projects
              - create persistence.xml and MANIFEST.MF manifest in src\META-INF
              - update manifest
              Class-Path: APP-INF/lib/eclipselink.jar
              APP-INF/lib/javax.persistence_2.0.0.v200911041116.jar

              - copy both javax.persistence 2.0 and eclipselink 2.x jars to APP-INF/lib
              - change ordering of WebLogic library modules classpath reference (javax.persistence 1.0) to ear reference (2.0 version)
              - update web.xml with servlet tags
              - update weblogic.xml with new context root
              - make the persistence unit name the same in persistence.xml and ApplicationManagedService
              - update weblogic-application.xml with prefer-application-packages overrides
              <wls:prefer-application-packages>
              <wls:package-name>javax.persistence.*</wls:package-name>
              <wls:package-name>org.eclipse.persistence.*</wls:package-name>
              </wls:prefer-application-packages>
              - enable server redirect logging
              <!-- new for 10.3.3.0 http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging#Server_Logging -->
              <property name="eclipselink.logging.logger" value="DefaultLogger"/>
              - start WebLogic 10.3.3.0
              - deploy (run on) server from eclipse or export ear to auto deploy directory



              1) JPA 2.0 XSD usage on 10.3.3.0
              - I reproduced this issue with a bad EAR
              - was able to use the 2.0 schema within the WAR-only application managed EAR
              persistence.xml
              <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
              <!-- persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"-->
              <persistence-unit name="example2" transaction-type="JTA">
              <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
              <jta-data-source>localJTA</jta-data-source>
              <class>org.eclipse.persistence.example.business.Cell</class>
              <shared-cache-mode>NONE</shared-cache-mode>
              <properties>
              <property name="eclipselink.target-server" value="WebLogic_10"/>
              <property name="eclipselink.logging.level" value="FINEST"/>
              <property name="eclipselink.target-database" value="Derby"/>
              <!-- new for 10.3.3.0 http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging#Server_Logging -->
              <property name="eclipselink.logging.logger" value="DefaultLogger"/>
              <!-- property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
              <property name="javax.persistence.jdbc.url" value="jdbc:derby://127.0.0.1:1527/dataparallel;create=true"/>
              <property name="javax.persistence.jdbc.user" value="APP"/>
              <property name="javax.persistence.jdbc.password" value="APP"/-->
              <!-- turn off DDL generation after the model is stable -->
              <!-- property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
              <property name="eclipselink.ddl-generation.output-mode" value="both"/-->
              </properties>
              </persistence-unit>
              </persistence>

              2) CCE on JPA provider implementation class
              Error instantiating the Persistence Provider class org.eclipse.persistence.jpa.PersistenceProvider of the PersistenceUnit example2: java.lang.ClassCastException: org.eclipse.persistence.jpa.PersistenceProvider
              - I reproduced and fixed this one (was Eclipse project facet issue) - EAR was wrong
              - was able to run JPA 2.0 code fine on an SE PU (predeploy/deploy together)
              - EE injection should not work but I will post an example EAR anyway
              log
              [EL Example]: enterprise: JPA 2.0 Metamodel: MetamodelImpl@56287508 [ 3 Types: , 1 ManagedTypes: , 1 EntityTypes: , 0 MappedSuperclassTypes: , 0 EmbeddableTypes: ]

              3) CCE on JPA spec interface class
              - I could not reproduce this one
              Re: WebLogic 11g EAR EJB Classpath and class loaders
              Error processing persistence unit PT of module pt: Error instantiating the Persistence Provider class org.eclipse.persistence.jpa.PersistenceProvider of the PersistenceUnit PT: java.lang.ClassCastException: org.eclipse.persistence.jpa.PersistenceProvider cannot be cast to javax.persistence.spi.PersistenceProvider

              4) CCE on fallback Kodo JPA provider (if an invalid say 2.1 JPA XSD schema is referenced)
              java.lang.ClassCastException: kodo.persistence.PersistenceProviderImpl
              at javax.persistence.Persistence.findAllProviders(Persistence.java:186)

              java.lang.NoSuchMethodError: javax/persistence/EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel;

              - reproduced by using the 1.0 javax.persistence jar (but named as the 2.0 one in APP-INF/lib)
              - fixed by using either the 1.0 or 2.0 JPA XSD schema and using the correct 2.0 spec jar

              thank you
              /michael
              • 4. Re: Server ignoring APP-INF/lib
                612864
                Sri,
                See the details surrounding full container managed support for JPA 2.0 deployments on WebLogic 10.3.4 as of 20110115.

                11g Release 1 Patch Set 3 (WLS 10.3.4)
                http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Enabling_JPA2_support

                thank you
                / Michael O'Brien
                http://www.eclipselink.org
                • 5. Re: Server ignoring APP-INF/lib
                  612864
                  Sri,
                  See the details surrounding full container managed support for JPA 2.0 deployments on WebLogic 10.3.4 as of 20110115.

                  11g Release 1 Patch Set 3 (WLS 10.3.4)
                  http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Enabling_JPA2_support

                  thank you
                  / Michael O'Brien
                  http://www.eclipselink.org
                  • 6. Re: Server ignoring APP-INF/lib
                    612864
                    Sri,
                    See the details surrounding full container managed support for JPA 2.0 deployments on WebLogic 10.3.4 as of 20110115.

                    11g Release 1 Patch Set 3 (WLS 10.3.4)
                    http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Enabling_JPA2_support

                    thank you
                    / Michael O'Brien
                    http://www.eclipselink.org
                    • 7. Re: Server ignoring APP-INF/lib
                      612864
                      Sri,
                      See the details surrounding full container managed support for JPA 2.0 deployments on WebLogic 10.3.4 as of 20110115.

                      11g Release 1 Patch Set 3 (WLS 10.3.4)
                      http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Enabling_JPA2_support

                      thank you
                      / Michael O'Brien
                      http://www.eclipselink.org