Spring2.5 + Weblogic 10.1 + JPA (Kodo) = UnexpectedRollbackException
Hi,
I'm facing a strange problem when creating a sample JPA application using Spring 2.5 and Weblogic 10.1.
The example consists of 2 entities, Team and Player. All works well with simple attributes, and with a OneToOne relation between Team and Player.
However, configuring a OneToMany relation from team to player (squad), and adding 2 players to the squad causes an UnexpectedRollbackException caused by a Weblogic RollbackException. It tells you to look for the nested exceptions, but they are nowhere to be found (domain log, server log, log4j log)
The same annotations, but used with hibernate and managing tx myself works perfect.
I provide the code and config below, if more is needed just shout.
Any ideas?
After I turned kodo logging on, I noticed tha 3 insert statements are inserted for players (although there are only 2)
Code and a previous discussion are available on [url http://forum.springframework.org/showthread.php?t=49018]. As the format there is very readable, and to avoid mistakes I post a link here, and not the full source again B-)
Ideas? Hints? Tips?
Thanks,
Nico
Hi,
In the mean time we identified the culprit.
The problem was caused because there was a foreign key on the database between Player and Team. Apparently, Kodo does not always perform the inserts in the "correct" order, and then you bump into a referential constraint error of course. (found this because a colleague could not reproduce the problem...his DB was created by the Mappingtool, which just creates an index but does not enforce referential integrity)
This error than was "swallowed" (logged at the - invisible - TRACE level of the kodo.Runtime log-channel) and converted into the puzzling UnexpectedRollbackException.
Another Kodo puzzler: my persistence.xml looks like this
<persistence-unit name="sample" transaction-type="JTA">
<provider>kodo.persistence.PersistenceProviderImpl</provider>
<jta-data-source>jdbc/testapp</jta-data-source>
<properties>
<property name="openjpa.Connection2UserName" value="usr" />
<property name="openjpa.Connection2Password" value="pwd" />
<property name="openjpa.Connection2URL"
value="jdbc:oracle:thin:@db-info" />
<property name="openjpa.Connection2DriverName"
value="oracle.jdbc.driver.OracleDriver" />
<property name="kodo.Log" value="SQL=TRACE, JDBC=TRACE, Runtime=TRACE" />
<property name="kodo.ConnectionFactoryProperties"
value="PrettyPrint=true, PrettyPrintLineLength=100" />
</properties>
</persistence-unit>
If I omit the connection info, and only specify the datasource, it fails to collect the sequence_table...I read about this in [url http://forums.bea.com/thread.jspa?threadID=300004109], but it seems odd to me...
I want to hide the connection info from my application by using a datasource, but am forced to specify it anyway for my persistence "helper"...
Similar Messages
-
WebLogic 10.0 + JPA 2.0 = errors
Hi,
Is there a known way to add support for JPA 2.0 in Weblogic 10.0?
Thanks.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 below1) 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 downloadhttp://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
Documentationhttp://download.oracle.com/docs/cd/E17904_01/web.1111/e13852/toc.htm
Supported Oracle WebLogic Server Versionshttp://download.oracle.com/docs/cd/E15315_06/help/oracle.eclipse.tools.weblogic.doc/html/SupportedServerVersions.html
TopLink JPA 2.0 Specific documentation/patchinghttp://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 -
How to configure Weblogic datasource in JPA Persisance .xml
Hi,
Can any one please provide me how to how to set up weblogic data source object in JPA Persisance .xml?
How to use entity manager to get connection from persistance .xml?
Thanks,
PraveenPraveen,
Hi, the @EntityManager annotation is incorrect - you want @PersistenceContext for container managed injection.
See the appropriate section in my WebLogic tutorial.
http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Perform_a_JPQL_query_using_a_Stateless_EJB_Session_Bean_injected_on_a_Servlet_Controller
Or the distributed version of the WebLogic tutorial.
http://wiki.eclipse.org/EclipseLink/Examples/Distributed#CollatzFacade_Implementation
See example stateless session bean source
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEJB/ejbModule/org/eclipse/persistence/example/jpa/server/business/ApplicationService.java
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.distributed.CollatzEJB/ejbModule/org/eclipse/persistence/example/distributed/collatz/business/CollatzFacade.java
@Stateless(mappedName = "ejb/CollatzFacade")
public class CollatzFacade implements CollatzFacadeRemote, CollatzFacadeLocal {
@PersistenceContext(unitName = "CollatzGF-ejbPU", type=PersistenceContextType.TRANSACTION)
private EntityManager entityManager;
See the Java EE tutorial as well under @PersistenceContext - You won't need @PersistenceUnit unless you need to instrument an EMF specifically on the WAR only
http://download.oracle.com/javaee/5/tutorial/doc/bnbqw.html
thank you
Michael O'Brien @ Telus Health / Emergis
michael.f.obrien @ eclipselink.org
http://www.eclipselink.org -
Getting Weblogic to work with Kodo
Hi,
Based on the documentation found here
http://docs.solarmetric.com/j2ee_tutorial_jca_installation.html#j2ee_tutorial_generic
I had created a startup class, with changes to the default JNDI name and
added an import line of javax.jdo.*
I also had to place kodo-jdo-runtime.jar and jdo-1.0.1.jar into the
classpath of the weblogic server to have it loaded by Weblogic without
class not found errors.
The new problem now while loading Weblogic server is as follows
Failed to invoke startup class "WLS_JNDI_BIND",
javax.jdo.JDOFatalUserException : Exception thown by
getPersistenceManagerFactory(Properties)
NestedThrowables:
java.lang.reflect.InvocationTargetException
at javax.jdo.JDOHelper.getPersistenceManagerFactory(Unknown Source)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(Unknown Source)
at WS_JNDI_Bind.startup(WLS_JNDI_Bind.java:55)
....etc
Please advice.Tan,
JCA is by far the preferred method of deploying into an appserver (in
fact spec perscribed). The configuration is straightforward (in WL,
just unjar, edit your classpath appropriately and edit ra.xml). Code
changes are minimal, mostly involving removing transactional code if
using managed transactions and looking up via JNDI via a static factory.
See the J2EE tutorial. Also read the section on XA DataSources as
most Weblogic defined datasources are managed as well.
Also, Kodo's datasource includes a wide range of performance features
and flexibilty which may or may not be exposed in WebLogic's datasource.
Tan wrote:
Up till now, we have been connecting our apps to DB servers using kodo
through jdbc drivers and for some operations, using direct jdbc connection
without jdo. We decided that this should change to a 3 tier architecture
with weblogic as middle tier to reduce the burden on our applications and
to harness the advantages provided by weblogic.
As you may have guess, the transition would be best done with minimal
changes to code and configuration.
Correct me if i am mistaken here : After reading through the
documentation,
the impression gained was that deploying through startup class is a much
more straight forward operation with only minor code changes required for
getting the persistencefactorymanager and the persistencemanager. On the
server side, only a startup class needs to be deployed.
As for JCA, it seems to be a relatively new technology applied in this
context. Although detailed information was given on how to deploy it on
weblogic, little documentation was provided on its operation and its
effects on the client applications using kodo (Eg: the changes required)
and the implications that may arise using this technology. Can anyone fill
me in on this, or point me to a kodo documentation that might explain
things better?
As a matter of fact, both the methods will be tried out eventually. I am
making a fact list of both methods before making the decision on which
method to use.
Please advice.
Tan
Patrick Linskey wrote:
FYI, I think it's more common to deploy Kodo into Weblogic via JCA, not
via a startup class, as described at:
http://docs.solarmetric.com/j2ee_tutorial_jca_installation.html#j2ee_tutorial_weblogic
Is there any reason why you're using a startup class instead of JCA
deployment?
-Patrick
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com -
Kodo with Weblogic Server?
Hi,
I am intending to port my current operations from a direct kodo -> mssql
connection to a kodo->weblogic->mssql methology.
From what i found out, web logic support a type 4 jdbc driver.
I wish to find out if its possible for kodo to directly utilise this
methodology, without any changes to existing structure. And possibly the
security improvements over this new arrangement.
I wish to do some homework on this before i get the web logic software.
Pls advice.Hi,
I made further read up and i wish to clarify some information.
I noted that to use Weblogic as the middle tier, a startup class is
required on Weblogic server so that Weblogic knows when it should start
taking note of a new connection....
I took the sample startup class from
http://docs.solarmetric.com/j2ee_tutorial_jca_installation.html#j2ee_tutorial_generic
1) The code seems to suggest that a kodo.properties will be found on the
weblogic server. Is this right? I am assuming that the compiled class file
will not have any memory of what is loaded from the kodo.properties file
during runtime.
2) Will my client java application be automatically getting connections
pooled from the weblogic server? That is, all connection pooling
activities will be handled by weblogic and on kodo side, no additional
code is required to perform connection pooling management.
For example, my current code below will not require any changes to make
use of weblogic's connection pool.
PPersistenceManager pm = JDOFactory.getPersistencemanager(props);
Transaction trans = pm.currentTransaction();
trans.begin();
Query query = pm.newQuery(.....);
trans.commit();
Pls advice
tan
Stephen Kim wrote:
Yes. Kodo can work with both WebLogic and SQLServer. Kodo can use
datasources defined in WebLogic or directly address SQLServer.
Tan wrote:
Hi,
I am intending to port my current operations from a direct kodo -> mssql
connection to a kodo->weblogic->mssql methology.
From what i found out, web logic support a type 4 jdbc driver.
I wish to find out if its possible for kodo to directly utilise this
methodology, without any changes to existing structure. And possibly the
security improvements over this new arrangement.
I wish to do some homework on this before i get the web logic software.
Pls advice.
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com -
Weblogic.appc without kodoc
I have a EJB module with an EclipseLink persistence unit (<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>). When weblogic.appc is run on this EJB module, Kodo Enhancer is also run on the persistent entities. This happens with both WebLogic 10.3 and 10.3.1 (11g).
1. Is there a way to prevent Kodo Enhancer from running while using weblogic.appc
2. Even better, if EclipseLink weaving could be plugged into weblogic.appc
Thanks.Hi,
Kodo is still required by a security component in WebLogic until this is switched to using EclipseLink JPA - removing Kodo (4 jars + 1 openjpa jar) is not an option or you will get a security and CNFE exception on server startup. You can however move EclipseLink or a version of the library higher in the server classpath using several means described below.
http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#EclipseLink_JAR_location
As of WebLogic Server 10.3.2.0 EclipseLink 1.2 runs fine with default weaving on for container-managed apps.
[EL Finest]: 2009-12-07 14:41:21.614--ServerSession(32489727)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--property=eclipselink.weaving.lazy; default value=true
[EL Finest]: 2009-12-07 14:41:21.849--ServerSession(32489727)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--End predeploying Persistence Unit example; state Predeployed; factoryCount 1
[EL Finest]: 2009-12-07 14:41:22.052--ServerSession(32489727)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Begin weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
[EL Finest]: 2009-12-07 14:41:22.098--ServerSession(32489727)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Weaved persistence (PersistenceEntity) [org.eclipse.persistence.example.jpa.server.business.Cell].
[EL Finest]: 2009-12-07 14:41:22.098--ServerSession(32489727)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Weaved fetch groups (FetchGroupTracker) [org.eclipse.persistence.example.jpa.server.business.Cell].
[EL Finest]: 2009-12-07 14:41:22.098--ServerSession(32489727)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--End weaver class transformer processing class [org.eclipse.persistence.example.jpa.server.business.Cell].
If you see the following check that the eclipselink jar is in the classpath or modules.
11 WARN [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.Runtime - The configuration property named "openjpa.Id" was not recognized and will be ignored, although the name closely matches a valid property called "openjpa.Id".
26 INFO [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.Runtime - Starting BEA Kodo 4.2.0
You may also want to post your question to the TopLink(EclipseLink)/Kodo forum at
TopLink/JPA
thank you
/michael
http://www.eclipselink.org
Edited by: michael_obrien on Dec 7, 2009 2:33 PM
Edited by: michael_obrien on Jan 20, 2010 6:21 PM -
Hi,
Is anyone able to deploy a JPA 2.0 (Hibernate 3.6 Final specifically) application on WL 10.3.x?
I tried on 10.3.2 and 10.3.3 but I get following exceptions
Caused By: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode;
at org.hibernate.ejb.util.LogHelper.logPersistenceUnitInfo(LogHelper.java:39)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:516)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:352)
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:332)
Or (when I set to use prefer-application-packages for javax.persistence.* and org.hibernate.*, I get the following exceptions:
Caused By: weblogic.deployment.EnvironmentException: Error processing persistence unit TrivnetEJB of module TrivnetEJB.jar: Error instantiating the Persistence Provider class org.hibernate.ejb.HibernatePersistence of the PersistenceUnit TrivnetEJB: java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:344)
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:332)
at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:134)
at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:336)
at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptor(AbstractPersistenceUnitRegistry.java:250)
at weblogic.deployment.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:69)
at weblogic.ejb.container.deployer.EJBModule.setupPersistenceUnitRegistry(EJBModule.java:221)
I have seen few forums that specify a workaround for this for applications that use spring.
WebLogic 10.0 + JPA 2.0 = errors
The above forum also specifies that till WL10.3.3, full JPA2.0 support is not available. So does it mean that Hibernate 3.6 based applications won't work at all on WL 10.3.x and have to wait till 10.3.4 is released? Or is there any other solution or patch available for this.
This is really a high priority issue for us.
Please suggest.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 below1) 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 downloadhttp://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
Documentationhttp://download.oracle.com/docs/cd/E17904_01/web.1111/e13852/toc.htm
Supported Oracle WebLogic Server Versionshttp://download.oracle.com/docs/cd/E15315_06/help/oracle.eclipse.tools.weblogic.doc/html/SupportedServerVersions.html
TopLink JPA 2.0 Specific documentation/patchinghttp://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 -
11g Release 1 Patch Set 3 (WLS 10.3.4)
Hi.
While creating new server in OEPE Helios(11.1.1.6) I found that WLS 10.3.4 is available for selection. However I didnt find any information neither links to download it. Only 10.3.3 is available.
When and where it is\would be available for download?
Thanksfrf,
Hello, as part of the WebLogic 10.3.4 release on friday - we verified JPA 2.0 functionality for enterprise users using JPA as their persistence pattern. The main issues were JPA 2.0 XSD validation and JPA 2.0 container managed persistence unit injection.
The details of the following post outline what happens out of the box and how JPA 2.0 can be officially enabled on JEE5 compliant WebLogic 10.3.4 install +(with or without the QWG8 patch)+
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 is now deprecated and not required in 10.3.4.0 for both application and container managed persistence contexts.
Specifically we will start retesting EE applications using a SSB injected @PersistenceContext container managed JTA transactional JPA 2.0 persistence units with/without JPA 2.0 XSD elements.
I verified the server and it is using SVN rev# *8635 from 6 Dec 2010* https://fisheye2.atlassian.com/changelog/eclipselink/?cs=8635
Essentially in order to enable JPA 2.0 functionality on WebLogic 10.3.4 shipped on 14 Jan 2011 - you apply the QWG8 patch below or manually edit your server classpath to put the JPA 2.0 persistence specification API jar and the com.oracle.jpa2support_1.0.0.0_2-0.jar ahead of the other liibraries on the 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.jarEverything is shipped with WebLogic 10.3.4 but JPA 1.0 is enabled by default so that this JEE5 capable server is backwards compatible with JEE5/JPA1 out of the box. Without the above patch you will see the following.
<15-Jan-2011 5:58:40 o'clock PM EST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 10.3.4.0 Fri Dec 17 20:47:33 PST 2010 1384255 >
[EL Info]: 2011-01-15 18:06:38.082--ServerSession(48997950)--Thread(Thread[[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--EclipseLink, version: Eclipse Persistence Services - 2.1.2.v20101206-r8635
[EL Info]: 2011-01-15 18:06:38.082--ServerSession(48997950)--Thread(Thread[[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Server: 10.3.4.0
We have the required bundles in the modules directory...
javax.persistence_1.0.0.0_2-0-0.jar (upgraded from 1-0-2)
org.eclipse.persistence_1.0.0.0_2-1.jar (upgraded from 2-0)
A very quick test of a JPA 2.0 container managed app with the following persistence.xml in the ejb.jar works as detailed below.
There are 3 issues we must check.
1) JPA 2.0 XSD parsing errors: as expected there are no more JPA 2.0 schema parsing issues.
2) New JPA 2.0 schema elements like the *<shared-cache-mode>NONE</shared-cache-mode>* element - this passes validation but we need to verify runtime functionality
3) JPA 2.0 runtime API like a entityManager.getMetamodel(); call on the Servlet or Statless session bean
4) JPA 2.0 weaving/instrumentation - Again we need to verify something like weaving of Entities contaiing lazy IndirectLists are weaved properly by the container.
Note: All testing in this post is on a WebLogic 10.3.4.0 install out-of-the-box. The only modification I made was in creating a derby 10.5.3.0 JTA global datasource "localJTA" on the server - and drop a container managed JPA 2.0 app as an EAR in the autodeploy directory on the default user domain.
<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-unit name="example" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <!-- we will default to Kodo without specifying the provider -->
<jta-data-source>localJTA</jta-data-source>
<shared-cache-mode>NONE</shared-cache-mode><!-- shared-cache-mode must come after any class definitions (usually SE only) - the JPA schema is ordered -->
<properties>
<property name="eclipselink.target-server" value="WebLogic_10"/>
<property name="eclipselink.target-database" value="Derby"/>
<property name="eclipselink.logging.level" value="FINEST"/>
<!-- new for 10.3.4.0 http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging#Server_Logging -->
<property name="eclipselink.logging.logger" value="DefaultLogger"/>
<!-- 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="database"/-->
</properties>
</persistence-unit>For 3) we get the following exception out of the box on a servlet if we do not apply the above mentioned patch below - because the container defaults to Java EE 5 functionality - or JPA 1.0
http://download.oracle.com/docs/cd/E18476_01/doc.220/e18480/weblogicchap.htm
java.lang.NoSuchMethodError: javax/persistence/EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel;
at org.eclipse.persistence.example.jpa.server.weblogic.enterprise.presentation.FrontController.processGliderComm
and(FrontController.java:346)
or 3) The same exception if we try to run JPA 2.0 on the DI entityManager from the SSB in the EJB container classLoader
javax.ejb.EJBException: EJB Exception: : java.lang.NoSuchMethodError: javax/persistence/EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel;
+ at org.eclipse.persistence.example.jpa.server.business.ApplicationService.insertObjects(ApplicationService.java:66)+
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)+
+ at java.lang.reflect.Method.invoke(Method.java:597)+
+ at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)+
+..+
+ at $Proxy74.insertObjects(Unknown Source)+
+ at org.eclipse.persistence.example.jpa.server.business.ApplicationService_5ptwty_ApplicationServiceLocalImpl.__WL_invoke(Unknown Source)+
We also get the Kodo/OpenJPA provider when we attempt to weave.
+<openjpa-1.1.1-SNAPSHOT-r422266:965591 fatal user error> org.apache.openjpa.util.MetaDataException: "org.eclipse.persistence.example.jpa.server.business.Cell.id" declares generator name "EL_SEQUENCE_CELL", but uses the AUTO generation type. The only valid generator names under AUTO are "uuid-hex" and "uuid-string".+
+ at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.getGeneratedValueStrategy(AnnotationPersistenceMetaDataParser.java:1226)+
Therefore there is still a little bit of configuration required.
Enabling JPA2 support
1) install the QWG8 patch, or
2) manually add the com.oracle.jpa2support_1.0.0.0_2-0.jar ahead of the server classpath by following the instructions in the documentation at
http://download.oracle.com/docs/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309
or doing it manually by modifying the following line
C:\opt\wls10340_pub110115\wlserver_10.3\common\bin\commEnv.cmd
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
Results
The following code
@Local
@Stateless
public class ApplicationService implements ApplicationServiceLocal {
@PersistenceContext(unitName="example", type=PersistenceContextType.TRANSACTION)
private EntityManager entityManager;
public boolean insertObjects(List<Cell> classes) {
try {
for(int i=0; i< classes.size(); i++) {
entityManager.persist(classes.get(i));
System.out.println("JPA 2.0 Metamodel: " + entityManager.getMetamodel()); ...prints out the JPA 2.0 EntityManager dependency injected into the SSB proxy for the life of the transaction in the function
JPA 2.0 Metamodel: MetamodelImpl@34817119 [ 5 Types: , 2 ManagedTypes: , 2 EntityTypes: , 0 MappedSuperclassTypes: , 0 EmbeddableTypes: ]+
+[EL Finer]: 2011-01-15 22:36:00.33--UnitOfWork(34913451)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--TX beforeCompletion callback, status=STATUS_ACTIVE+
You can see that when we debug the stateless session bean $Proxy that has our injected EntityManager...
this ApplicationService_5ptwty_Impl (id=11616)
__WL_EJBContext SessionEJBContextImpl (id=11654)
entityManager $Proxy73 (id=11639)
h TransactionalEntityManagerProxyImpl (id=11638)
appName "org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEAR" (id=11513)
closeMethod Method (id=11663)
moduleName "org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEJB.jar" (id=11515)
persistenceUnit PersistenceUnitInfoImpl (id=11665)
persistenceUnitName "org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEAR#org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEJB.jar#example" (id=11666)
queryMethods HashSet<E> (id=11668)
transactionAccessMethod Method (id=11669)
transactionalMethods HashSet<E> (id=11670)
txHelper TransactionHelperImpl (id=11523)
txRegistry ServerTransactionManagerImpl (id=11524)
unqualifiedPersistenceUnitName "example" (id=11672) ...no longer complains about an unknown getMetamodel() JPA 2.0 method signature
Oracle WebLogic Server 11gR1 PatchSet 3 r20110115 at localhost [Oracle WebLogic Server]
Java HotSpot(TM) Client VM[localhost:8453]
Daemon Thread [[ACTIVE] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)'] (Running)
Daemon Thread [[ACTIVE] ExecuteThread: '18' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended)
TransactionalEntityManagerProxyImpl.invoke(Object, Method, Object[]) line: 18
$Proxy59.getMetamodel() line: not available [local variables unavailable]
ApplicationService_5ptwty_Impl(ApplicationService).insertObjects(List<Cell>) line: 60
.. JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204
$Proxy71.insertObjects(List) line: not available
ApplicationService_5ptwty_ApplicationServiceLocalImpl.__WL_invoke(Object, Object[], int) line: not available
SessionLocalMethodInvoker.invoke(BaseLocalObject, MethodDescriptor, Object[], int, String, Class<?>) line: 39
ApplicationService_5ptwty_ApplicationServiceLocalImpl.insertObjects(List) line: not available
FrontController.generateGlider(PrintWriter) line: 252
.. FrontController(HttpServlet).service(ServletRequest, ServletResponse) line: 820
StubSecurityHelper$ServletServiceAction.run() line: 227
.. ExecuteThread.run() line: 176
arg1 Method (id=11511)
clazz Class<T> (javax.persistence.EntityManager) (id=8312)
name "getMetamodel" (id=11543)
returnType Class<T> (javax.persistence.metamodel.Metamodel) (id=11545) For 4) Weaving is occuring as expected on either the JPA 1.0 or JPA 2.0 entities. We check this by either checking that our Entity is an instanceof org.eclipse.persistence.internal.weaving.PersistenceWeaved interface, or debug into the Entity and look for our bytcode instrumented weaved fields that start with _persistence*. The question is - we need a weaved field or weaved function that was introduced for JPA 2.0
[4] Cell (id=11571)
_persistence_fetchGroup null
_persistence_primaryKey null
_persistence_session null
_persistence_shouldRefreshFetchGroup false
aCellAttribute null
id null
left null
peers HashSet<E> (id=11572)
map HashMap<K,V> (id=11575)
com.oracle.jpa2support_1.0.0.0_2-0.jar forensicsI had a look at the patch jar com.oracle.jpa2support_1.0.0.0_2-0.jar that WebLogic 10.3.4 ships with that allows installers to enable JPA 2.0 (JSR-317) support to superceed the default JPA 1.0 (JSR-220) support. It looks like the container proxy code for container managed EntityManagerFactory and EntityManager $Proxy objects has been updated so that a JPA 2.0 EntityManager $Proxy object get injected with the proper API level object via the InvocationHandlerFactory, FactoryInterceptor. The Query proxy has been updated as well. There is a fix for Kodo(OpenJPA) and OpenJPA related to the recent change and deprecation of certain functions of those providers. The EclipseLink JPA 2.0 provider (as the provider for TopLink) did not need weblogic changes beyond placing the JPA javax.peristence 2.0 specification jar higher on the classpath.
The root EclipseLink tracking bug is 334468
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334468
OTN downloadhttp://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
Documentationhttp://download.oracle.com/docs/cd/E17904_01/web.1111/e13852/toc.htm
Supported Oracle WebLogic Server Versionshttp://download.oracle.com/docs/cd/E15315_06/help/oracle.eclipse.tools.weblogic.doc/html/SupportedServerVersions.html
TopLink JPA 2.0 Specifichttp://download.oracle.com/docs/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309
see related
JPA 2: Reverify JPA 2.0 XSD support in persistence.xml on AM/CM app on WebLogic 10.3.3.0
http://bugs.eclipse.org/331569
JPA 2.0: Add WebLogic 10.3 configuration process to enable the JPA 2.0 library functionality - updated
http://bugs.eclipse.org/296271
http://en.wikipedia.org/wiki/Oracle_WebLogic_Server - updated
JPA: Add downloadable 60k weblogic.EAR to wiki page (outside of SVN) - reopened
http://bugs.eclipse.org/294745
JPA: support WebLogic 10.3.4.0 introduction of new JPA MBean that changes the default JPA provider
http://bugs.eclipse.org/312824
JPA: Update tutorial wiki for WebLogic 10.3 to match the Oracle WebLogic 11g 10.3.3.0 - assigned
http://bugs.eclipse.org/310849
To be answered
OTN Post: WebLogic 10.0 + JPA 2.0 = errors - updated
Re: WebLogic 10.0 + JPA 2.0 = errors
Deploy Hibernate based EAR file on Weblogic 10.3.3?
OTN Post: Default JPA provider for Weblogic Server 10.3.2 (11g) - updated
Default JPA provider for Weblogic Server 10.3.2 (11g)
OTN Post: Hibernate 3.6 Final (JPA 2.0) + WL 10.3.x :Unable to deploy sample appn - updated
Hibernate 3.6 Final (JPA 2.0) + WL 10.3.x :Unable to deploy sample appn
WebLogic 10.0 + JPA 2.0 = errors
OTN Post: EJB with Hibernate On Weblogic - updated
Re: EJB with Hibernate On Weblogic
OTN Post: OEPE 1.6 - Oracle WebLogic Server 11gR1 PatchSet 3 requres WLS 10.3.4 - answered
OEPE 1.6 - Oracle WebLogic Server 11gR1 PatchSet 3 requres WLS 10.3.4
OTN Post: EJB with Hibernate On Weblogic - updated
Re: EJB with Hibernate On Weblogic
OTN Post: OpenJPA_2.0 NoSuchMethod error (getValidationMode()) - updated
OpenJPA_2.0 NoSuchMethod error (getValidationMode())
JPA 2.0 features used on WebLogic even if they are not available at runtime - notified
http://netbeans.org/bugzilla/show_bug.cgi?id=189205
Option to enable JPA 2.0 for dev WebLogic - notified
http://netbeans.org/bugzilla/show_bug.cgi?id=189348
False-positive error badge on project with JPA targeting WebLogic - notified
http://netbeans.org/bugzilla/show_bug.cgi?id=189626
Giving up on Hibernate (for now), trying EclipseLink...
http://forums.netbeans.org/post-94817.html
http://blogs.sun.com/arungupta/entry/which_java_ee_6_app
Eclipselink 2.0 + WebLogic 10 => No joy (Unable to get Eclipse link 2.0 working with WebLogic 10) - answered
http://www.eclipse.org/forums/index.php?t=msg&goto=644000&S=40e13288641c0af5dc8489343b896348#msg_644000
eclipselink-users Problem of eclipselink upgrade (2.0.2) - WebLogic 10.3.3.0 - answered
http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg04631.html
Re: EclipseLink + JPA 2 in Weblogic 10.3.0
http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg04375.html - answered below
Re: eclipselink-users Problems with Eclipselink 2 (JPA 2.0) & WebLogic 10,
http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg05609.html
[eclipselink-users] Problems with Eclipselink 2 (JPA 2.0) & WebLogic 10 - answered
http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg05639.html
To be Deprecated
JPA 2: Reverify JPA 2.0 XSD support in persistence.xml on AM/CM app on WebLogic 10.3.3.0
http://bugs.eclipse.org/331569
JPA 2.0: Add WebLogic 10.3 configuration process to enable the JPA 2.0 library functionality
http://bugs.eclipse.org/296271
WebLogic 10.3 availability?
/ Michael O'Brien
http://www.eclipselink.org -
How do I discover which version of JPA is being supported by WebLogic
The WebLogic version I have been using is 10.3.6.0. With the purpose to use JPA2 instead of JPA1, I followed the guide which tells to manually set this by adding these lines to commEnv.cmd (Programming Enterprise JavaBeans, Version 3.0, for Oracle WebLogic Server 11g Release 1 10.3.6):
set wls_modules=C:\Oracle\Middleware\modules
set PRE_CLASSPATH=%wls_modules%\javax.persistence_1.0.0.0_1-0-2.jar;%wls_modules%\com.oracle.jpa2support_1.0.0.0_2-1.jar
Then, I changed from Kodo to TopLink on WebLogic console.
Suddenly, I read "Java EE 6 support arrived in WebLogic 10.3.4.0 on 15 Jan 2011" (http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg06874.html).
I am asking myself if WebLogic 10.3.6 is already setted to use JPA2 by default. It would be easily answered if I knew how to see which JPA, JTA, EJB or wherever configuration version are set when the server is started. Where can I look for this information?My understanding is that the situation in WebLogic 10.3.6 is entirely the same as in prior versions - it ships with the JPA 2.0 jars but they are not enabled by default so that it can meet Java EE 5 compatibility requirements. This is mentioned in the docs you may have seen here: http://docs.oracle.com/cd/E23943_01/web.1111/e13852/toc.htm#BGGBIJBI
and the docs from 10.3.5 here:
http://docs.oracle.com/cd/E21764_01/web.1111/e13852/toc.htm#NOTES149
The link you referenced does not say WebLogic 10.3.4 is Java EE 6 compatible. The reference I believe you got this from is stating that the com.oracle.jpa2support_1.0.0.0_2-0.jar is included for future Java EE 6 compatibility, but is not enabled in 11.3.x so that it remains Java EE 5 compatible. It basically ships a preview of Java EE 6 components that are not enabled - Only WebLogic 12c is fully Java 6 EE compatible by default, which includes JPA 2.0.
Best Regards,
Chris -
Kodo 4.1.2 in Weblogic 10 Problem
I was told by BEA that Kodo/openJPA is included in Weblogic 10. However, now I have Weblogic 10 but I could not located much Kodo classes from Weblogic libraries. I searched all the JARs under BEA_HOME\wlserver_10.0\server\lib.
I also tried to migrate Kodo/JPA application from Weblogic 9.2 to Weblogic 10. My application depends on Kodo JCA deployment in managed environment. The application and Kodo JCA deployed fine into Weblogic 10. But when I test any application, the test failed when I tried to create EntityMaanger from EntityManagerFactory:
Caused by: <4|false|0.9.7> org.apache.openjpa.persistence.ArgumentException: config-error
at weblogic.kodo.event.ClusterRemoteCommitProvider.endConfiguration(ClusterRemoteCommitProvider.java:112)
at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:447)
at org.apache.openjpa.conf.RemoteCommitProviderValue.instantiate(RemoteCommitProviderValue.java:122)
at org.apache.openjpa.conf.RemoteCommitProviderValue.instantiateProvider(RemoteCommitProviderValue.java:103)
at org.apache.openjpa.conf.RemoteCommitProviderValue.instantiateProvider(RemoteCommitProviderValue.java:95)
at org.apache.openjpa.conf.OpenJPAConfigurationImpl.newRemoteCommitProviderInstance(OpenJPAConfigurationImpl.java:708)
at org.apache.openjpa.event.RemoteCommitEventManager.(RemoteCommitEventManager.java:56)
at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getRemoteCommitEventManager(OpenJPAConfigurationImpl.java:720)
at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:177)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:139)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:187)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:140)
at kodo.persistence.jdbc.JPAConnectionFactory.createEntityManager(JPAConnectionFactory.java:144)
at kodo.persistence.jdbc.JPAConnectionFactory.createEntityManager(JPAConnectionFactory.java:23)
at com.psi.vida.ejb.JPASessionBean.list(JPASessionBean.java:165)
at com.psi.vida.ejb.JPASessionEJB_lvtqkz_EOImpl.list(JPASessionEJB_lvtqkz_EOImpl.java:134)
at com.psi.vida.ejb.JPASessionEJB_lvtqkz_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
... 17 more
Caused by: java.lang.Exception: <0|true|0.9.7> org.apache.openjpa.persistence.PersistenceException: no-trasport
at org.apache.openjpa.util.Exceptions.replaceNestedThrowables(Exceptions.java:230)
at org.apache.openjpa.persistence.ArgumentException.writeObject(ArgumentException.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
at weblogic.rmi.extensions.server.CBVOutputStream.writeObject(CBVOutputStream.java:84)
at weblogic.rmi.internal.ServerRequest.unmarshalThrowable(ServerRequest.java:349)
at weblogic.rmi.internal.ServerRequest.getThrowable(ServerRequest.java:62)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:203)
... 17 moreI was told by BEA that Kodo/openJPA is included in
Weblogic 10. However, now I have Weblogic 10 but I
could not located much Kodo classes from Weblogic
libraries. I searched all the JARs under
BEA_HOME\wlserver_10.0\server\lib. They're in the (new) modules directory. weblogic.jar refers to stuff in the modules directory via its manifest classpath.
I also tried to migrate Kodo/JPA application from
Weblogic 9.2 to Weblogic 10. My application depends
on Kodo JCA deployment in managed environment. The
application and Kodo JCA deployed fine into Weblogic
10. But when I test any application, the test failed
when I tried to create EntityMaanger from
EntityManagerFactory:Interesting. I do not know what the status of Kodo JCA testing is in WebLogic 10, but it sounds like something is a bit wonky.
Basically, in a WLS environment, the default remote commit provider is automatically set to the new weblogic.kodo.event.ClusterRemoteCommitProvider, which uses the WLS clustering protocol to communicate cache notifications. The error that you're seeing indicates that cluster services are not available in the execution context. You can probably get around this by explicitly setting the 'kodo.RemoteCommitProvider' option to 'sjvm' (if you're not running in a cluster), or to whatever you had it set to in the past. (I'm guessing that it was unset in the past, as otherwise, the configuration should be picking up that instead of the new default.)
However, personally, I much prefer the new persistence.xml configuration file format, compared to JCA configuration. (You can trivially use the persistence.xml format with Kodo JDO, even though it's a JPA-specified feature.) You might want to look into moving away from JCA and to the persistence.xml style instead.
If you do this, you'll end up putting a META-INF/persistence.xml file in your EAR (and possibly a META-INF/persistence-configuration.xml file, if you want to use the strongly-typed Kodo XML configuration format), and replacing your JNDI lookups with java:comp/env/persistence/<persistence-unit-name>. (I think that's the right location. I might be mistaken, though.)
Also, I can't guarantee that WebLogic 10 really handles JCA configuration all that well; some bits of that exception make it look like maybe some resources are not available in the classloader, which is surprising. So, it's possible that there is some sort of more fundamental JCA problem here (and not just a problem with the new remote commit provider).
-Patrick -
KODO on Weblogic 10.0 MP1
Hi,
I am running an application on Weblogic 10.0 MP1. The application uses KODO.The use case of my problem is simple.
There is a stateless session bean which has a transaction envelope of REQUIRED. One of its method, inserts a row into DB(Oracle) using KODO. Now, this insert fails due to some DB related issue e.g Primary Key violation. I can see in the weblogic log(by enabling the debug option of JPA) and also by enabling the trace log in persistance.xml of Kodo.
Now, the exception never gets propagated to the session bean method ie. If I try to catch the exception in the session bean by putting try/catch() block around the insert statement and using ANY form of exception, it just seems no exception is thrown.
However, since container(via session bean) has not recd any exception, it only comes to know when it tries to to commit the transaction , as part of method completion. Now, at this time it comes to know that this transaction has already been marked as "rolled back" and it cannot commit.
To me it seems, the Transaction manager comes to know about the transaction being bad or makred for roll back, container never comes to know 'cause it never saw that exception.
I need help to understand: 1. Is there anything I can do differently to catch it ?
2. Does this sound like a BUG in the implementation and if anyone is aware of a patch?
Any help is greatly appreciated.Hi,
I don't know if this will help but I have sequence generation annotations for the Oracle DB on an entity that runs on the EJB container in a JTA container managed transaction. However, the JPA provider is EclipseLink JPA in this case.
See...
http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial
Specifically...
@Id
// keep the sequence column name under 30 chars to avoid an ORA-00972
@SequenceGenerator(name="EL_SEQUENCE_CELL", sequenceName="EL_CELL_SEQ", allocationSize=25)
@GeneratedValue(generator="EL_SEQUENCE_CELL")
private BigInteger id; // Integer is fine
in...
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEJB/ejbModule/org/eclipse/persistence/example/jpa/server/business/Cell.java
thank you
/michael
www.eclipselink.org -
How to resolve BEA KODO license on WebLogic Server
Using BEA Workshop Studio 3.2 you can create Kodo provided JPA project. As part of the project creation the BEA Kodo license (license.bea) file is included within Project/src folder, so that it is available in the classpath. While running the project on WebLogic server you might face license error "kodo.persistence.PersistenceException: No product license key was found..."
The fix for this issue is to merge the kodo license.bea content into WebLogic server license.bea file.
Edit WebLogic-server-Home\license.bea file
Edit Project\src\license.bea file, copy the content <license-group.. > .. </license-group> and paste inside WebLogic-server-Home\license.bea file NOTE: Paste the kodo license content within enclosing <bea-licenses> ... </bea-licenses> but outside of <license-group format="1.0" product="WebLogic Platform" release="xx"> tag.
With this you should be able to run the kodo project on WebLogic server.follow this doc http://docs.oracle.com/cd/E35287_01/fusionapps.7964/e14849.pdf
mark if it helps -
URISyntaxException while using GlassFish JPA provider in WebLogic
I am trying to plug in GlassFish JPA provider https://glassfish.dev.java.net/javaee5/persistence/#Java_Persistence_API in WebLogic Application Server version "EJB 3.0 Tech Preview". EJB 3 tech preview version is only available on Windows OS, so I am using Windows OS.
1. I have made GlassFish provider jar file (toplink-essentials.jar) available to WebLogic server class loader.
2. I modified the EJB 3.0 sample (reviewService.ear) to use GlassFish provider <i>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</i> in persistence.xml file.
3. I changed the build.xml so that I don't package Kodo enhanced classes in the ear file.
Now when I deploy the application, I am getting URISyntaxException thrown by GlassFish provider. The URL printed in the exception message <i>jar:file:D:\sahoo\software\bea\weblogic_ejb30_preview\samples\domains\wl_server\.\servers\examplesServer\tmp\_WL_user\reviewService\prxy3a\domain.jar!/</i> is containing <b>'\'</b> instead of <b>'/'</b>. This looks like a bug in the WebLogic server. Can anyone confirm this?
Exception Stack:
Target state: deploy failed on Server examplesServer
java.net.URISyntaxException: Illegal character in opaque part at index 11: jar:file:D:\sahoo\software\bea\weblogic_ejb30_preview\samples\domains\wl_server\.\servers\examplesServer\tmp\_WL_user\reviewService\prxy3a\domain.jar!/
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parse(URI.java:3019)
at java.net.URI.<init>(URI.java:578)
at java.net.URL.toURI(URL.java:916)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.convertURLToURI(PersistenceUnitProcessor.java:625)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.createInputStreamForFileInPersistenceUnit(PersistenceUnitProcessor.java:200)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.populateORMXMLStreamList(EntityManagerSetupImpl.java:664)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.buildPersistentClassSetFromXMLDocuments(EntityManagerSetupImpl.java:124)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.buildEntityList(EntityManagerSetupImpl.java:162)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:492)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createContainerEntityManagerFactory(EntityManagerFactoryProvider.java:154)
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:140)
at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:84)
at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptor(AbstractPersistenceUnitRegistry.java:43)
at weblogic.deployment.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:67)
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:320)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
Thanks,
SahooThe processing steps
<OL>
<LI>1. URL passed by the container is converted by the provider to an URI.
<LI>2. The provider is passing this URI to a java.io.File(URI uri) constructor.
</OL>
<OL>
<LI>Problem 1: The container is not replacing the backslash to forward slash.
<LI>Problem 2: Even when the container replaces the backslashes, the provider fails at the File(URI uri) constructor. Because it needs to construct the file with
not the actual URI, but URI.getSchemeSpecificPart().
</OL>
<BR>
One possible solution lies for the provider (without modifying the container) is to start with the URL, convert it to URL after replacing the backslashes and then passing only the scheme specific part to construct a file.
Please see the attached simple Java code
<pre>package test;
import java.io.File;
import java.net.URI;
import java.net.URL;
* @author <A HREF="mailto:[email protected]>Pinaki Poddar</A>
public class TestPath
* @param args
public static void main (String[ args) throws Exception
// String url = "jar:file://D:/TP5/weblogic_ejb30_preview/samples/domains/wl_server/./servers/examplesServer/tmp/_WL_user/ejax/ie9te7/ejax.jar!/";
// String url = "jar:file:D:\\TP5\\weblogic_ejb30_preview\\samples\\domains\\wl_server\\.\\servers\\examplesServer\\tmp\\_WL_user\\ejax\\ie9te7\\ejax.jar!/";
String url = "jar:file:D:\\TP5\\weblogic_ejb30_preview\\samples\\domains\\wl_server\\.\\servers\\examplesServer\\tmp\\_WL_user\\ejax\\ie9te7\\ejax.jar!/";
URL URL = validateURL(url);
System.out.println("URL = " + URL);
System.out.println("URL.protocol = " + URL.getProtocol());
System.out.println("URL.file = " + URL.getFile());
URI URI = URL.toURI();
System.out.println("URI = " + URI);
System.out.println("Scheme =" + URI.getScheme());
System.out.println("Authority =" + URI.getAuthority());
System.out.println("Host =" + URI.getHost());
System.out.println("Port =" + URI.getPort());
System.out.println("SchemePart: " + URI.getRawSchemeSpecificPart());
System.out.println("Path: " + URI.getPath());
System.out.println("Fragment: " + URI.getFragment());
System.out.println("Absolute = " + URI.isAbsolute());
System.out.println("Opaque = " + URI.isOpaque());
File file = new File(URI.getSchemeSpecificPart());
System.out.println("File [" + URI + "] exists = " + file.exists());
static URL validateURL(String url) throws Exception {
url = url.replace('\\','/');
URL URL = new URL(url);
String fileName = URL.getFile();
if (fileName.startsWith("file:") && !fileName.startsWith("file://"))
URL = new URL(URL.getProtocol(),URL.getHost(),URL.getPort(),
"file://"+fileName.substring(5));
return URL;
</pre> -
Running on Weblogic Server 9 with XML mappings (JPA)
We have a project with a number of persistent classes configured through XML mapping files instead of annotations because it should also work under JDK 1.4.
It works perfect as a standalone client or set up in the server with a connection specified in the persistence.xml.
However when configuring it through a resource adapter as recommended for WLS9, I'm running into problems as there seems to be no way to specify that MetaData should be taken from an XML file when it comes to the JPA edition.
Eg. I'm missing the equivalent of:
<mapping-file>com/xyz/xxx/Service.orm.xml</mapping-file>So naturally I get an Exception like:
org.apache.openjpa.persistence.ArgumentException: There is no query with the name "findServiceByName" defined for any of the known persistent classes: null.And the server log also shows:
INFO [[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.MetaData - Found 0 classes with metadata in 20 milliseconds.Any suggestions on how to fix or work around this without introducing annotations?
Regards
Brian JacobsenYes we are using named queries as well.
WLS 9.2, Kodo 4.1.2.
There are no entries in config.xml and no persistence.xml when running as recommended under WLS9 installation in the Kodo documentation.
Everything is configured in the ra.xml for the resource adapter. But the ra.xml specification only supports specification through annotated classes for JPA as far as I can decipher, which is what I tried to describe in the original post.
Eg. kodo.MetaDataFactory supports only classes through Type. There is no way to specify the equivalent mapping through XML files. See section 6.2 Metadata Factory in the Kodo Manual.
Kind regards
Brian Jacobsen -
Class Cast Exception running Kodo JCA in Weblogic 8.1
Hi,
I have a stateless session EJB that accesses Kodo through the JCA adapter.
The database I'm connecting to is mysql.
The problem I'm having is that the persistence manager throws a class cast
exception when trying to commit the transaction. See below for the stack
trace. I suspect it has something to do with the mapping, but the error
doesn't give me enough information to tell.
Any idea where to start looking to solve this problem?
Merrill
<Sep 14, 2004 9:09:40 AM PDT> <Error> <EJB> <BEA-010026> <Exception
occurred during commit of transaction Name=[EJB ossj
inventory.bean.impl.JVTInventorySessionBean.createEntitySpecificationByValue(javax.oss.cbe.EntitySpecificationValue)],X
id=BEA1-0003E542E34E0D33F21F(21266875),Status=Rolled back.
[Reason=kodo.util.FatalException: java.lang.ClassCastExceptio
n
NestedThrowables:
java.lang.ClassCastException],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds
since begin=13,seconds left=30,SCInfo[os
sj+myserver]=(state=rolledback),properties=({weblogic.transaction.name=[EJB
ossj.inventory.bean.impl.JVTInventorySession
Bean.createEntitySpecificationByValue(javax.oss.cbe.EntitySpecificationValue)]}),OwnerTransactionManager=ServerTM[Server
CoordinatorDescriptor=(CoordinatorURL=myserver+10.4.110.92:7001+ossj+t3+,
XAResources={},NonXAResources={})],Coordinator
URL=myserver+10.4.110.92:7001+ossj+t3+): kodo.util.FatalException:
java.lang.ClassCastException
NestedThrowables:
java.lang.ClassCastException
at
kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:825)
at
weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:1010)
at
weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:115)
at
weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:1184)
at
weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1910)
at
weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:273)
at
weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:244)
at
weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:299)
at
weblogic.ejb20.internal.StatelessEJBObject.postInvoke(StatelessEJBObject.java:140)
at
ossj.inventory.bean.impl.JVTInventorySession_h5aqa8_EOImpl.createEntitySpecificationByValue(JVTInventorySessi
on_h5aqa8_EOImpl.java:4968)
at
ossj.inventory.bean.impl.JVTInventorySession_h5aqa8_EOImpl_WLSkel.invoke(Unknown
Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
at
weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.lang.ClassCastException
at kodo.jdbc.sql.AbstractRow.toSQL(AbstractRow.java:657)
at kodo.jdbc.runtime.RowImpl.flush(RowImpl.java:250)
at
kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.java:125)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:361)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:168)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:73)
at
kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:590)
at
kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:152)
at
kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.java:964)
at
kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:813)Can you use 3.1.5. Can you also be sure that you don't have multiple
versions of Kodo around, i.e. in the system classpath, JCA kodo.rar
directory, etc?
Merrill Higginson wrote:
Abe White wrote:
What version of Kodo?I'm using Kodo V 3.1.2
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com
Maybe you are looking for
-
Set of Business Rules - BPC 10.0 Consolidation
Hi experts, I´ll need help to work with two scenarios on BPC 10.0 (Consolidation) as following: 01- The scenario 01 has four entities: 1001, 1002, 1003 and 1004 and four business rules: ELIM01, ELIM02, ELIM03 and ELIM04. I need only rules ELIM01 and
-
Hi Im having issues with my brand new TV. The Skype camera which is supposed to power on when the tv is powered on and smart hub activated seems never to work when needed. Its meant to come up with a blue light to show its connected and powere availa
-
Select fields from Table PA0001 where condition in PA0000 EQ X.
I'm quite new here at SDN an to ABAP as my code below will show. =) I have two tables PA0001 and PA0000 and I want to show the PERNR from Table PA0001 WHERE PA0000-stat2 EQ '3'. SELECT PERNR STAT2 FROM pa0000 INTO CORRESPONDING FIELDS OF TABLE it_ac
-
Windows 7 event viewer error after 9.1 update
*Log Name: Application* *Source: Bonjour Service* *Date: 4/11/2010 8:06:33 PM* *Event ID: 100* *Task Category: None* *Level: Error* *Keywords: Classic* *User: N/A* *Computer: CHEVYSALES* Description: *288: ERROR: read_msg errno 10054 (An existing con
-
Recently I enjoyed taking my old 8mm video movies and editing them on my iMac G5 als. Shortly, a bunch of our friends will get a "favorite cat clips" video chronicling 12 years of our feline friends. Don't mean to go astray of this "iMAC Use" forum,