EMF Serialization Problem [message #423878] |
Wed, 08 October 2008 11:23  |
Eclipse User |
|
|
|
Hi,
I am facing a seralization issue with EMF - XML Serialization , when I
serialize my Model to XML its working properly , but when i try to load
the same using the following code snippet , I am getting the usual
ClassNotFoundException
"org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'page' not found"
public static final String FILE_NAME =
" file:///D:/pde/workspace/com.sk.wikclipse.gen/src/test.wpage";
public static void loadModel() {
URI fileURI = URI.createURI(FILE_NAME);
Resource resource = new XMLResourceImpl(fileURI);
try {
resource.load(null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
The Generated Model file :
<?xml version="1.0" encoding="UTF-8"?>
<wikclipse:page xmlns:wikclipse="http://sk.com/model/wikclipse"
wikclipse:pageTitle="RedHat SOA Solution Stack"
wikclipse:parentPage="OpenSource-Assets">
<wikclipse:content>
<wikclipse:heading headingType="h1.">
<wikclipse:headingText>Purpose</wikclipse:headingText>
</wikclipse:heading>
<wikclipse:paragraph>
<wikclipse:text><![CDATA[<Purpose>]]></wikclipse:text>
</wikclipse:paragraph>
</wikclipse:content>
</wikclipse:page>
Can you please help me where I am going wrong. Is there any place I need
to add a code in the generated model code to avoid this error .
Thanks in advance.
Kamesh
}
|
|
|
|
|
Re: EMF Serialization Problem [message #423897 is a reply to message #423891] |
Thu, 09 October 2008 06:34  |
Eclipse User |
|
|
|
Kamesh,
Comments below.
Kamesh Sampath wrote:
> Ed,
>
> Thanks for the reponse. I do understand your info with respect to
> creating and reading the EMF resource. I was trying to simulate the
> error I was getting when i was using EMF with OAW . My Model gets
> seralized as XML with custom metadata information, when that model is
> loaded using the OAW workflow, I get the same error , hence i tried to
> do the same with the *Example class generated by the EMF plugin and
> got the same error. Still wondering what I am missing which causes
> this error. I added the XSI and other schema information but still get
> the same error.
Is the workflow running as a stand alone process as opposed to started
as an OSGi application? In that case no plugin registration takes
places and hence registrations of which factories are associated with
which file extensions are likely to be missing.
> Any pointers in this regard will help me.
> Also whats the difference between the XMLResource. OPTION_SCHEMA_LOCATION
It tells it to write a schema location if the ePackage.nsURI() is
different from ePackage.eResource().getURI().
> and XMLResource.OPTION_SCHEMA_LOCATION_IMPLEMENTATION
Rather than write out the location URI, it writes out the name of the
EPackage's generated interface, e.g, java:org.example.XyzPackage (or
something like that).
> , when i used the former i dont see the schema location attached to
> the serailized model
By default for generated models, the package's nsURI and the package's
resource's URI are the same.
> but when I use the later then i could see the SCHEMA_LOCATION in my
> seralized file.
I don't think this will solve the problem. For a model based on an XML
Schema, it's important that an XMLResourceImpl configured with options
like what you see in your generated XyzResourceFactoryImpl as used.
> Will this help me in resolving the classnotfound error or anyother
> global change will resolve the error ?
No. Try to find out from the oAW folks how you're suppose to be able to
ensure that your resource factory registrations will be taken into
account. I'll try to ask about these issues when I get a chance to talk
with them next week...
>
> -Kamesh
>
|
|
|
Powered by
FUDForum. Page generated in 0.07440 seconds