If you are in OSGi your JDBC drivers should be bundles.
Unfortunately Oracle does not yet provide JDBC driver and related
jars as bundles, but you can always wrap the Oracle JDBC driver in
bundle along with a Manifest. In the EclipseLink SVN repository
there's a PDE project that defines a bundle that simply wraps a
number of Oracle provided bundles that are necessary to compile
EclipseLink's Oracle specific features [1]. Here's a link to the 2.3
version: http://dev.eclipse.org/viewcvs/viewvc.cgi/branches/2.3/trunk/foundation/targets/?root=RT_PERSISTENCE.
If you drop the required jars into the oracle.lib folder you're
ready to go. If you don't have all the referenced jars then you'll
have to adjust the Manifest.
You could also use BND to add an OSGi Manifest to an Oracle JDBC
driver jar.
In terms of Gemini JPA, it is approaching 1.0 so you may want to
give it a try--however the need for OSGi JDBC bundles remains.
Actually, it's slightly more complicated as Gemini JPA expects JDBC
drivers are OSGi Enterprise Specification compliant--and you'd have
to do a little coding to get Oracle working as the Gemini DBAccess
project currently only ships MySQL and Derby drivers.
Hope this helps,
Shaun
[1] Oracle jars expected in oracle.lib bundle:
aqapi.jar
dms.jar
ojdbc5.jar
sdoapi.jar
ucp.jar
xdb.jar
xml.jar
xmlparserv2.jar
On 08/11/2011 3:56 AM, cliviu75 wrote:
Shaun Smith wrote:
Hi,
You're getting an exception because you've specified that you must
have weaving but EclipseLink is unable to weave. To see how weaving can
be enabled in OSGi take a look at:
http://wiki.eclipse.org/EclipseLink/Examples/OSGi/Equinox_Byte_Code_Weaving.
However this approach is sensitive to bundle start order and you'll have
to ensure that your RCP main is run last.
Note that the current EclipseLink OSGi support will eventually be
replaced by Gemini JPA. This will provide you with an OSGi Enterprise
specification compliant way to use EclipseLink JPA. There was a thread
on the Gemini thread recently on RCP usage:
http://www.eclipse.org/forums/index.php/t/244936/
Shaun
Thank you Shaun, I have tried. With this approach I also have the same
problem. I'm not sure if the problem is that my oracle jdbc drivers are not
used as osgi bundles but as direct jar libraries.
Caused by: javax.persistence.PersistenceException: Exception
[EclipseLink-28022] (Eclipse Persistence Services - 2.3.0.v20110604-r9504):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Value [true] for the property [eclipselink.weaving]
is incorrect when global instrumentation is null, value should either be
null, false, or static.
at
org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializer.checkWeaving(JavaSECMPInitializer.java:123)
at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:88)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:105)
... 17 more
Do you think I should use the Gemini JPA ? I'm not sure what happens if I
use the Oracle jdbc drivers as library.
Thanks,
Liviu
--
Shaun Smith | Principal Product Manager
Phone: +1.905.502.3094 | Mobile: +1.416.558.6244
Oracle Fusion Middleware, TopLink
ORACLE Canada | 100 Milverton Drive, Mississauga, Ontario | L5R
4H1
Oracle is committed to developing practices and
products that help protect the environment
|