Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Package with uri 'null' not found
Package with uri 'null' not found [message #718183] Tue, 23 August 2011 14:04 Go to next message
Dirk Hoffmann is currently offline Dirk Hoffmann
Messages: 163
Registered: July 2009
Senior Member
Hi,

I'm using EMF standalone (actually inside an Eclipse based product but
the EMF jars are in a separate plug-in so the do not interfere with the
EMF version that comes with the Product).

I get the "Package with uri 'null' not found" error when trying to load
a file this way:

/**
* @param inputStream XML comes in as an {@link InputStream}
* @return EMF resource containing the model data
* @throws IOException
*/
private Resource load(InputStream inputStream) throws IOException {
ResourceSet rs = new ResourceSetImpl();
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xml",
new GenLegacyRenderingResourceFactoryImpl());
GenLegacyRenderingPackage.eINSTANCE.eClass();
Map options = new Properties();
// Just a dummy url to specify the type of the document
URI uri = URI.createURI("http://www.tesis.de/legacy/rendering.xml");
Resource resource = rs.createResource(uri);
resource.load(inputStream, options);
return resource;
}

Any idea what is wrong with this approach?

Thanks and Regards,
Dirk
Re: Package with uri 'null' not found [message #718195 is a reply to message #718183] Tue, 23 August 2011 14:53 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26062
Registered: July 2009
Senior Member
Dirk,

Does the generated XyzExample work properly?


On 23/08/2011 7:04 AM, Dirk Hoffmann wrote:
> Hi,
>
> I'm using EMF standalone (actually inside an Eclipse based product but
> the EMF jars are in a separate plug-in so the do not interfere with
> the EMF version that comes with the Product).
>
> I get the "Package with uri 'null' not found" error when trying to
> load a file this way:
>
> /**
> * @param inputStream XML comes in as an {@link InputStream}
> * @return EMF resource containing the model data
> * @throws IOException
> */
> private Resource load(InputStream inputStream) throws IOException {
> ResourceSet rs = new ResourceSetImpl();
>
> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xml",
> new GenLegacyRenderingResourceFactoryImpl());
> GenLegacyRenderingPackage.eINSTANCE.eClass();
> Map options = new Properties();
> // Just a dummy url to specify the type of the document
> URI uri =
> URI.createURI("http://www.tesis.de/legacy/rendering.xml");
> Resource resource = rs.createResource(uri);
> resource.load(inputStream, options);
> return resource;
> }
>
> Any idea what is wrong with this approach?
>
> Thanks and Regards,
> Dirk
Re: Package with uri 'null' not found [message #718198 is a reply to message #718195] Tue, 23 August 2011 15:15 Go to previous messageGo to next message
Dirk Hoffmann is currently offline Dirk Hoffmann
Messages: 163
Registered: July 2009
Senior Member
It produces:

Enter a list of file paths or URIs that have content like this:
<?xml version="1.0" encoding="ASCII"?>
<legacyrendering:LegacyRendering
xmlns:legacyrendering="http://legacyrendering/1.0"/>

but the files I want to load start like this:

<?xml version="1.0" encoding="UTF-8"?>
<T4XObject type="4974656d">
<ERPObject status="4f4b" message="">
....

So there is no namespace declaration and of course no namespace prefix
and the root element is T4XObject which according to the meta model is
an element of LegacyRendering.

When I pass in the name of such a file I get

Problem loading
file:/D:/S/L/T4S_apps/trunk/plugins/de.tesis.plmware.t4x.app.tests/example1.xml
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException:
org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
'null' not found.
(file:/D:/S/L/T4S_apps/trunk/plugins/de.tesis.plmware.t4x.app.tests/example1.xml,
2, 28)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
at
de.tesis.plmware.t4x.app.legacyrendering.tests.GenLegacyRenderingExample.main(GenLegacyRenderingExample.java:89)
Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
with uri 'null' not found.
(file:/D:/S/L/T4S_apps/trunk/plugins/de.tesis.plmware.t4x.app.tests/example1.xml,
2, 28)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1307)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1468)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1019)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1001)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:712)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
at
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:798)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:878)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:1157)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:181)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1494)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1282)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
... 2 more


