Home » Archived » M2M (model-to-model transformation) » [ATL] Launching ATL from Java, 'Content is not allowed in prolog'.
[ATL] Launching ATL from Java, 'Content is not allowed in prolog'. [message #523959] |
Tue, 30 March 2010 03:32 |
Wim Messages: 6 Registered: March 2010 |
Junior Member |
|
|
Hello,
I am trying to launch an ATL transformation from Java code. Nothing fancy, just a simple Java Main that is supposed to execute a transformation given by argument on some given models.
When adapting the code from the 'public2private' example, I came across the same problem described here: http://www.eclipse.org/forums/index.php?t=msg&goto=50264 0&
org.eclipse.m2m.atl.core.ATLCoreException: org.eclipse.m2m.atl.core.injector EMF not found, check the spelling or register it manually
To solve this, I simply used:
injector = new EMFInjector();
extractor = new EMFExtractor();
Which works fine, however I can't get the following to do anything:
CoreService.registerFactory("EMF", EMFModelFactory.class);
ModelFactory factory = CoreService.createModelFactory("EMF");
Creating a new EMFModelFactory doesn't seem to do anything. All console printlines or error throws beyond this line are all ignored. I'm not receiving any errors either. I've absolutely no idea what's going on.
Any suggestions would be appreciated!
Greeting,
Wim
[Updated on: Tue, 30 March 2010 19:19] Report message to a moderator
|
|
|
Re: [ATL] Launching ATL from Java, EMFModelFactory problem [message #523978 is a reply to message #523959] |
Tue, 30 March 2010 02:20 |
William Piers Messages: 301 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------090203070905000308080500
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Hello,
To use this kind of constructs inside of a simple java main, you have
first to register the injector/extractor etc, using CoreService methods
e.g.
org.eclipse.m2m.atl.core.service.CoreService.registerExtract or(String,
IExtractor)
Normally this is achieved by the plugin extension (which is not loaded
in the main, it works when launched inside of a running eclipse).
Note that in your case, simply doing "new EMFInjector()" is much
simpler: the "Core" registry is dedicated to be used into a generic way
(like launch configurations, ant tasks...)
Best regards,
William
Le 30/03/2010 05:32, wiiiim@gmail.com a écrit :
> Hello,
> I am trying to launch an ATL transformation from Java code. Nothing
> fancy, just a simple Java Main that is supposed to execute a
> transformation given by argument on some given models.
> When adapting the code from the 'public2private' example, I came across
> the same problem described here:
> http://www.eclipse.org/forums/index.php?t=msg&goto=50264 0&
>
> org.eclipse.m2m.atl.core.ATLCoreException:
> org.eclipse.m2m.atl.core.injector EMF not found, check the spelling or
> register it manually
>
>
> To solve this, I simply used:
>
>
> injector = new EMFInjector();
> extractor = new EMFExtractor();
>
>
> Which works fine, however I can't get the following to do anything:
>
>
> CoreService.registerFactory("EMF", EMFModelFactory.class);
> ModelFactory factory = CoreService.createModelFactory("EMF");
>
>
> Creating a new EMFModelFactory doesn't seem to do anything. All console
> printlines or error throws beyond this line are all ignored. I'm not
> receiving any errors either. I've absolutely no idea what's going on.
>
> Any suggestions would be appreciated! :)
> Greeting,
> Wim
>
>
--
Ne manquez pas notre prochaine formation ATL inter entreprises:
ATL - Paris - du 14 au 15 avril 2010
Pour plus de dates et pour le détail de cette formation:
http://www.obeo.fr/pages/formations/fr
Don't forget our next ATL training:
ATL - Paris - 2010 April from 14th to 15th
More dates and training program on:
http://www.obeo.fr/pages/formations/fr
--------------090203070905000308080500
Content-Type: text/x-vcard; charset=utf-8;
name="william_piers.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="william_piers.vcf"
YmVnaW46dmNhcmQNCmZuOldpbGxpYW0gUGllcnMNCm46UGllcnM7V2lsbGlh bQ0Kb3JnOk9i
ZW8NCmFkcjoyIHJ1ZSBSb2JlcnQgU2NodW1hbm47O2xvdCAyNDtOQU5URVM7 OzQ0NDA4O0Zy
YW5jZQ0KZW1haWw7aW50ZXJuZXQ6d2lsbGlhbS5waWVyc0BvYmVvLmZyDQp0 aXRsZTpNREEg
Q29uc3VsdGFudA0KdGVsO3dvcms6KzMzICgwKTIgNTEgMTMgNTAgNTMNCnVy bDpodHRwOi8v
d3d3Lm9iZW8uZnINCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------090203070905000308080500--
|
|
|
Re: [ATL] Launching ATL from Java, EMFModelFactory problem [message #524089 is a reply to message #523959] |
Tue, 30 March 2010 16:01 |
Wim Messages: 6 Registered: March 2010 |
Junior Member |
|
|
edit: problem 'resolved' by making it a plugin application instead, but new problem encountered, see below
Thanks for your reply
The problem, however, seems to remain. Nothing happens when trying to create a new EMFModelFactory.
public class ATLLauncher {
private EMFVMLauncher _launcher;
private ModelFactory _factory;
private EMFInjector _injector;
private EMFExtractor _extractor;
private IExtractor _iextractor;
public ATLLauncher() throws ATLCoreException{
System.out.println("A");
_injector = new EMFInjector();
System.out.println("B");
_extractor = new EMFExtractor();
System.out.println("C");
CoreService.registerInjector("EMF", _injector);
System.out.println("D");
CoreService.registerExtractor("EMF", _extractor);
System.out.println("E");
_launcher = new EMFVMLauncher();
System.out.println("F");
CoreService.registerLauncher(_launcher);
System.out.println("G");
CoreService.registerFactory("EMF", EMFModelFactory.class);
System.out.println("H");
_factory = CoreService.createModelFactory("EMF");
System.out.println("I");
_iextractor = CoreService.getExtractor(_factory.getDefaultExtractorName());
System.out.println("J");
_launcher.initialize(Collections.<String, Object> emptyMap());
}
The example above outputs:
Everything beyond the line CoreService.createModelFactory("EMF") doesn't get executed at all. The application terminates without any errors but somehow stops half way? I've never seen anything like this before.
And if I understand correctly I don't even need to use the CoreService. I tried removing all uses of the CoreService but again the line '_factory = new EMFModelFactory()' doesn't do anything.
I'm not sure what to do next
Thanks,
Wim
[Updated on: Tue, 30 March 2010 19:18] Report message to a moderator
|
|
|
Re: [ATL] Launching ATL from Java, EMFModelFactory problem [message #524113 is a reply to message #523959] |
Tue, 30 March 2010 19:17 |
Wim Messages: 6 Registered: March 2010 |
Junior Member |
|
|
Okay, i decided to avoid this problem and stick to a simple plugin instead.
Now i'm experiencing a new problem:
When the launcher runs the transformation, it throws the following error:
org.eclipse.m2m.atl.engine.emfvm.VMException: Parsing error, line 1 column 1: Content is not allowed in prolog.
Java Stack:
org.eclipse.m2m.atl.engine.emfvm.VMException: Parsing error, line 1 column 1: Content is not allowed in prolog.
at org.eclipse.m2m.atl.engine.emfvm.ASMXMLReader.read(ASMXMLReader.java:66)
at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.loadModule(EMFVMLauncher.java:171)
at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.getASMFromObject(EMFVMLauncher.java:183)
at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.launch(EMFVMLauncher.java:131)
at transfont.popup.actions.transform.run(transform.java:95)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1598)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1622)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1607)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1396)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3484)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3068)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.eclipse.m2m.atl.engine.emfvm.ASMXMLReader.fatalError(ASMXMLReader.java:185)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:218)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1441)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(XMLDocumentScannerImpl.java:899)
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 javax.xml.parsers.SAXParser.parse(SAXParser.java:176)
at org.eclipse.m2m.atl.engine.emfvm.ASMXMLReader.read(ASMXMLReader.java:62)
... 36 more
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
... 48 more
I figure this has something to do with one of the models not being properly formed in XML. However, I can't seem to find any problem.
The input model and metamodel are from UML2 so I doubt anything is wrong here. That would leave 1 possibility, being the output metamodel which is a custom SBVR ecore model I made.
Here are the first few lines of that metamodel:
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
<ecore:EPackage name="SBVR" nsURI="http://www.omg.org/sbvr" nsPrefix="sbvr">
<eClassifiers xsi:type="ecore:EClass" name="Package">
<eStructuralFeatures xsi:type="ecore:EReference" name="things" ordered="false"
upperBound="-1" eType="#/0/Thing" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1" eType="#/1/String"/>
</eClassifiers>
When running the transformation on the same models with an atl run configuration everything works fine, so I'm a bit surprised.
Any suggestions? I'm starting to get pretty desperate by now
Thanks in advance,
Wim
|
|
|
Re: [ATL] Launching ATL from Java, EMFModelFactory problem [message #524202 is a reply to message #524113] |
Wed, 31 March 2010 07:13 |
William Piers Messages: 301 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------000903090103080800040406
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Hello,
This usually happens when you refered to the .atl file instead of the
..asm (the compiled) one.
Regards,
William
Le 30/03/2010 21:17, Wim a écrit :
> Okay, i decided to avoid this problem and stick to a simple plugin instead.
> Now i'm experiencing a new problem:
> When the launcher runs the transformation, it throws the following error:
>
>
> org.eclipse.m2m.atl.engine.emfvm.VMException: Parsing error, line 1
> column 1: Content is not allowed in prolog.
> Java Stack:
> org.eclipse.m2m.atl.engine.emfvm.VMException: Parsing error, line 1
> column 1: Content is not allowed in prolog.
> at org.eclipse.m2m.atl.engine.emfvm.ASMXMLReader.read(ASMXMLRea der.java:66)
> at
> org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.loadMo dule(EMFVMLauncher.java:171)
>
> at
> org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.getASM FromObject(EMFVMLauncher.java:183)
>
> at
> org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.launch (EMFVMLauncher.java:131)
>
> at transfont.popup.actions.transform.run(transform.java:95)
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:251)
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:584)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:501)
>
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:411)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1598)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1622)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1607)
> at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1 396)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3484)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3068)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2405)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 21)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:493)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:113)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:368)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:592)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 559)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
> Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
> at
> org.eclipse.m2m.atl.engine.emfvm.ASMXMLReader.fatalError(ASM XMLReader.java:185)
>
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper. fatalError(ErrorHandlerWrapper.java:218)
>
> at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.rep ortError(XMLErrorReporter.java:386)
>
> at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.rep ortError(XMLErrorReporter.java:316)
>
> at
> com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFat alError(XMLScanner.java:1441)
>
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl$PrologDispatcher.dispatch(XMLDocumentScannerImpl.java:899 )
>
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java: 368)
>
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(XML11Configuration.java:834)
>
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(XML11Configuration.java:764)
>
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X MLParser.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 javax.xml.parsers.SAXParser.parse(SAXParser.java:176)
> at org.eclipse.m2m.atl.engine.emfvm.ASMXMLReader.read(ASMXMLRea der.java:62)
> ... 36 more
> Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper. createSAXParseException(ErrorHandlerWrapper.java:236)
>
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper. fatalError(ErrorHandlerWrapper.java:215)
>
> ... 48 more
>
>
> I figure this has something to do with one of the models not being
> properly formed in XML. However, I can't seem to find any problem.
>
> The input model and metamodel are from UML2 so I doubt anything is wrong
> here. That would leave 1 possibility, being the output metamodel which
> is a custom SBVR ecore model I made.
>
> Here are the first few lines of that metamodel:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
> <ecore:EPackage name="SBVR" nsURI="http://www.omg.org/sbvr"
> nsPrefix="sbvr">
> <eClassifiers xsi:type="ecore:EClass" name="Package">
> <eStructuralFeatures xsi:type="ecore:EReference" name="things"
> ordered="false"
> upperBound="-1" eType="#/0/Thing" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> ordered="false"
> unique="false" lowerBound="1" eType="#/1/String"/>
> </eClassifiers>
>
>
> When running the transformation on the same models with an atl run
> configuration everything works fine, so I'm a bit surprised.
> Any suggestions? I'm starting to get pretty desperate by now :( Thanks
> in advance,
> Wim
>
>
>
--
Ne manquez pas notre prochaine formation ATL inter entreprises:
ATL - Paris - du 14 au 15 avril 2010
Pour plus de dates et pour le détail de cette formation:
http://www.obeo.fr/pages/formations/fr
Don't forget our next ATL training:
ATL - Paris - 2010 April from 14th to 15th
More dates and training program on:
http://www.obeo.fr/pages/formations/fr
--------------000903090103080800040406
Content-Type: text/x-vcard; charset=utf-8;
name="william_piers.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="william_piers.vcf"
YmVnaW46dmNhcmQNCmZuOldpbGxpYW0gUGllcnMNCm46UGllcnM7V2lsbGlh bQ0Kb3JnOk9i
ZW8NCmFkcjoyIHJ1ZSBSb2JlcnQgU2NodW1hbm47O2xvdCAyNDtOQU5URVM7 OzQ0NDA4O0Zy
YW5jZQ0KZW1haWw7aW50ZXJuZXQ6d2lsbGlhbS5waWVyc0BvYmVvLmZyDQp0 aXRsZTpNREEg
Q29uc3VsdGFudA0KdGVsO3dvcms6KzMzICgwKTIgNTEgMTMgNTAgNTMNCnVy bDpodHRwOi8v
d3d3Lm9iZW8uZnINCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------000903090103080800040406--
|
|
| |
Goto Forum:
Current Time: Tue Apr 23 12:24:59 GMT 2024
Powered by FUDForum. Page generated in 0.04942 seconds
|