|
Re: Recurring EMF Problem What Causes This? [message #488769 is a reply to message #488728] |
Wed, 30 September 2009 08:22 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------090607000900050802040106
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Geoffry,
Comments below.
Geoffry Roberts wrote:
> All,
>
> I keep encountering a problem with EMF, which more than once I thought
> I fixed only to have it crop up again. Can any give me some insight
> into what is likely to be causing this?
>
> The line of my code that provokes the error is:
>
> ScenarioPackage pkgScenario = ScenarioPackage.eINSTANCE;
Initializing the package...
>
> The code in question executes correctly from within eclipse but not
> from an executable jar file. All the dependencies necessary for EMF
> seem to be included in the jar. The ScenarioPackage and all its ilk
> were generated from an XSD.
>
> I create my jar using the eclipse export wizard basing it on a working
> launch configuration. I do get a series of warnings complaining about
> duplicate entries, but these don't ever seem to be a problem.
>
> Thanks in advance.
>
> Error dump:
>
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at qq.mob.utility.mr.UtService.getInstance(UtService.java:68)
> at qq.mob.stage.mr.StageDriver.main(StageDriver.java:25)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
> ssorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
> thodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
>
> Caused by: java.lang.UnsupportedOperationException
> at
> org.eclipse.emf.ecore.impl.MinimalEObjectImpl.eBasicAdapters
> (MinimalEObjectImpl.java:292)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotifi
> cationRequired(BasicNotifierImpl.java:261)
If you look at the source code for this, what might you deduce?
For me eNotificationRequired looks like this:
public boolean eNotificationRequired()
{
return eBasicHasAdapters() && eDeliver();
}
which should call this method in MinimalEObjectImpl:
@Override
protected boolean eBasicHasAdapters()
{
return hasField(ADAPTER);
}
Yet for you it's calling eBasicAdapters which indeed is not supported:
@Override
protected BasicEList<Adapter> eBasicAdapters()
{
throw new UnsupportedOperationException();
}
What does that suggest as the source of the problem?
> at
> org.eclipse.emf.ecore.impl.EFactoryImpl.basicSetEPackage(EFa
> ctoryImpl.java:142)
> at
> org.eclipse.emf.ecore.impl.EFactoryImpl.eInverseAdd(EFactory
> Impl.java:670)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(Basi
> cEObjectImpl.java:1407)
> at
> org.eclipse.emf.ecore.impl.EPackageImpl.setEFactoryInstance(
> EPackageImpl.java:382)
> at
> org.eclipse.emf.ecore.impl.EPackageImpl.<init>(EPackageImpl.java:181)
> at
> qq.mob.scenario.impl.ScenarioPackageImpl.<init>(ScenarioPackageImpl.java:92)
>
> at
> qq.mob.scenario.impl.ScenarioPackageImpl.init(ScenarioPackag
> eImpl.java:118)
> at
> qq.mob.scenario.ScenarioPackage.<clinit>(ScenarioPackage.java:60)
> ... 7 more
>
--------------090607000900050802040106
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Geoffry,<br>
<br>
Comments below.<br>
<br>
Geoffry Roberts wrote:
<blockquote cite="mid:h9u59r$1m4$1@build.eclipse.org" type="cite">All,
<br>
<br>
I keep encountering a problem with EMF, which more than once I thought
I fixed only to have it crop up again. Can any give me some insight
into what is likely to be causing this?
<br>
<br>
The line of my code that provokes the error is:
<br>
<br>
ScenarioPackage pkgScenario = ScenarioPackage.eINSTANCE;
<br>
</blockquote>
Initializing the package...<br>
<blockquote cite="mid:h9u59r$1m4$1@build.eclipse.org" type="cite"><br>
The code in question executes correctly from within eclipse but not
from an executable jar file. All the dependencies necessary for EMF
seem to be included in the jar. The ScenarioPackage and all its ilk
were generated from an XSD.
<br>
<br>
I create my jar using the eclipse export wizard basing it on a working
launch configuration. I do get a series of warnings complaining about
duplicate entries, but these don't ever seem to be a problem.
<br>
<br>
Thanks in advance.
<br>
<br>
Error dump:
<br>
<br>
Exception in thread "main" java.lang.ExceptionInInitializerError
<br>
at qq.mob.utility.mr.UtService.getInstance(UtService.java:68)
<br>
at qq.mob.stage.mr.StageDriver.main(StageDriver.java:25)
<br>
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
<br>
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
<br>
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
<br>
at java.lang.reflect.Method.invoke(Method.java:597)
<br>
at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
<br>
<br>
Caused by: java.lang.UnsupportedOperationException
<br>
at org.eclipse.emf.ecore.impl.MinimalEObjectImpl.eBasicAdapters
(MinimalEObjectImpl.java:292)
<br>
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotifi
cationRequired(BasicNotifierImpl.java:261)
<br>
</blockquote>
If you look at the source code for this, what might you deduce?<br>
<br>
For me eNotificationRequired looks like this:<br>
<blockquote> public boolean eNotificationRequired()<br>
{<br>
return eBasicHasAdapters() && eDeliver();<br>
}<br>
</blockquote>
which should call this method in MinimalEObjectImpl:<br>
<blockquote> @Override<br>
protected boolean eBasicHasAdapters()<br>
{<br>
return hasField(ADAPTER);<br>
}<br>
</blockquote>
Yet for you it's calling eBasicAdapters which indeed is not supported:<br>
<blockquote> @Override<br>
protected BasicEList<Adapter> eBasicAdapters()<br>
{<br>
throw new UnsupportedOperationException();<br>
}<br>
</blockquote>
What does that suggest as the source of the problem?<br>
<blockquote cite="mid:h9u59r$1m4$1@build.eclipse.org" type="cite">
at org.eclipse.emf.ecore.impl.EFactoryImpl.basicSetEPackage(EFa
ctoryImpl.java:142)
<br>
at org.eclipse.emf.ecore.impl.EFactoryImpl.eInverseAdd(EFactory
Impl.java:670)
<br>
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(Basi
cEObjectImpl.java:1407)
<br>
at org.eclipse.emf.ecore.impl.EPackageImpl.setEFactoryInstance(
EPackageImpl.java:382)
<br>
at
org.eclipse.emf.ecore.impl.EPackageImpl.<init> (EPackageImpl.java:181)
<br>
at
qq.mob.scenario.impl.ScenarioPackageImpl.<init> ;(ScenarioPackageImpl.java:92)
<br>
at qq.mob.scenario.impl.ScenarioPackageImpl.init(ScenarioPackag
eImpl.java:118)
<br>
at
qq.mob.scenario.ScenarioPackage.<clinit>(Scena rioPackage.java:60)
<br>
... 7 more
<br>
<br>
</blockquote>
</body>
</html>
--------------090607000900050802040106--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
Re: Recurring EMF Problem What Causes This? [message #489013 is a reply to message #488904] |
Thu, 01 October 2009 08:26 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Geoffry,
When a stack trace shows different behavior than the expected source
code you can generally assume that the binary code you're actually
executing didn't derive from that source. In other words,
BasicNotifierImpl.eNotificationRequired should call eBasicHasAdapters()
but in your case it's calling eBasicAdapters() which to me says you're
using an other version of org.eclipse.emf.common*.jar with a newer
version of org.eclipse.emf.ecore*.jar. Check the versions of all your
jars and if that doesn't reveal an obvious problem, check all the jars
that they don't embed EMF classes.
Geoffry Roberts wrote:
> Ed,
>
> Your response indicates that the answer is right under my nose and it
> may well be. But I'm not getting it. Perhaps I'm hung on the fact
> that when I run this from within eclipse, it works and when I run from
> a jar whose export was based on that same launch configuration, it fails.
>
> The only thing I can conclude is there is some kind of dependency
> missing from the jar. If so, it must be a run time dependency because
> things are compiling. If so, why is the jar not being created properly?
>
> Sorry, but something, something obvious no doubt, is getting past me.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03672 seconds