Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » ClassLoader Problem
ClassLoader Problem [message #636755] Tue, 02 November 2010 12:40 Go to next message
Eclipse UserFriend
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 10:42 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: ClassLoader Problem [message #637846 is a reply to message #636755] Tue, 09 November 2010 02:41 Go to previous message
Eclipse UserFriend
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 Jul 10 03:13:28 EDT 2025

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

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

Back to the top