| Re: [eclipselink-users] Problems with Eclipselink 2 (JPA 2.0) & WebLogic 10 |
|
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_-_In_Use - 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 http://forums.oracle.com/forums/thread.jspa?messageID=3946206� 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 Michael O'Brien wrote: Sri, |