Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » ElipseLink configuration problem in E4 RCP app(EclipseLink works fine in a test but not within e4 RCP)
ElipseLink configuration problem in E4 RCP app [message #1412711] Tue, 26 August 2014 22:19 Go to next message
Don Smyth is currently offline Don SmythFriend
Messages: 35
Registered: April 2013
Member
I have read a few issues by people not being able to get EclipseLink running within an RCP application. I haven't been able to solve this issue yet.

When the code below is run in a test suite persistence work fine. However an error is thrown on line 2 when I run this from an e4 RCP application:
		EntityManagerFactoryHelper emFactoryHelper = new EntityManagerFactoryHelper();
		em = emFactoryHelper.getFactory().createEntityManager();


Error:
javax.persistence.PersistenceException: Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Unable to acquire a connection from driver [net.sf.log4jdbc.DriverSpy], user [sa] and URL [jdbc:hsqldb:hsql://localhost/test].  Verify that you have set the expected driver class and URL.  Check your login, persistence.xml or sessions.xml resource.  The jdbc.driver property should be set to a class that is compatible with your database platform
Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:hsqldb:hsql://localhost/test


persistence.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<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"
  version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
  <persistence-unit name="parameters" transaction-type="RESOURCE_LOCAL">
  <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>com.test.jpa.Model</class>
  </persistence-unit>
</persistence> 


Manifest in persistence plugin:
... Eclipse-RegisterBuddy: com.test.mainapp  ..


Manifest in main application:
... Eclipse-BuddyPolicy: registered ...

I also added the following to mainifest in the main app, though I think it is only relevent for OSGI bundles rather than plugins:
JPA-PersistenceUnits: com.test.jpa


NB I am using plugins rather than OSGI bundles, and com.test.jpa is the persistence plugin.


Re: ElipseLink configuration problem in E4 RCP app [message #1412834 is a reply to message #1412711] Wed, 27 August 2014 07:26 Go to previous message
Don Smyth is currently offline Don SmythFriend
Messages: 35
Registered: April 2013
Member
Doh! I changed the log4jdbc.DriverSpy to the hsqldb jdbc driver and all works fine.
Previous Topic:Generating Metadata using M2E
Next Topic:Right outer join
Goto Forum:
  


Current Time: Fri Mar 06 20:08:19 GMT 2015

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

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