Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Problems with Eclipselink 2 (JPA 2.0) & WebLogic 10

Sri,
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.
http://forums.oracle.com/forums/thread.jspa?messageID=9288278?

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.
%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

On 07/12/2010 12:44, Michael O'Brien wrote:
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&#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,
    I am off today, however there is a workaround you can do.
    Do you need the new JPA 2.0 XSD elements/attributes - like <shared-cache-mode>NONE</shared-cache-mode>?
    If not(likely) - then just use the JPA 1.0 schema namespace in your persistence.xml.  JPA 2.0 implementation runs independent of the 1.0/2.0 version on the persistence header.
    Why? Everything in EclipseLink 2.0 that implements JPA 2.0 except support for the above mentioned 2.0 XSD schema changes are in the eclipselink.jar (modules/org.eclipse.persistence_1.0.0.0_2-0.jar on the server) so you can do all things JPA 2.0 like the Criteria and Metamodel API's for example.  These JPA 2.0 API implementations will work fine with the JPA 1.0 XSD schema header.  You can use the standard WebLogic tutorial page for details on this.
http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Persistence.xml
    This will get you to the same point as the JPA 2.0 Metamodel test screen cap at
http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Output_1.3

    You can still choose to run your eclipselink.jar in EAR, or use the EclipseLink 2.0 one on the server for CM apps if you run on WLS 10.3.3.0 (as long as the JPA 2.0 spec jar is available as well)

    thank you
    /michael

On 2010-12-01 10:31, Sri Sankaran wrote:

Similar (but not same) error on WebLogic 10.3.3.0

 

Error processing persistence unit GporsPU of module apps/vipor: Error instantiating the Persistence Provider class org.eclipse.persistence.jpa.PersistenceProvider of the PersistenceUnit GporsPU: java.lang.ClassCastException: org.eclipse.persistence.jpa.PersistenceProvider cannot be cast to javax.persistence.spi.PersistenceProvider

 

It used to be (with WebLogic 10.0)

Error processing persitence unit GporsPU of module apps/vipor: Error instantiating the Persistence Provider

class org.eclipse.persistence.jpa.PersistenceProvider of the PersistenceUnit GporsPU: java.lang.ClassCastException: org.eclipse.persistence.jpa.PersistenceProvider

 

 

Sri

 

From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Michael O'Brien
Sent: Tuesday, November 30, 2010 1:33 PM
To: EclipseLink User Discussions
Subject: Re: [eclipselink-users] Problems with Eclipselink 2 (JPA 2.0) & WebLogic 10

 

Sri,
    May be.  The instructions are written for 10.3.2.0 and 10.3.3.0 (I have worked with WLS back to 10.3.0 in 2007 but not an earlier 10.0 version using a JPA 1.0 application).
    If there is a way you could try on a later server version - ideally 10.3.3.0 this may help.

http://www.oracle.com/technetwork/middleware/weblogic/downloads/index.html

    All the steps (the manifest as well as the prefer-application-packages element) in alternative #3 must be done in order to override the modules jars with the ones in your EAR/APP-INF/lib

    thank you
    /michael

Sri Sankaran wrote:

Michael:

  Thanks for the response.  I have seen your previous posts on this topic and followed the instructions you have cited (for application managed JPA 2.0).

 

  Yet I am having this problem.  Could it have to do with the fact that I am on WebLogic server 10.0?  Are the instructions different for it?

 

Sri

 

From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Michael O'Brien
Sent: Tuesday, November 30, 2010 12:35 PM
To: EclipseLink User Discussions
Subject: Re: [eclipselink-users] Problems with Eclipselink 2 (JPA 2.0) & WebLogic 10

 

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 this forum.

    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_-_In_Use

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

Sri Sankaran wrote:

I am having no luck deploying my application that uses JPA 2.0 API to a WebLogic 10 instance.

 

The application is deployed as an EAR as explained in the Eclipselink wiki.  The error I see at startup suggests that WebLogic is continuing to use its (internal) JPA 1.0.  The error is:

 

<Nov 30, 2010 10:46:03 AM EST> <Error> <J2EE> <BEA-160197> <Unable to load descriptor weblogic.utils.classloaders.ChangeAwareClassLoader@64bc1e finder

: weblogic.utils.classloaders.CodeGenClassFinder@ed053a 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

        at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:234)

        at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:221)

        at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:146)

 

It is almost as if WebLogic is ignoring JARs in the APP-INF/lib directory of the EAR. 

 

If I were to downgrade my persistence.xml to version 1.0, the above error is replaced by a ClassCastException

 

<Nov 30, 2010 10:57:30 AM EST> <Error> <Deployer> <BEA-149205> <Failed to initialize the application 'viporear23' due to error weblogic.application.ModuleException: .weblogic.application.ModuleException:

        at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:317)

        at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)

        at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)

        at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:360)

        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)

        Truncated. see log file for complete stacktrace

weblogic.deployment.EnvironmentException: Error processing persitence unit GporsPU of module apps/vipor: Error instantiating the Persistence Provider

class org.eclipse.persistence.jpa.PersistenceProvider of the PersistenceUnit GporsPU: java.lang.ClassCastException: org.eclipse.persistence.jpa.PersistenceProvider

        at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:258)

        at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:110)

        at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:316)

        at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptors(AbstractPersistenceUnitRegistry.java:96)

        at weblogic.deployment.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:53)

        Truncated. see log file for complete stacktrace

 

I realize that this is not an Eclipselink problem per se.  I am writing in the hope that al fellow subscriber to this list has encountered this problem and has a workaround.  I have posted this issue to Oracle’s WebLogic forum as well.

 

Sri

 

   
 
   
_______________________________________________  
eclipselink-users mailing list  
eclipselink-users@xxxxxxxxxxx  
https://dev.eclipse.org/mailman/listinfo/eclipselink-users  
    

 

   
 
   
_______________________________________________  
eclipselink-users mailing list  
eclipselink-users@xxxxxxxxxxx  
https://dev.eclipse.org/mailman/listinfo/eclipselink-users  
    

 

_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top