Home » Modeling » EMF » NoClassDefFoundError on AggregateProxyPackage
NoClassDefFoundError on AggregateProxyPackage [message #921612] |
Mon, 24 September 2012 09:18 |
Eclipse User |
|
|
|
Hello,
[I already asked in the QVT group but the more I analyze this the more I
feel the root cause is in the EMF part of my eclips installation.]
I'm getting the following fatal error with a QVT project:
java.lang.NoClassDefFoundError: Could not initialize class
org.eclipse.emf.facet.aggregate.metamodel.v0_2_0.aggregate.internal.aggregateProxy.AggregateProxyPackage
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at
sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
at
sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:140)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:936)
at java.lang.reflect.Field.getFieldAccessor(Field.java:917)
at java.lang.reflect.Field.get(Field.java:376)
at
org.eclipse.emf.ecore.plugin.RegistryReader$EPackageDescriptor.getEPackage(RegistryReader.java:273)
at
org.eclipse.emf.ecore.impl.EPackageImpl$1.getEPackage(EPackageImpl.java:162)
at
org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage(EPackageRegistryImpl.java:127)
at
org.eclipse.m2m.internal.qvt.oml.emf.util.mmregistry.EmfMetamodelDesc.getModel(EmfMetamodelDesc.java:64)
The OSG console says:
osgi> ss agg
"Framework is launched."
id State Bundle
289 STARTING org.eclipse.birt.data.aggregation_4.2.0.v20120611
539 ACTIVE org.eclipse.emf.facet.aggregate.doc_0.2.0.v201206120903
540 ACTIVE
org.eclipse.emf.facet.aggregate.metamodel_0.2.0.v201206120903
541 ACTIVE
org.eclipse.emf.facet.aggregate.metamodel.notgenerated_0.2.0.v201206120903
I can't open the class AggregateProxyPackage though in the editor
(Ctrl+Shift+T).
What could possibly be wrong with my installation?!?
TIA
Marius
|
|
| |
Re: NoClassDefFoundError on AggregateProxyPackage [message #921697 is a reply to message #921635] |
Mon, 24 September 2012 10:53 |
Eclipse User |
|
|
|
On 24.09.2012 11:38, Ed Merks wrote:
> Maybe there are other messages in the Error log? It looks like it's not
> simply not finding the class, but that it's having a problem while
> initializing it that class...
Thanks for the hint, it got me closer to the root cause. Indeed it seems
there's an NPE in AggregatePackageImpl, but for some weired reason I'm
unable to browse the source of any of the classes beneath
org/eclipse/emf/facet/aggregate/. What's even more strange is that when
I set a breakpoint for NPE I am shown the source of AggregatePackageImpl
and I can see which variable is null (aggregateEClass) - but I can't set
any breakpoints in there, like to trace when/if createPackageContents()
is being called.
ls eclipse/plugins/*aggreg* shows:
drwxrwxr-x 6 mgroeger mgroeger 4096 Aug 16 11:18
org.eclipse.emf.facet.aggregate.doc_0.2.0.v201206120903
-rw-rw-r-- 1 mgroeger mgroeger 6728 Aug 16 11:18
org.eclipse.emf.facet.aggregate.doc.source_0.2.0.v201206120903.jar
-rw-rw-r-- 1 mgroeger mgroeger 94889 Aug 16 11:18
org.eclipse.emf.facet.aggregate.metamodel_0.2.0.v201206120903.jar
-rw-rw-r-- 1 mgroeger mgroeger 25705 Aug 16 11:18
org.eclipse.emf.facet.aggregate.metamodel.notgenerated_0.2.0.v201206120903.jar
-rw-rw-r-- 1 mgroeger mgroeger 22912 Aug 16 11:18
org.eclipse.emf.facet.aggregate.metamodel.notgenerated.source_0.2.0.v201206120903.jar
-rw-rw-r-- 1 mgroeger mgroeger 54803 Aug 16 11:18
org.eclipse.emf.facet.aggregate.metamodel.source_0.2.0.v201206120903.jar
Help!
Marius
|
|
| |
Re: NoClassDefFoundError on AggregateProxyPackage [message #921753 is a reply to message #921715] |
Mon, 24 September 2012 11:49 |
Eclipse User |
|
|
|
On 24.09.2012 13:13, Ed Merks wrote:
> Maybe it will help if via the PDE's Plug-ins view you select all the
> plugins (or at least these) and tell it to add them to Java search. Then
> Ctrl-Shift-T should locate them and then you should be able to set
> breakpoints.
Thanks, that helped a lot. I think I'm now able to pinpoint a bug in the
initialization order of this facet stuff:
- AggregateProxyPackage:init() is called
- AggregatePackageImpl theAggregatePackage = ... assignment causes
partial setup of AggregatePackage
(As a side note, in my version this line features a whopping 269
characters on a single line, including a double access to the
model registry. Perhaps the codegen templates should be changed to
insert some line breaks and/or cache the registry lookup.)
- AggregatePackageImpl.initializePackageContents() is called, but this
methods expects that AggregatePackageImpl.createPackageContents()
has already been called to have a valid 'aggregateEClass'. But
aggregateEClass is still null and so I get an NPE.
- theAggregatePackage.createPackageContents() is called - too late!
So what are my options:
a) should I file a bug?
b) is there any work around?
Thanks
Marius
|
|
|
Re: NoClassDefFoundError on AggregateProxyPackage [message #921779 is a reply to message #921753] |
Mon, 24 September 2012 12:15 |
Eclipse User |
|
|
|
On 24.09.2012 13:49, Marius Gröger wrote:
> Thanks, that helped a lot. I think I'm now able to pinpoint a bug in the
> initialization order of this facet stuff:
....
> b) is there any work around?
Notice that when I call:
AggregatePackage pkg = AggregatePackage.eINSTANCE;
in an IStartup class, the issue goes away. Apparently in my specific use
case (QVT, XSD Ecore models) the AggregateProxyPackage is tried to be
initialized first, which does not work due to a bug in the init code.
Regards
Marius
|
|
|
Re: NoClassDefFoundError on AggregateProxyPackage [message #921865 is a reply to message #921779] |
Mon, 24 September 2012 13:55 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Marius,
I could imagine that if different threads try to initialize different
packages that depend on each other, things might go wrong. Even locks
don't help in this kind of case; they'd just cause deadlock. If you
know the set of packages you're going to use, it's a good workaround to
initialize them early.
On 24/09/2012 2:15 PM, Marius Gröger wrote:
> On 24.09.2012 13:49, Marius Gröger wrote:
>> Thanks, that helped a lot. I think I'm now able to pinpoint a bug in the
>> initialization order of this facet stuff:
> ...
>> b) is there any work around?
> Notice that when I call:
>
> AggregatePackage pkg = AggregatePackage.eINSTANCE;
>
> in an IStartup class, the issue goes away. Apparently in my specific use
> case (QVT, XSD Ecore models) the AggregateProxyPackage is tried to be
> initialized first, which does not work due to a bug in the init code.
>
> Regards
> Marius
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: NoClassDefFoundError on AggregateProxyPackage [message #921890 is a reply to message #921865] |
Mon, 24 September 2012 14:24 |
Eclipse User |
|
|
|
On 24.09.2012 15:55, Ed Merks wrote:
> Marius,
>
> I could imagine that if different threads try to initialize different
> packages that depend on each other, things might go wrong. Even locks
> don't help in this kind of case; they'd just cause deadlock. If you
> know the set of packages you're going to use, it's a good workaround to
> initialize them early.
Hm. Well, the issue appears fully reproducible with my setup, and that
includes(!) both my development Eclipse instance as well as runtime. It
seems to me that consistently AggreateProxyPackage is initialized first.
It really doesn't looks to be a glitch. I really wonder if this works
anywhere correctly. Putting it differently: as some knowing all this so
much better - from what place would you say is AggregatePackage are
AggreateProxyPackage "usually" accessed/inited first?
Btw, notice my usage in conjunction with QVT and XSD Ecore, which
appears not to be used _that_ widely.
Secondly, my work around is a magic plugin to be dropped in "dropins".
While we will be able to live with this situation, it limits a bit the
trust in the selected technology.
So if it's ok for you, I'll at least file it as a bug.
Regards
Marius
|
|
|
Re: NoClassDefFoundError on AggregateProxyPackage [message #921970 is a reply to message #921890] |
Mon, 24 September 2012 15:54 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Marius,
Comments below.
On 24/09/2012 4:24 PM, Marius Gröger wrote:
> On 24.09.2012 15:55, Ed Merks wrote:
>> Marius,
>>
>> I could imagine that if different threads try to initialize different
>> packages that depend on each other, things might go wrong. Even locks
>> don't help in this kind of case; they'd just cause deadlock. If you
>> know the set of packages you're going to use, it's a good workaround to
>> initialize them early.
> Hm. Well, the issue appears fully reproducible with my setup, and that
> includes(!) both my development Eclipse instance as well as runtime. It
> seems to me that consistently AggreateProxyPackage is initialized first.
> It really doesn't looks to be a glitch. I really wonder if this works
> anywhere correctly. Putting it differently: as some knowing all this so
> much better - from what place would you say is AggregatePackage are
> AggreateProxyPackage "usually" accessed/inited first?
I'm not sure which depends on which, but even that shouldn't matter. I
assume they're not mutually dependent but that could be the case as
well, but then they'd be in the same project
>
> Btw, notice my usage in conjunction with QVT and XSD Ecore, which
> appears not to be used _that_ widely.
>
> Secondly, my work around is a magic plugin to be dropped in "dropins".
> While we will be able to live with this situation, it limits a bit the
> trust in the selected technology.
You have to keep in mind that this package initialization logic has
existed for well over a decade, with fixes along the way. There is not
a general
>
> So if it's ok for you, I'll at least file it as a bug.
As long as there's a reproducible test case, that's fine, but if that
involves "install plugins from project x, y, and z," then it will be x,
y, and z's responsibility to investigate so open a bug for those. If it
involves "here are some zipped projects you can import into any
workspace where EMF is installed and run blah to see the problem," then
I'll have a look.
>
> Regards
> Marius
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: NoClassDefFoundError on AggregateProxyPackage [message #922608 is a reply to message #921970] |
Tue, 25 September 2012 06:54 |
Eclipse User |
|
|
|
On 24.09.2012 17:54, Ed Merks wrote:
>> It really doesn't looks to be a glitch. I really wonder if this works
>> anywhere correctly. Putting it differently: as some knowing all this so
>> much better - from what place would you say is AggregatePackage are
>> AggreateProxyPackage "usually" accessed/inited first?
> I'm not sure which depends on which, but even that shouldn't matter. I
> assume they're not mutually dependent but that could be the case as
> well, but then they'd be in the same project
....
> You have to keep in mind that this package initialization logic has
> existed for well over a decade, with fixes along the way. There is not
> a general
I didn't want to step on anyone's toes, sorry if I did. I'll try to make
this as easily reproducible as possible and then file an issue. Thanks
for your help so far.
Regards
Marius
|
|
| |
Goto Forum:
Current Time: Wed Apr 24 23:53:26 GMT 2024
Powered by FUDForum. Page generated in 0.03526 seconds
|