Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] Multiple class loader problem
[Teneo] Multiple class loader problem [message #988739] Sun, 02 December 2012 11:03 Go to next message
Cristian Prevedello is currently offline Cristian PrevedelloFriend
Messages: 33
Registered: June 2011
Member
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 11:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
<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>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Teneo] Multiple class loader problem [message #989231 is a reply to message #988741] Wed, 05 December 2012 10:08 Go to previous message
Cristian Prevedello is currently offline Cristian PrevedelloFriend
Messages: 33
Registered: June 2011
Member
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.
Previous Topic:[CDO] How to know if a view is in audit mode
Next Topic:EMF transactions - why the special ExtendedPropertySheetPage?
Goto Forum:
  


Current Time: Fri Apr 26 00:57:21 GMT 2024

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

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

Back to the top