Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Trouble Loading (Deserializing) EMF Document Outside Of Eclipse (Ganymede)(User is having trouble in loadResource when not running on Eclipse (Ganymede))
Trouble Loading (Deserializing) EMF Document Outside Of Eclipse (Ganymede) [message #491993] Fri, 16 October 2009 22:21 Go to next message
David Lynch is currently offline David LynchFriend
Messages: 27
Registered: July 2009
Junior Member
I'm finally upgrading our product from Callisto to Ganymede and all is going well.

I have everything running both on Eclipse IDE and RCP, but I'm having trouble running without the plug-in infrastructure as a non-Eclipse java application.

My non-plugin JUnit test program simply creates a new EMF ecore document (we call this a Vocabulary) and then reads it back in (loadResource). During loadResource, we get an exception:

java.lang.IllegalArgumentException: The class 'EClassifier' is not a valid classifier

This failure appears to occur when we try to deserialize the first EClassifier which happens to be an EClass. The debugger shows that the system believes the EClassifier to be "Feature Kind" integer value 3, which doesn't appear in the switch statement, resulting in this exception. Not sure whether this detail will be of any help to you.

See my stack trace below.

Here is the Ecore document that I'm trying to load. Note that it has some annotations for our extensions (not sure whether this is relevant):

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com.corticon.rulesemf.canonicalvocabularymodel=" http:///com/corticon/rulesemf/canonicalvocabularymodel.ecore" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="root">
<eAnnotations source=" http:///com/corticon/rulesemf/canonicalvocabularymodel/Vocab ularyExtension">
<contents xsi:type=" com.corticon.rulesemf.canonicalvocabularymodel:RootExtension " majorVersionNumber="2" buildNumber="2300" updateStamp="_h64UwLqgEd62x4Wshaq5nQ" externalChecksum="1074090146:507989954" customDataTypeDisplayCount="50">
<languageCode>en_US</languageCode>
<databaseAccess/>
</contents>
</eAnnotations>
<eClassifiers xsi:type="ecore:EClass" name="Person">
<eAnnotations source=" http:///com/corticon/rulesemf/canonicalvocabularymodel/Vocab ularyExtension">
<contents xsi:type=" com.corticon.rulesemf.canonicalvocabularymodel:EntityExtensi on ">
<name manuallyCreated="true" value="Person"/>
</contents>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source=" http:///com/corticon/rulesemf/canonicalvocabularymodel/Vocab ularyExtension">
<contents xsi:type=" com.corticon.rulesemf.canonicalvocabularymodel:AttributeExte nsion ">
<name manuallyCreated="true" value="name"/>
<mode manuallyCreated="true" value="Base"/>
</contents>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="child" upperBound="-1" eType="#//Person" eOpposite="#//Person/parent">
<eAnnotations source=" http:///com/corticon/rulesemf/canonicalvocabularymodel/Vocab ularyExtension">
<contents xsi:type=" com.corticon.rulesemf.canonicalvocabularymodel:AssociationEn dExtension ">
<name manuallyCreated="true" value="child"/>
</contents>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="parent" lowerBound="1" upperBound="-1" eType="#//Person" eOpposite="#//Person/child">
<eAnnotations source=" http:///com/corticon/rulesemf/canonicalvocabularymodel/Vocab ularyExtension">
<contents xsi:type=" com.corticon.rulesemf.canonicalvocabularymodel:AssociationEn dExtension ">
<name manuallyCreated="true" value="parent"/>
</contents>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="grandChild" upperBound="-1" eType="#//Person" eOpposite="#//Person/grandParent">
<eAnnotations source=" http:///com/corticon/rulesemf/canonicalvocabularymodel/Vocab ularyExtension">
<contents xsi:type=" com.corticon.rulesemf.canonicalvocabularymodel:AssociationEn dExtension ">
<name manuallyCreated="true" value="grandChild"/>
</contents>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="grandParent" lowerBound="1" upperBound="-1" eType="#//Person" eOpposite="#//Person/grandChild">
<eAnnotations source=" http:///com/corticon/rulesemf/canonicalvocabularymodel/Vocab ularyExtension">
<contents xsi:type=" com.corticon.rulesemf.canonicalvocabularymodel:AssociationEn dExtension ">
<name manuallyCreated="true" value="grandParent"/>
</contents>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="greatGrandChild" upperBound="-1" eType="#//Person" eOpposite="#//Person/greatGrandParent">
<eAnnotations source=" http:///com/corticon/rulesemf/canonicalvocabularymodel/Vocab ularyExtension">
<contents xsi:type=" com.corticon.rulesemf.canonicalvocabularymodel:AssociationEn dExtension ">
<name manuallyCreated="true" value="greatGrandChild"/>
</contents>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="greatGrandParent" lowerBound="1" upperBound="-1" eType="#//Person" eOpposite="#//Person/greatGrandChild">
<eAnnotations source=" http:///com/corticon/rulesemf/canonicalvocabularymodel/Vocab ularyExtension">
<contents xsi:type=" com.corticon.rulesemf.canonicalvocabularymodel:AssociationEn dExtension ">
<name manuallyCreated="true" value="greatGrandParent"/>
</contents>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
</ecore:EPackage>

When I first received this message, I thought that perhaps I wasn't initializing the EMF package registry (this has been a problem before when running outside of Eclipse). I have checked and this appears to be working correctly.

Thanks in advance for your attention.


java.lang.IllegalArgumentException: The class 'EClassifier' is not a valid classifier
at org.eclipse.emf.ecore.impl.EcoreFactoryImpl.create(EcoreFact oryImpl.java:104)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.createObject(XM LHelperImpl.java:871)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.createObject(XM LHelperImpl.java:920)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFa ctory(XMLHandler.java:2171)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFe atureType(XMLHandler.java:2144)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHa ndler.java:2020)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.createObject(XMIHa ndler.java:131)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLH andler.java:1799)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1023)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:1001)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:712)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unk nown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanSt artElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at com.corticon.eclipse.core.impl.UUIDXMIResourceImpl.doLoad(UU IDXMIResourceImpl.java:73)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1445)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1241)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo ad(ResourceSetImpl.java:255)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:270)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:397)
at org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain.load Resource(AdapterFactoryEditingDomain.java:409)
at com.corticon.eclipse.core.impl.DefaultPersistenceServicesDel egateImpl.loadResource(DefaultPersistenceServicesDelegateImp l.java:82)
at com.corticon.eclipse.core.impl.ModelAPIStateImpl.loadResourc e(ModelAPIStateImpl.java:1182)
at com.corticon.eclipse.core.impl.ModelAPIImpl.loadResource(Mod elAPIImpl.java:1905)
at com.corticon.eclipse.core.impl.ModelAPIImpl.loadResource(Mod elAPIImpl.java:1892)
at qa.corticon.eclipse.studio.junit.ETestGrandParentSmokeTest.i nit(ETestGrandParentSmokeTest.java:109)
at qa.corticon.eclipse.studio.junit.ETestGrandParentSmokeTest.t estGrandParent(ETestGrandParentSmokeTest.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main


n(RemoteTestRunner.java:196)
Re: Trouble Loading (Deserializing) EMF Document Outside Of Eclipse (Ganymede) [message #492004 is a reply to message #491993] Sat, 17 October 2009 00:10 Go to previous message
David Lynch is currently offline David LynchFriend
Messages: 27
Registered: July 2009
Junior Member
I've learned this has to do with a difference in the SAX parser that is being selected. When running in Eclipse, I'm getting the parser that is in JDK 1.5.0_18, while running outside I'm getting one that we have on the classpath (Xerces 2.4.0). The Xerces 2.4.0 parser appears to be "namespace aware" while the other is not. This difference is at the core of the difference in behavior.
Previous Topic:How to avoid creating OutputStream on (Resource) save operation
Next Topic:Introductory question EMF in general
Goto Forum:
  


Current Time: Fri Sep 27 07:18:36 GMT 2024

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

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

Back to the top