Is the driver class visible to the bundle declaring the persistence
unit (with the manifest entry JPA-PersistenceUnits:) or is a
classloader that can see the driver passed to
createEntityManagerFactory? Today this is necessary in the
EclipseLink OSGi JPA implementation. The OSGi JPA spec defines a
service based JDBC driver resolution mechanism which will be coming
when Gemini JPA ships.
Shaun
On 17/5/2010 3:31 PM, Daoud AbdelMonem Faleh wrote:
Hi All,
Am trying to get a basic JPA example working inside Karaf 1.4.0
I have two bundles, one containing only model classes and the other
using the JPA to persist an instance of the class model.
Although all bundles resolve correctly EclipseLink fail to find the Driver.
this is the relevant parts of osgi:list output:
[ 65] [Active ] [ ] [ 60] EclipseLink JPA
(2.0.2.v20100323-r6872)
[ 66] [Active ] [ ] [ 60] Java Persistence API 2.0
(2.0.0.v201005141517)
[ 67] [Active ] [ ] [ 60] EclipseLink Core
(2.0.2.v20100323-r6872)
[ 68] [Active ] [ ] [ 60] EclipseLink ASM
(2.0.2.v20100323-r6872)
[ 69] [Active ] [ ] [ 60] SimpleModel OSGi Bundle
(1.0.0.SNAPSHOT)
[ 72] [Resolved ] [ ] [ 60] SimpleJPATest OSGi Bundle
(1.0.0.SNAPSHOT)
[ 74] [Active ] [ ] [ 60]
wrap_mvn_postgresql_postgresql_8.4-701.jdbc4 (0)
and here the stacktrace when I start bundle 72:
karaf@root> osgi:start 72
[EL Config]: 2010-05-17
18:15:23.383--ServerSession(18656321)--Thread(Thread[Karaf Shell Console
Thread,5,main])--The access type for the persistent class [class
org.antholoj.osgi.jpa.simplemodel.Message] is set to [FIELD].
[EL Config]: 2010-05-17
18:15:23.385--ServerSession(18656321)--Thread(Thread[Karaf Shell Console
Thread,5,main])--The alias name for the entity class [class
org.antholoj.osgi.jpa.simplemodel.Message] is being defaulted to: Message.
[EL Config]: 2010-05-17
18:15:23.386--ServerSession(18656321)--Thread(Thread[Karaf Shell Console
Thread,5,main])--The column name for element [field messageContent] is
being defaulted to: MESSAGECONTENT.
[EL Config]: 2010-05-17
18:15:23.387--ServerSession(18656321)--Thread(Thread[Karaf Shell Console
Thread,5,main])--The column name for element [field phoneNumnber] is
being defaulted to: PHONENUMNBER.
[EL Config]: 2010-05-17
18:15:23.388--ServerSession(18656321)--Thread(Thread[Karaf Shell Console
Thread,5,main])--The column name for element [field messageId] is being
defaulted to: MESSAGEID.
[EL Info]: 2010-05-17
18:15:23.391--ServerSession(18656321)--Thread(Thread[Karaf Shell Console
Thread,5,main])--EclipseLink, version: Eclipse Persistence Services -
2.0.2.v20100323-r6872
[EL Severe]: 2010-05-17
18:15:23.393--ServerSession(18656321)--Thread(Thread[Karaf Shell Console
Thread,5,main])--Local Exception Stack:
Exception [EclipseLink-4003] (Eclipse Persistence Services -
2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Configuration error. Class
[org.postgresql.Driver] not found.
at
org.eclipse.persistence.exceptions.DatabaseException.configurationErrorClassNotFound(DatabaseException.java:82)
at
org.eclipse.persistence.sessions.DefaultConnector.loadDriverClass(DefaultConnector.java:267)
at
org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:85)
at
org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
at
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:584)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:228)
at
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:369)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:151)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:207)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:195)
at
org.antholoj.osgi.jpa.simplejpatest.Activator.start(Activator.java:24)
at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:661)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1756)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1678)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:892)
at
org.apache.felix.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:29)
at
org.apache.felix.karaf.shell.osgi.BundlesCommand.doExecute(BundlesCommand.java:49)
at
org.apache.felix.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:41)
at
org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:34)
at
org.apache.felix.gogo.runtime.shell.CommandProxy.execute(CommandProxy.java:45)
at org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:211)
at
org.apache.felix.gogo.runtime.shell.Closure.executeStatement(Closure.java:146)
at org.apache.felix.gogo.runtime.shell.Pipe.run(Pipe.java:91)
at org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:75)
at
org.apache.felix.gogo.runtime.shell.CommandSessionImpl.execute(CommandSessionImpl.java:71)
at
org.apache.felix.karaf.shell.console.jline.Console.run(Console.java:174)
at java.lang.Thread.run(Thread.java:619)
Error executing command: Activator start error in bundle
org.antholoj.osgi.jpa.SimpleJPATest [72].
Am not sure what's missing here so EclipseLink could find the Driver.
With best regards,
Daoud AbdelMonem Faleh.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Shaun Smith | Principal
Product Manager
Phone: +19055023094
Oracle Server Technologies, Oracle TopLink
ORACLE Canada | 110 Matheson Boulevard West, Suite 100, Mississauga,
Ontario | L5R 3P4
Oracle is committed to
developing practices and products that help protect the environment
|