Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mdt-bpmn2.dev] PackageNotFoundException when trying to load XML (or XMI) from a InputStream

Perhaps the packages are not registered? 
Typical UI-like plugins have some magic in their activators that registers the EMF packages to EMF.

-----Ursprüngliche Nachricht-----
Von: mdt-bpmn2.dev-bounces@xxxxxxxxxxx [mailto:mdt-bpmn2.dev-bounces@xxxxxxxxxxx] Im Auftrag von Bob Brodt
Gesendet: Freitag, 27. Februar 2015 17:17
An: BPMN2 Developers Mailing List
Betreff: Re: [mdt-bpmn2.dev] PackageNotFoundException when trying to load XML (or XMI) from a InputStream

Hi Jean,

I'm not sure what the problem is with your plugin, but I was able to get these files (and others) to load using the modelreader example plugin from the BPMN2 Modeler project [1].
The only difference I can see is that the modelreader code adds this before the load() call:

		HashMap<Object, Object> options = new HashMap<Object, Object>();
		options.put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true);
		resource.load(options);

this causes forward references to objects by their IDs to be deferred until the entire file is loaded, but this shouldn't be the reason why this code works and yours doesn't.

HTH,
Bob

[1] https://www.eclipse.org/bpmn2-modeler/


----- Original Message -----
> Hi devs,
> 
> I'm actually trying to parse a BPMN2 file coming from an InputStream
> (I'm developing a REST service where you can send a BPMN file which will
> be parsed to do stuff).  However, each time I'm trying to load the
> stream, I reach a PackageNotFoundException.
> 
> This is the incriminated code as far as I know.
> 
> -----
> Bpmn2ResourceFactoryImpl resourceFactory = new Bpmn2ResourceFactoryImpl();
> 
> Resource resource =
> resourceFactory.createResource(URI.createURI(httpHeaders.getFirst("host")));
> 
> resource.load(entityStream, Collections.EMPTY_MAP);
> -----
> 
> I've tried different bpmn2 file (XML and XMI) found here and there on
> the web (some examples from bpmn-js, some export from MagicDraw, some
> others found on this same mailing list, produced by Reiner) but each
> time, I reach the same following error.  In case of XMI file, the error
> is similar with a different URI (with MODEL-XMI).
> -----
> Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
> with uri 'http://www.omg.org/spec/BPMN/20100524/MODEL' not found.
> (localhost:8080, 2, 472)
> -----
> (see the complete log on [1]).
> 
> These are the files I tried. (see also the links).
> [2] Atomic XML file
> [3] simple XML file
> [4] XMI file
> 
> I hope I give enough information.  Don't hesitate to ask for more if
> needed.  At the moment, I'm completely stuck with this and don't find
> any hint on how to move forward.
> 
> Thank you!
> 
> [1] https://ezcrypt.it/jKAn#eEmmCygtnxb6HSjJJ4tGsItP
> [2] https://ezcrypt.it/nKAn#RbsYGEfHkSrHcnrAfE1qQypF
> [3] https://ezcrypt.it/mKAn#AYlEUxSvpwyKQyAUzc5Pp5lB
> [4] https://ezcrypt.it/oKAn#CEcWAZv2FufWdcQzapeaf8Ad
> --
> Jean Simard
> jean.simard@xxxxxxxxx
> Research engineer at XWiki SAS
> http://www.xwiki.com
> Committer on the XWiki.org project
> http://www.xwiki.org
> _______________________________________________
> mdt-bpmn2.dev mailing list
> mdt-bpmn2.dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/mdt-bpmn2.dev
> 
_______________________________________________
mdt-bpmn2.dev mailing list
mdt-bpmn2.dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mdt-bpmn2.dev


Back to the top