Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » StackOverflowError on EPackageRegistryImpl(Unable to launch product due to EMF initialization issue)
StackOverflowError on EPackageRegistryImpl [message #1767424] Wed, 05 July 2017 21:30 Go to next message
Babu M is currently offline Babu MFriend
Messages: 20
Registered: February 2012
Junior Member
By using neon, I am trying to setup a target and build a product out of this target.

A detailed log file is attached

When I try to launch product which is build from the targets.
I am experiencing a StackoverflowError. Any help is highly appreciated.

The exception is as follows:

	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass(
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at autosar40.diagnosticextract.dcm.obdservice.mode_0x03_0x07_requestemissionrelateddtc.Mode_0x03_0x07_requestemissionrelateddtcFactory.<clinit>(
	at autosar40.diagnosticextract.dcm.obdservice.mode_0x03_0x07_requestemissionrelateddtc.impl.Mode_0x03_0x07_requestemissionrelateddtcPackageImpl.<init>(
	at autosar40.diagnosticextract.dcm.obdservice.mode_0x03_0x07_requestemissionrelateddtc.impl.Mode_0x03_0x07_requestemissionrelateddtcPackageImpl.init(
	at autosar40.diagnosticextract.dcm.obdservice.mode_0x03_0x07_requestemissionrelateddtc.Mode_0x03_0x07_requestemissionrelateddtcPackage.<clinit>(
	at sun.misc.Unsafe.ensureClassInitialized(Native Method)
	at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unknown Source)
	at sun.reflect.ReflectionFactory.newFieldAccessor(Unknown Source)
	at java.lang.reflect.Field.acquireFieldAccessor(Unknown Source)
	at java.lang.reflect.Field.getFieldAccessor(Unknown Source)
	at java.lang.reflect.Field.get(Unknown Source)
	at org.eclipse.emf.ecore.plugin.RegistryReader$EPackageDescriptor.getEPackage(
	at org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage(
  • Attachment: .log
    (Size: 300.32KB, Downloaded 130 times)
Re: StackOverflowError on EPackageRegistryImpl [message #1767430 is a reply to message #1767424] Thu, 06 July 2017 04:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 32163
Registered: July 2009
Senior Member
I see a bunch of warnings in the log that suggest you're likely to have problems looking up the correct implementation class from the package's nsURI:
!ENTRY org.eclipse.emf.ecore 2 0 2017-07-05 22:33:05.833
!MESSAGE Both 'org.artop.aal.autosar402' and 'org.artop.aal.autosar403' register a package for ''
I'm not sure that would cause initialization problems though. In any case, looking at the stack overflow, I don't see duplicates so there isn't some circularity causing the problems; it's just a chain of 102 packages being initialized based on dependencies from one to the other. It looks like you need to increase the stack size:
Note that if you don't want to increase the stack size for all threads, you might create a thread programmatically, with a large enough stack size to initialize the packages, and do the initialization on that thread.

Ed Merks
Professional Support:
Re: StackOverflowError on EPackageRegistryImpl [message #1767448 is a reply to message #1767430] Thu, 06 July 2017 08:19 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7382
Registered: July 2009
Senior Member

Increasing the stack size may well make the problem go away. Not having both autosar402 and autosar403 installed may help. But fundamentally the very dubious practice of a huge number of nested installed packages appears to expose a weakness in the autogenerated Java EPackage initialization. It appears that many packages are ensuring that many other packages are initialized first in such a complex fashion that the stack trace duplicate entry detector fails to spot the duplicates. This appears to be poor AUTOSAR design in that everything depends on everything in a too cyclic graph rather than a directed tree. It is actually possible to get this problem with just EMF plus one other EPackage; it is solved by ensuring that EMF is explicitly initialized first.

Since you probably do not want to redesign AUTOSAR, I suggest that you write an AUTOSARResourcesUtil.init() that ensures that each AUTOSAR package is initialized in a disciplined order. Similar to UMLResourcesUtil.init() it can probably do quite a lot of other useful initialization jobs. Maybe it already exists and you neglected to call it.


Ed Willink
Previous Topic:[Edapt] DiagnosticException while migrating
Next Topic:[EMF Forms] Table: Single column for different EStructuralFeatures
Goto Forum:

Current Time: Thu Jan 27 05:45:51 GMT 2022

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

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

Back to the top