Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » OSGI troubles with createEntityManagerFactory
OSGI troubles with createEntityManagerFactory [message #379261] Mon, 11 August 2008 19:00 Go to next message
Eclipse UserFriend
Originally posted by: beat.stradax.net

Hi there

I'd like to use EclipseLink in an OSGi server environment (Equinox),
but I can't get an EntityManagerFactory. I've done some successful
tests with a milestone some weeks/months ago, but this doesn't work
anymore.

When I try to get the EntityManagerFactory in the Activator's start
method of the bundle that contains the persistence.xml
(javax.persistence and org.eclipse.persistence.jpa are started one
osgi start level before), I get the following errors:

1) When I don't specify any properties:
Persistence.createEntityManagerFactory("unitname");

The OSGiPersistenceInitializationHelper#getClassLoader is called
with "bundleresource://7/unitname" and doesn't find an entry for this,
because the map contains only a key "unitname".

2) When I specify Thread.currentThread().getContextClassLoader() as a
class loader property, this class loader doesn't find the resource
"META-INF/persistence.xml" in
PersistenceProvider#createEntityManagerFactory:95.

What am I doing wrong?

BTW: it would be very helpful when the EclipseLink website would
provide an OSGi SDK zip download which contains the source plugins. I
had to checkout the projects from the SVN tag to debug the problem...

Thanks for any hint,
Beat Strasser
Re: OSGI troubles with createEntityManagerFactory [message #379262 is a reply to message #379261] Mon, 11 August 2008 19:24 Go to previous message
Eclipse UserFriend
Originally posted by: beat.stradax.net

> 1) When I don't specify any properties:
> Persistence.createEntityManagerFactory("unitname");
>
> The OSGiPersistenceInitializationHelper#getClassLoader is called with
> "bundleresource://7/unitname" and doesn't find an entry for this,
> because the map contains only a key "unitname".
>
> 2) When I specify Thread.currentThread().getContextClassLoader() as a
> class loader property, this class loader doesn't find the resource
> "META-INF/persistence.xml" in
> PersistenceProvider#createEntityManagerFactory:95.

Well ok. With a class loader property
"this.getClass().getClassLoader()" it works.

Beat
Previous Topic:Fisheye on EclipseLink
Next Topic:ManyToMany: Why is no exception thrown?
Goto Forum:
  


Current Time: Thu Apr 25 21:48:09 GMT 2024

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

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

Back to the top