Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » JPA with Eclipselink MySQL jdbc in Eclipse RAP/RCP
JPA with Eclipselink MySQL jdbc in Eclipse RAP/RCP [message #902928] Tue, 21 August 2012 08:51 Go to next message
Tomas Kramaric is currently offline Tomas KramaricFriend
Messages: 8
Registered: August 2012
Junior Member
System overview:

* Eclipse Indigo for RAP RCP devs, RAP 1.4 Target Components, Dali JPA, Jre1.6.0_33 (Java1.6SE) local oracle mysql db
* all JPA (Persistence) + Eclipse link OSGi bundles imported in project (according to eclipse wiki)
* OSGi bundle containing com.mysql.jdbc.Driver class imported in project (latest 5.1.21 ? from Oracle page)
* persistence plugin created via JPA, with jdbc driver,correct mysql db path, correct password & user (added dependency to com.mysql.jdbc bundle)

To avoid ClassLoader problem:

*bundle/plugin com.mysql.jdbc has in its MANIFEST.MF: Bundle-BuddyPolicy: registered
*org.eclipse.persistence.core & org.eclipse.persitence.jpa and mine "persistence bundle" having Buddy registered in their MANIFEST.MF : Eclipse-RegisterBuddy:com.mysql.jdbc + they have dependency to this bundle com.mysql.jdbc


* even after all previous steps I have still: ClassNotFoundException - Driver not found


* connection to localhost mysql db tested from inside Eclipse DatabaseConnection, used same driver from bundle com.mysql.jdbc (class com.mysql.jdbc.Driver) [OK]
* if org.apache.derby Embedded db with Embeded driver is used for persistence (instead of mysql) (with same Buddy policy), problem does not appear - everything works fine


* could it be problem still with ClassLoaders even if BuddyPolicy applied ?
* could it be problem in driver itselves, when its used as OSGi bundle ?
* has somebody ever try to use this com.mysql.osgi bundle in RCP or RAP together with JPA+Eclipselink ?

Re: JPA with Eclipselink MySQL jdbc in Eclipse RAP/RCP [message #909127 is a reply to message #902928] Thu, 06 September 2012 15:30 Go to previous messageGo to next message
Charlie Mordant is currently offline Charlie MordantFriend
Messages: 88
Registered: July 2010

What do you thing about using Gemini-JPA, it works well with me
Re: JPA with Eclipselink MySQL jdbc in Eclipse RAP/RCP [message #986231 is a reply to message #902928] Mon, 19 November 2012 14:29 Go to previous messageGo to next message
null null is currently offline null nullFriend
Messages: 1
Registered: November 2012
Junior Member
Tomas do you solve the problem?
Re: JPA with Eclipselink MySQL jdbc in Eclipse RAP/RCP [message #990683 is a reply to message #902928] Thu, 13 December 2012 19:17 Go to previous message
Mariusz Cwikla is currently offline Mariusz CwiklaFriend
Messages: 15
Registered: January 2012
Junior Member
Hello Thomas,
I think that your problem is not RAP/RCP related, but OSGi generally.

1. First of all, I'd check if your connection-bundle is loaded (use "ss" command in console)

2. On the other hand I would recommend to use Blueprint Container. I'm using Apache Aries as blueprint container + OpenJPA and two databases (H2 and Oracle). It works like a charm.

It was a few months ago, but I remember few facts from time when I tried to evaluate JPA with OSGi. Here are my observations:
- Hibernate have too much problems when using with OSGi
- EclipseLink works great with OSGi, but I also wanted to use JTA, so I looked over Apache Aries. I found out that as it works fine when you use EclipseLink + JDBC but it could not run when I used EclipseLink+Aries+JDBC
- OpenJPA works great with OSGi, but it also works great with Apache Aries. Right now I stick to this.

3. I digged up my very simple project that used EclipseLink with JDBC directly - see attachment. What's needed (example is based on HSQLDB):
- META-INF/MANIFEST.MF: add just this (it's name of your PU)
JPA-PersistenceUnits: jpa-osgi-resourcelocal 

- META-INF/persistence.xml:
	<?xml version="1.0" encoding="UTF-8"?>
	<persistence version="2.0" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
		<persistence-unit name="jpa-osgi-resourcelocal" transaction-type="RESOURCE_LOCAL">
				<property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:hsql://localhost:9001/mydb"/>
				<property name="javax.persistence.jdbc.user" value="sa"/>
				<property name="javax.persistence.jdbc.password" value=""/>
				<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/>

- here is list of bundles from running console - it can show you what's should be present in OSGi environment in order to run EclipseLink:

id	State       Bundle
0	ACTIVE      org.eclipse.osgi_3.8.0.v20120123-1419
1	ACTIVE      org.eclipse.equinox.console_1.0.0.v20111215-1210
2	ACTIVE      org.eclipse.persistence.asm_3.3.1.v201206041142
7	ACTIVE      org.eclipse.persistence.core_2.4.0.v20120608-r11652
9	ACTIVE      org.hsqldb.hsqldb_2.2.8
11	ACTIVE      org.eclipse.persistence.antlr_3.2.0.v201206041011
12	ACTIVE      javax.persistence_2.0.4.v201112161009
14	ACTIVE      org.eclipse.osgi.services_3.3.0.v20111117-1210
15	ACTIVE      org.apache.felix.gogo.shell_0.8.0.v201110170705
16	ACTIVE      org.eclipse.persistence.jpa.osgi_2.4.0.v20120608-r11652
17	ACTIVE      org.eclipse.persistence.jpa_2.4.0.v20120608-r11652
20	ACTIVE      org.apache.felix.gogo.runtime_0.8.0.v201108120515
31	ACTIVE      org.eclipse.persistence.jpa.jpql_2.0.0.v20120608-r11652
34	ACTIVE      jpa-osgi-resourcelocal_1.0.0.qualifier

I hope I helped.

[Updated on: Thu, 13 December 2012 19:29]

Report message to a moderator

Previous Topic:Eclipse RAP RWT Theming
Next Topic:Table cell padding not working when markup is enabled
Goto Forum:

Current Time: Wed Dec 01 13:45:32 GMT 2021

Powered by FUDForum. Page generated in 0.01966 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top