| ClassLoader Problem [message #636755] |
Tue, 02 November 2010 12:40  |
Roberto 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 10:42   |
James Sutherland Messages: 1844 Registered: July 2009 |
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
|
|
|
| Re: ClassLoader Problem [message #637846 is a reply to message #636755] |
Tue, 09 November 2010 02:41  |
Roberto 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
|
|
|
Powered by
FUDForum. Page generated in 0.01737 seconds