Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » ClassLoader Problem
ClassLoader Problem [message #636755] Tue, 02 November 2010 16:40 Go to next message
Roberto  is currently offline Roberto Friend
Messages: 4
Registered: November 2010
Junior Member
Hi to all,
I've a problem with runtime ClassLoader; this is my situation:

Have a Main project and other sub-projects, everyone with own persistence.xml; a custom ClassLoader load all classes from sub-projects' jars at runtime.

I need to create an EntityManagerFactory ("emf") for every jar loaded, specifing connection parameters, driver ... as ClassLoader set my customClassLoader. When an "emf" is created it has an internal "managedClassList" with entity names read in it's own persistence.xml.

But when create an EntityManager (emf.createEntityManager() or emf.createEntityManager(map)), this has no entities inside. I suppose it's a ClassLoader's problem, it's seems that my custom ClassLoader is not used and the entities that are in "managedClassList" will not be founded.

The problem doesn't exist if insert all sub-projects inside Main probject's libs, instead of load them at runtime.

How can I resolve my problem? Have to specify a particupar property to EntityManagerFactory?

Thanks in advance and good evening,
Roberto
Re: ClassLoader Problem [message #637194 is a reply to message #636755] Thu, 04 November 2010 14:42 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Are you passing your custom class loader in the persistence properties when you create your emf?

There is a "eclipselink.classloader" property for this.

Are you using OSGI? Have you investigated EclipseLink's OSGI support?


James : Wiki : Book : Blog : Twitter
Re: ClassLoader Problem [message #637846 is a reply to message #636755] Tue, 09 November 2010 07:41 Go to previous message
Roberto  is currently offline Roberto Friend
Messages: 4
Registered: November 2010
Junior Member
Yes i set my custom classloader to emf with property: "eclipselink.classloader".

I'm not using OSGi ... what benefit could I get? It could solve my problem?

Thanks for help,
Roberto

Previous Topic:HSQLDB 2 and Internal Exception: Error Code -5501
Next Topic:CriteriaBuilder and ManyToOne Entity
Goto Forum:
  


Current Time: Thu Apr 25 17:57:11 GMT 2024

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

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

Back to the top