Am 23.08.2011 16:53, schrieb Ed Merks:
> Dirk,
>
> Does the generated XyzExample work properly?
>
>
> On 23/08/2011 7:04 AM, Dirk Hoffmann wrote:
>> Hi,
>>
>> I'm using EMF standalone (actually inside an Eclipse based product but
>> the EMF jars are in a separate plug-in so the do not interfere with
>> the EMF version that comes with the Product).
>>
>> I get the "Package with uri 'null' not found" error when trying to
>> load a file this way:
>>
>> /**
>> * @param inputStream XML comes in as an {@link InputStream}
>> * @return EMF resource containing the model data
>> * @throws IOException
>> */
>> private Resource load(InputStream inputStream) throws IOException {
>> ResourceSet rs = new ResourceSetImpl();
>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xml",
>> new GenLegacyRenderingResourceFactoryImpl());
>> GenLegacyRenderingPackage.eINSTANCE.eClass();
>> Map options = new Properties();
>> // Just a dummy url to specify the type of the document
>> URI uri = URI.createURI("http://www.tesis.de/legacy/rendering.xml");
>> Resource resource = rs.createResource(uri);
>> resource.load(inputStream, options);
>> return resource;
>> }
>>
>> Any idea what is wrong with this approach?
>>
>> Thanks and Regards,
>> Dirk
Re: Package with uri 'null' not found [message #718207 is a reply to message #718198] Tue, 23 August 2011 15:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26062
Registered: July 2009
Senior Member
Dirk,

Comments below.

On 23/08/2011 8:15 AM, Dirk Hoffmann wrote:
> It produces:
>
> Enter a list of file paths or URIs that have content like this:
> <?xml version="1.0" encoding="ASCII"?>
> <legacyrendering:LegacyRendering
> xmlns:legacyrendering="http://legacyrendering/1.0"/>
>
> but the files I want to load start like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <T4XObject type="4974656d">
> <ERPObject status="4f4b" message="">
Given it produces what you show above, why are you expecting it to be
able to load this form of XML?
> ...
>
> So there is no namespace declaration and of course no namespace prefix
> and the root element is T4XObject which according to the meta model is
> an element of LegacyRendering.
>
> When I pass in the name of such a file I get
>
> Problem loading
> file:/D:/S/L/T4S_apps/trunk/plugins/de.tesis.plmware.t4x.app.tests/example1.xml
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException:
> org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
> 'null' not found.
> (file:/D:/S/L/T4S_apps/trunk/plugins/de.tesis.plmware.t4x.app.tests/example1.xml,
> 2, 28)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
> at
> de.tesis.plmware.t4x.app.legacyrendering.tests.GenLegacyRenderingExample.main(GenLegacyRenderingExample.java:89)
> Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
> with uri 'null' not found.
> (file:/D:/S/L/T4S_apps/trunk/plugins/de.tesis.plmware.t4x.app.tests/example1.xml,
> 2, 28)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1307)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1468)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1019)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1001)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:712)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> at
> com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:798)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:878)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:1157)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:181)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:180)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1494)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1282)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
> ... 2 more
>
>
> Am 23.08.2011 16:53, schrieb Ed Merks:
>> Dirk,
>>
>> Does the generated XyzExample work properly?
>>
>>
>> On 23/08/2011 7:04 AM, Dirk Hoffmann wrote:
>>> Hi,
>>>
>>> I'm using EMF standalone (actually inside an Eclipse based product but
>>> the EMF jars are in a separate plug-in so the do not interfere with
>>> the EMF version that comes with the Product).
>>>
>>> I get the "Package with uri 'null' not found" error when trying to
>>> load a file this way:
>>>
>>> /**
>>> * @param inputStream XML comes in as an {@link InputStream}
>>> * @return EMF resource containing the model data
>>> * @throws IOException
>>> */
>>> private Resource load(InputStream inputStream) throws IOException {
>>> ResourceSet rs = new ResourceSetImpl();
>>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xml",
>>> new GenLegacyRenderingResourceFactoryImpl());
>>> GenLegacyRenderingPackage.eINSTANCE.eClass();
>>> Map options = new Properties();
>>> // Just a dummy url to specify the type of the document
>>> URI uri = URI.createURI("http://www.tesis.de/legacy/rendering.xml");
>>> Resource resource = rs.createResource(uri);
>>> resource.load(inputStream, options);
>>> return resource;
>>> }
>>>
>>> Any idea what is wrong with this approach?
>>>
>>> Thanks and Regards,
>>> Dirk
>
Re: Package with uri 'null' not found [message #718414 is a reply to message #718207] Wed, 24 August 2011 08:59 Go to previous message
Dirk Hoffmann is currently offline Dirk Hoffmann
Messages: 163
Registered: July 2009
Senior Member
Hi Ed,

thanks for your hints. Got it going. See below.

Am 23.08.2011 17:24, schrieb Ed Merks:
> Dirk,
>
> Comments below.
>
> On 23/08/2011 8:15 AM, Dirk Hoffmann wrote:
>> It produces:
>>
>> Enter a list of file paths or URIs that have content like this:
>> <?xml version="1.0" encoding="ASCII"?>
>> <legacyrendering:LegacyRendering
>> xmlns:legacyrendering="http://legacyrendering/1.0"/>
>>
>> but the files I want to load start like this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <T4XObject type="4974656d">
>> <ERPObject status="4f4b" message="">
> Given it produces what you show above, why are you expecting it to be
> able to load this form of XML?
The point is that there was first the XML and I created the meta model
from what I saw inside the XML files. I only had a rough idea of how EMF
deserializes XML into a model. I haven't tried out the generated example
before you asked me to do so.

Anyway its working now. I overrode some methods of the generated
resource implementation and the SAXXMLHandler.
>> ...
>>
>> So there is no namespace declaration and of course no namespace prefix
>> and the root element is T4XObject which according to the meta model is
>> an element of LegacyRendering.
>>
>> When I pass in the name of such a file I get
>>
>> Problem loading
>> file:/D:/S/L/T4S_apps/trunk/plugins/de.tesis.plmware.t4x.app.tests/example1.xml
>>
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException:
>> org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
>> 'null' not found.
>> (file:/D:/S/L/T4S_apps/trunk/plugins/de.tesis.plmware.t4x.app.tests/example1.xml,
>> 2, 28)
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
>>
>> at
>> de.tesis.plmware.t4x.app.legacyrendering.tests.GenLegacyRenderingExample.main(GenLegacyRenderingExample.java:89)
>>
>> Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
>> with uri 'null' not found.
>> (file:/D:/S/L/T4S_apps/trunk/plugins/de.tesis.plmware.t4x.app.tests/example1.xml,
>> 2, 28)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1307)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1468)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1019)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1001)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:712)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:798)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:878)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:1157)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>>
>> at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:181)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:180)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1494)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1282)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
>>
>> ... 2 more
>>
>>
>> Am 23.08.2011 16:53, schrieb Ed Merks:
>>> Dirk,
>>>
>>> Does the generated XyzExample work properly?
>>>
>>>
>>> On 23/08/2011 7:04 AM, Dirk Hoffmann wrote:
>>>> Hi,
>>>>
>>>> I'm using EMF standalone (actually inside an Eclipse based product but
>>>> the EMF jars are in a separate plug-in so the do not interfere with
>>>> the EMF version that comes with the Product).
>>>>
>>>> I get the "Package with uri 'null' not found" error when trying to
>>>> load a file this way:
>>>>
>>>> /**
>>>> * @param inputStream XML comes in as an {@link InputStream}
>>>> * @return EMF resource containing the model data
>>>> * @throws IOException
>>>> */
>>>> private Resource load(InputStream inputStream) throws IOException {
>>>> ResourceSet rs = new ResourceSetImpl();
>>>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xml",
>>>> new GenLegacyRenderingResourceFactoryImpl());
>>>> GenLegacyRenderingPackage.eINSTANCE.eClass();
>>>> Map options = new Properties();
>>>> // Just a dummy url to specify the type of the document
>>>> URI uri = URI.createURI("http://www.tesis.de/legacy/rendering.xml");
>>>> Resource resource = rs.createResource(uri);
>>>> resource.load(inputStream, options);
>>>> return resource;
>>>> }
>>>>
>>>> Any idea what is wrong with this approach?
>>>>
>>>> Thanks and Regards,
>>>> Dirk
>>
Previous Topic:Should not be able to save when editor has errors
Next Topic:[CDO] No type mapping factory found
Goto Forum:
  


Current Time: Tue Sep 23 02:22:53 GMT 2014

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

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