Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » XSD to EMF Cannot Find *ecore File
XSD to EMF Cannot Find *ecore File [message #72019] Mon, 09 April 2007 13:56 Go to next message
Eclipse User
Originally posted by: geoffry.roberts.gmail.com

All,

Thanks for helping.

I have generated EMF from XSD before and all went well. This time,
however, it generates without but won't run. I don't understand. I will
say that this a very complex schema, w3c compliant, but complex
nevertheless.

It generates without error and compiles without error.

The generator created a file called xhtml.ecore but apparently cannot find
it at runtime.

Where must xhtml.ecore be to be found?

The generator also created a file called mif.ecore. Both *.ecore files
were placed in a folder called model. But the generator placed a copy of
mif.ecore in one of the generated packages with the source code. I tried
placing a copy of xhtml.ecore in the same place but to no avail.

I have also tried placing xhtml.ecore on the runtime classpath.

The code line that provokes the error is:

MifPackageImpl theMifPackage =
(MifPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_ URI)
instanceof MifPackageImpl ?
EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new MifPackageImpl());

The complaint about the missing xhtml.ecore is near the end of the trace.
The output trace is:

java.lang.ExceptionInInitializerError
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unkn own 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$EPackageDescript or.getEPackage(RegistryReader.java:168)
at
org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage( EPackageRegistryImpl.java:112)
at org.hl7.v3.mif.impl.MifPackageImpl.init(MifPackageImpl.java: 2670)
at org.hl7.v3.mif.MifPackage.<clinit>(MifPackage.java:270)
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unkn own 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$EPackageDescript or.getEPackage(RegistryReader.java:168)
at
org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage( EPackageRegistryImpl.java:112)
at
org.hl7.v3.mif.impl.MifPackageImplTest.testInit(MifPackageIm plTest.java:21)
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:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
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:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:128)
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.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:58)
at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.r un(CoreTestApplication.java:24)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
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 org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.lang.RuntimeException: Missing serialized package:
xhtml.ecore
at
org.w3._1999.xhtml.impl.XhtmlPackageImpl.loadPackage(XhtmlPa ckageImpl.java:4780)
at
org.w3._1999.xhtml.impl.XhtmlPackageImpl.init(XhtmlPackageIm pl.java:707)
at org.w3._1999.xhtml.XhtmlPackage.<clinit>(XhtmlPackage.java:192)
... 51 more
Re: XSD to EMF Cannot Find *ecore File [message #72038 is a reply to message #72019] Mon, 09 April 2007 15:51 Go to previous message
Eclipse User
Originally posted by: merks.ca.ibm.com

Geoffry,

When a model is really large, the importer sets the GenPackage's
Initialize by Loading property to true; you could try setting it to
false, but likely you'll generate methods that are beyond Java's limit.
When this property is true, it should cause a *.ecore to be generated in
the same folder as the generated package. So the source folder
containing XhtmlPackageImpl should contain the xhmtl.ecore as well after
a successful generation. Did generation complete successfully? I.e.,
there are no errors in the Error Log view. Of course during the build
step, this *.ecore file should be copied to the bin folder so that it's
available at runtime. If the *.ecore is there in the source, check that
it's being copied to the bin folder...


Geoffry Roberts wrote:
> All,
>
> Thanks for helping.
>
> I have generated EMF from XSD before and all went well. This time,
> however, it generates without but won't run. I don't understand. I
> will say that this a very complex schema, w3c compliant, but complex
> nevertheless.
>
> It generates without error and compiles without error.
>
> The generator created a file called xhtml.ecore but apparently cannot
> find it at runtime.
> Where must xhtml.ecore be to be found?
>
> The generator also created a file called mif.ecore. Both *.ecore
> files were placed in a folder called model. But the generator placed
> a copy of mif.ecore in one of the generated packages with the source
> code. I tried placing a copy of xhtml.ecore in the same place but to
> no avail.
>
> I have also tried placing xhtml.ecore on the runtime classpath.
>
> The code line that provokes the error is:
>
> MifPackageImpl theMifPackage =
> (MifPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_ URI)
> instanceof MifPackageImpl ?
> EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new MifPackageImpl());
>
> The complaint about the missing xhtml.ecore is near the end of the trace.
> The output trace is:
>
> java.lang.ExceptionInInitializerError
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unkn own
> 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$EPackageDescript or.getEPackage(RegistryReader.java:168)
>
> at
> org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage( EPackageRegistryImpl.java:112)
>
> at org.hl7.v3.mif.impl.MifPackageImpl.init(MifPackageImpl.java: 2670)
> at org.hl7.v3.mif.MifPackage.<clinit>(MifPackage.java:270)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unkn own
> 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$EPackageDescript or.getEPackage(RegistryReader.java:168)
>
> at
> org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage( EPackageRegistryImpl.java:112)
>
> at
> org.hl7.v3.mif.impl.MifPackageImplTest.testInit(MifPackageIm plTest.java:21)
>
> 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:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> 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:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:128)
>
> 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.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:58)
>
> at
> org.eclipse.pde.internal.junit.runtime.CoreTestApplication.r un(CoreTestApplication.java:24)
>
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>
> 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 org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> Caused by: java.lang.RuntimeException: Missing serialized package:
> xhtml.ecore
> at
> org.w3._1999.xhtml.impl.XhtmlPackageImpl.loadPackage(XhtmlPa ckageImpl.java:4780)
>
> at
> org.w3._1999.xhtml.impl.XhtmlPackageImpl.init(XhtmlPackageIm pl.java:707)
> at org.w3._1999.xhtml.XhtmlPackage.<clinit>(XhtmlPackage.java:192)
> ... 51 more
>
>
>
Re: XSD to EMF Cannot Find *ecore File [message #602282 is a reply to message #72019] Mon, 09 April 2007 15:51 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25917
Registered: July 2009
Senior Member
Geoffry,

When a model is really large, the importer sets the GenPackage's
Initialize by Loading property to true; you could try setting it to
false, but likely you'll generate methods that are beyond Java's limit.
When this property is true, it should cause a *.ecore to be generated in
the same folder as the generated package. So the source folder
containing XhtmlPackageImpl should contain the xhmtl.ecore as well after
a successful generation. Did generation complete successfully? I.e.,
there are no errors in the Error Log view. Of course during the build
step, this *.ecore file should be copied to the bin folder so that it's
available at runtime. If the *.ecore is there in the source, check that
it's being copied to the bin folder...


Geoffry Roberts wrote:
> All,
>
> Thanks for helping.
>
> I have generated EMF from XSD before and all went well. This time,
> however, it generates without but won't run. I don't understand. I
> will say that this a very complex schema, w3c compliant, but complex
> nevertheless.
>
> It generates without error and compiles without error.
>
> The generator created a file called xhtml.ecore but apparently cannot
> find it at runtime.
> Where must xhtml.ecore be to be found?
>
> The generator also created a file called mif.ecore. Both *.ecore
> files were placed in a folder called model. But the generator placed
> a copy of mif.ecore in one of the generated packages with the source
> code. I tried placing a copy of xhtml.ecore in the same place but to
> no avail.
>
> I have also tried placing xhtml.ecore on the runtime classpath.
>
> The code line that provokes the error is:
>
> MifPackageImpl theMifPackage =
> (MifPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_ URI)
> instanceof MifPackageImpl ?
> EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new MifPackageImpl());
>
> The complaint about the missing xhtml.ecore is near the end of the trace.
> The output trace is:
>
> java.lang.ExceptionInInitializerError
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unkn own
> 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$EPackageDescript or.getEPackage(RegistryReader.java:168)
>
> at
> org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage( EPackageRegistryImpl.java:112)
>
> at org.hl7.v3.mif.impl.MifPackageImpl.init(MifPackageImpl.java: 2670)
> at org.hl7.v3.mif.MifPackage.<clinit>(MifPackage.java:270)
> at sun.misc.Unsafe.ensureClassInitialized(Native Method)
> at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unkn own
> 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$EPackageDescript or.getEPackage(RegistryReader.java:168)
>
> at
> org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage( EPackageRegistryImpl.java:112)
>
> at
> org.hl7.v3.mif.impl.MifPackageImplTest.testInit(MifPackageIm plTest.java:21)
>
> 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:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> 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:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:128)
>
> 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.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:58)
>
> at
> org.eclipse.pde.internal.junit.runtime.CoreTestApplication.r un(CoreTestApplication.java:24)
>
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>
> 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 org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> Caused by: java.lang.RuntimeException: Missing serialized package:
> xhtml.ecore
> at
> org.w3._1999.xhtml.impl.XhtmlPackageImpl.loadPackage(XhtmlPa ckageImpl.java:4780)
>
> at
> org.w3._1999.xhtml.impl.XhtmlPackageImpl.init(XhtmlPackageIm pl.java:707)
> at org.w3._1999.xhtml.XhtmlPackage.<clinit>(XhtmlPackage.java:192)
> ... 51 more
>
>
>
Previous Topic:XSD to EMF Cannot Find *ecore File
Next Topic:Questions about XSD transformation
Goto Forum:
  


Current Time: Wed Jul 23 20:33:48 EDT 2014

Powered by FUDForum. Page generated in 0.02127 seconds