[Teneo] Multiple class loader problem [message #988739] |
Sun, 02 December 2012 06:03  |
Eclipse User |
|
|
|
We are experiencing some problems inside an EAR deployment. (yes i know we should use Texo, but it's not feasible for now).
Inside our EAR we have some web services, some servlets and some EJB.
We are registering our hbds with the following code in a static syncronized method, so we get only one hbds instance.
hbds=HbHelper.INSTANCE.createRegisterDataStore(dataStoreId);
hbds.setDataStoreProperties(props);
hbds.setEPackages(new EPackage[]{ViewshapemodelPackage.eINSTANCE});
hbds.initialize();
We tracked down the problem to the following method:
public static synchronized EPackage.Registry getRegistry(ClassLoader classLoader)
{
EPackage.Registry result = classLoaderToRegistryMap.get(classLoader);
if (result == null)
{
if (classLoader != null)
{
result = new EPackageRegistryImpl(getRegistry(classLoader.getParent()));
classLoaderToRegistryMap.put(classLoader, result);
}
}
return result;
}
inside EPackageRegistryImpl
From what i get, withh classLoaderToRegistryMap EMF tracks an EPackage registry for each classloader, but somehow, such registry is only initialized for one classloadr, and not for all classloaders involved.
Any hint on how to fix this behaviour?
thank you
|
|
|
Re: [Teneo] Multiple class loader problem [message #988741 is a reply to message #988739] |
Sun, 02 December 2012 06:36   |
Eclipse User |
|
|
|
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Cristian,<br>
<br>
You could use this VM option to specify just the plain old
(non-classloader-scoped) package registry implementation:<br>
<blockquote>-Dorg.eclipse.emf.ecore.EPackage.Registry.INSTANCE=org.eclipse.emf.ecore.impl.EPackageRegistryImpl<br>
</blockquote>
<br>
<br>
<div class="moz-cite-prefix">On 02/12/2012 12:03 PM, Cristian
Prevedello wrote:<br>
</div>
<blockquote cite="mid:k9fchn$2e5$1@xxxxxxxxe.org" type="cite">We
are experiencing some problems inside an EAR deployment. (yes i
know we should use Texo, but it's not feasible for now).
<br>
<br>
Inside our EAR we have some web services, some servlets and some
EJB.
<br>
<br>
We are registering our hbds with the following code in a static
syncronized method, so we get only one hbds instance.
<br>
<br>
hbds=HbHelper.INSTANCE.createRegisterDataStore(dataStoreId);
<br>
<br>
hbds.setDataStoreProperties(props);
<br>
hbds.setEPackages(new
EPackage[]{ViewshapemodelPackage.eINSTANCE});
<br>
hbds.initialize();
<br>
<br>
<br>
We tracked down the problem to the following method:
<br>
<br>
public static synchronized EPackage.Registry
getRegistry(ClassLoader classLoader)
<br>
{
<br>
EPackage.Registry result =
classLoaderToRegistryMap.get(classLoader);
<br>
if (result == null)
<br>
{
<br>
if (classLoader != null)
<br>
{
<br>
result = new
EPackageRegistryImpl(getRegistry(classLoader.getParent()));
<br>
classLoaderToRegistryMap.put(classLoader, result);
<br>
}
<br>
}
<br>
return result;
<br>
}
<br>
<br>
inside EPackageRegistryImpl
<br>
<br>
From what i get, withh classLoaderToRegistryMap EMF tracks an
EPackage registry for each classloader, but somehow, such registry
is only initialized for one classloadr, and not for all
classloaders involved.
<br>
<br>
Any hint on how to fix this behaviour?
<br>
<br>
thank you
<br>
</blockquote>
<br>
</body>
</html>
|
|
|
Re: [Teneo] Multiple class loader problem [message #989231 is a reply to message #988741] |
Wed, 05 December 2012 05:08  |
Eclipse User |
|
|
|
Thank you for your answer, as it fixed the problem. Anyhow we have other issues now on redeployment and we would like to avoid to change jvm options anyhow.
We'll keep this as temporary fix, but your answer pointed me in the right direction, and we'll solve the problem at the root.
best regards.
|
|
|
Powered by
FUDForum. Page generated in 0.05764 seconds