|
|
|
|
|
Re: Problem with persistence.... [message #1023149 is a reply to message #1023143] |
Sat, 23 March 2013 11:59 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Given it's a stand alone test case and that package initialization is
generally delayed as long as possible, it's likely that the delayed
package initializing itself is causing a problem. Likely doing
PokusajPackage.eINSTANCE.eClass() to force initialization at the start
of main would avoid this, and this is also necessary in other scenarios,
e.g., when the first thing you do is load an instance file, the package
needs to be registered, and the suggested idiom does that as a side effect.
On 23/03/2013 7:39 AM, Ed Willink wrote:
> Hi
>
> ExceptionInInitializerError problems are usually much further up the
> stack, and often end up telling you that you didn't do a rebuild.
>
> Right at the end of your list
>
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.EcorePackage$Literals.<clinit>(EcorePackage.java:5107)
>
> ... 31 more
>
> is clearly very smelly, and very unlikely to be the true problem.
>
> Run under the debugger with at least NPE, CCE, IOE AIOOBE caught, and
> beware that the debugger normally steps over hidden class
> initialization which is where your trouble is.
>
> Regards
>
> Ed Willink
>
> On 23/03/2013 08:47, Milan Djukic wrote:
>> Yes i still have a question.I can't figure out where is an error.
>>
>> Exception in thread "main" java.lang.ExceptionInInitializerError
>> at
>> org.eclipse.emf.ecore.impl.EPackageImpl.eStaticClass(EPackageImpl.java:236)
>> at
>> org.eclipse.emf.ecore.impl.MinimalEObjectImpl.eClass(MinimalEObjectImpl.java:678)
>> at
>> org.eclipse.emf.ecore.impl.ENamedElementImpl.eContents(ENamedElementImpl.java:224)
>> at
>> org.eclipse.emf.ecore.util.EcoreUtil$ProperContentIterator.<init>(EcoreUtil.java:1289)
>> at
>> org.eclipse.emf.ecore.util.EcoreUtil$4.getChildren(EcoreUtil.java:1200)
>> at
>> org.eclipse.emf.ecore.util.EcoreUtil$ContentTreeIterator.hasNext(EcoreUtil.java:1451)
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.attached(ResourceImpl.java:852)
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl$ContentsEList.inverseAdd(ResourceImpl.java:408)
>> at
>> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:312)
>> at
>> org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:301)
>> at
>> org.eclipse.emf.ecore.impl.EPackageImpl.createResource(EPackageImpl.java:748)
>> at
>> org.eclipse.emf.ecore.impl.EcorePackageImpl.initializePackageContents(EcorePackageImpl.java:2810)
>> at
>> org.eclipse.emf.ecore.impl.EcorePackageImpl.init(EcorePackageImpl.java:485)
>> at org.eclipse.emf.ecore.EcorePackage.<clinit>(EcorePackage.java:67)
>> at
>> org.eclipse.emf.ecore.impl.EPackageImpl.<init>(EPackageImpl.java:185)
>> at
>> pokusaj.impl.PokusajPackageImpl.<init>(PokusajPackageImpl.java:58)
>> at pokusaj.impl.PokusajPackageImpl.init(PokusajPackageImpl.java:84)
>> at pokusaj.PokusajPackage.<clinit>(PokusajPackage.java:55)
>> at pokusaj.PokusajPackage$Literals.<clinit>(PokusajPackage.java:235)
>> at pokusaj.impl.AImpl.eStaticClass(AImpl.java:70)
>> at
>> org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:263)
>> at
>> org.eclipse.emf.ecore.util.EContentsEList.createEContentsEList(EContentsEList.java:49)
>> at
>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eContents(BasicEObjectImpl.java:815)
>> at
>> org.eclipse.emf.ecore.util.EcoreUtil$ProperContentIterator.<init>(EcoreUtil.java:1289)
>> at
>> org.eclipse.emf.ecore.util.EcoreUtil$4.getChildren(EcoreUtil.java:1200)
>> at
>> org.eclipse.emf.ecore.util.EcoreUtil$ContentTreeIterator.hasNext(EcoreUtil.java:1451)
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.attached(ResourceImpl.java:852)
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl$ContentsEList.inverseAdd(ResourceImpl.java:408)
>> at
>> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:312)
>> at
>> org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:301)
>> at test.Test.main(Test.java:39)
>> Caused by: java.lang.NullPointerException
>> at
>> org.eclipse.emf.ecore.EcorePackage$Literals.<clinit>(EcorePackage.java:5107)
>> ... 31 more
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: Problem with persistence.... [message #1023169 is a reply to message #1023164] |
Sat, 23 March 2013 13:15 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Milan,
Comments below.
On 23/03/2013 9:00 AM, Milan Djukic wrote:
> @Ed Willink
>
> I don't understand you. What is NPE, CCE, IOE AIOOBE?
NullPointerException, ClassCastException, IndexOfBoundsException,
ArrayIndexOutOfBoundsException.
I doubt these other things are the cause though. Your stack trace is
quite complete all the way down to main...
>
> @Ed Merks
>
> Tried that. It's the same exception...
But does the exception happen during that new call? I.e., is the stack
trace the same? Try EcorePackage.eINSTANCE.eClass() as the first thing
then, i.e., before you initialize your package. If you have problems,
please show the stack trace.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|