Home » Archived » M2M (model-to-model transformation) » ATL launch error
ATL launch error [message #521486] |
Wed, 17 March 2010 18:18  |
Eclipse User |
|
|
|
Hi all,
I've written a java application to run a basic ATL transformation. The ".asm" file and all the models came from the families to Persons example, so i exclude any rule or model issue.
I'm getting an exception when laucnhing the transformation itself. The code is as follows:
//Setup launcher...
EMFVMLauncher launcher = new EMFVMLauncher();
CoreService.registerLauncher(launcher);
launcher.initialize(Options);
CoreService.registerFactory("EMF", EMFModelFactory.class);
ModelFactory factory = CoreService.createModelFactory("EMF");
CoreService.registerExtractor("EMF", new EMFExtractor());
CoreService.registerInjector("EMF", new EMFInjector());
EMFInjector injector = new EMFInjector();
IExtractor extractor = CoreService.getExtractor(factory.getDefaultExtractorName());
// Metamodels && models
EMFReferenceModel Metamodel1 = (EMFReferenceModel)factory.newReferenceModel();
//Resource resource = new XMIResourceImpl(URI.createURI("file:/C:/wS/BS/atl_data/sample-Families.xmi"));
injector.inject(Metamodel1, "Families.ecore");
IModel model1 = factory.newModel(Metamodel1);
injector.inject(model1, "sample-Families.xmi");
EMFReferenceModel Metamodel2 = (EMFReferenceModel)factory.newReferenceModel();
injector.inject(Metamodel2, "Persons.ecore");
IModel model2 = factory.newModel(Metamodel2);
// Launching
launcher.addInModel(model1, "IN_MODEL", "IN_META"); //$NON-NLS-1$ //$NON-NLS-2$
launcher.addOutModel(model2, "OUT_MODEL", "OUT_META"); //$NON-NLS-1$ //$NON-NLS-2$
URL asmURL = new URL("file:/C:/wS/BS/one.asm");
InputStream asmInputStream = asmURL.openStream();
InputStream[] modules = new InputStream[1];
modules[0] = asmInputStream;
launcher.launch(ILauncher.RUN_MODE, new NullProgressMonitor(), Collections.<String, Object> emptyMap(),(Object[])modules);
And of course, forgot to post the exception i get:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/m2m/atl/common/ATLExecutionException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
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 bs.atl.PrivatizeAction.privatize(PrivatizeAction.java:169)
at bs.Loader.XsdTest.main(XsdTest.java:63)
Caused by: java.lang.ClassNotFoundException: org.eclipse.m2m.atl.common.ATLExecutionException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Are there any obvious errors with this code?
Any help would be greatly appreciated.
Thank you,
João Vaz
[Updated on: Wed, 17 March 2010 18:25] by Moderator Report message to a moderator
|
|
| |
Re: ATL launch error [message #521651 is a reply to message #521592] |
Thu, 18 March 2010 12:24   |
Eclipse User |
|
|
|
Sylvain EVEILLARD wrote on Thu, 18 March 2010 04:57 | Looks like you're missing some dependencies. Try to add org.eclipse.m2m.atl.common as a dependency.
|
Thanks, it did really help... although now a new problem arises when launching the vm:
org.eclipse.m2m.atl.engine.emfvm.VMException: Could not find model Families
It seems that the metamodel Families isn't being loaded correctly. Just debugged the code, and added a watch to the Families Metamodel and i'm pretty much sure it isn't correct.
To load the Families metamodel i'm using:
EMFReferenceModel Metamodel1 = (EMFReferenceModel)factory.newReferenceModel();
injector.inject(Metamodel1, "file:/C:/wS/BS/Families.ecore");
And the Watch i added returned this:
{org.eclipse.emf.ecore.impl.EClassImpl@dc86eb (name: EDataType) (instanceClassName: null) (abstract: false, interface: false)=[org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a (name: String) (instanceClassName: java.lang.String) (serializable: true)]}
{org.eclipse.emf.ecore.impl.EClassImpl@1546dbc (name: EPackage) (instanceClassName: null) (abstract: false, interface: false)=[org.eclipse.emf.ecore.impl.EPackageImpl@c1186f (name: Families) (nsURI: Families, nsPrefix: null), org.eclipse.emf.ecore.impl.EPackageImpl@12b3349 (name: PrimitiveTypes) (nsURI: PrimitiveTypes, nsPrefix: null)], org.eclipse.emf.ecore.impl.EClassImpl@dc86eb (name: EDataType) (instanceClassName: null) (abstract: false, interface: false)=[org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a (name: String) (instanceClassName: java.lang.String) (serializable: true)]}
null
false
{Member=org.eclipse.emf.ecore.impl.EClassImpl@6a63d3 (name: Member) (instanceClassName: null) (abstract: false, interface: false), Families::Family=org.eclipse.emf.ecore.impl.EClassImpl@b9b8d0 (name: Family) (instanceClassName: null) (abstract: false, interface: false), PrimitiveTypes::String=org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a (name: String) (instanceClassName: java.lang.String) (serializable: true), Families::Member=org.eclipse.emf.ecore.impl.EClassImpl@6a63d3 (name: Member) (instanceClassName: null) (abstract: false, interface: false), String=org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a (name: String) (instanceClassName: java.lang.String) (serializable: true), Family=org.eclipse.emf.ecore.impl.EClassImpl@b9b8d0 (name: Family) (instanceClassName: null) (abstract: false, interface: false)}
org.eclipse.m2m.atl.core.emf.EMFModelFactory@1972e3a
[]
org.eclipse.m2m.atl.core.emf.EMFReferenceModel@1955970
Since i'm new to all this EMF and ATL world i can't seem to figure out if the injected metamodel is correct.
Thanks,
João Vaz
|
|
|
Re: ATL launch error [message #521660 is a reply to message #521651] |
Thu, 18 March 2010 12:31   |
Eclipse User |
|
|
|
Vaz a écrit :
> Sylvain EVEILLARD wrote on Thu, 18 March 2010 04:57
>> Looks like you're missing some dependencies. Try to add
>> org.eclipse.m2m.atl.common as a dependency.
>
> Thanks, it did really help... although now a new problem arises when
> launching the vm:
> org.eclipse.m2m.atl.engine.emfvm.VMException: Could not find model Families
>
>
> It seems that the metamodel Families isn't being loaded correctly. Just
> debugged the code, and added a watch to the Families Metamodel and i'm
> pretty much sure it isn't correct.
> To load the Families metamodel i'm using:
>
> EMFReferenceModel Metamodel1 =
> (EMFReferenceModel)factory.newReferenceModel();
> injector.inject(Metamodel1, "file:/C:/wS/BS/Families.ecore");
>
>
> And the Watch i added returned this:
>
> {org.eclipse.emf.ecore.impl.EClassImpl@dc86eb (name: EDataType)
> (instanceClassName: null) (abstract: false, interface:
> false)=[org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a (name: String)
> (instanceClassName: java.lang.String) (serializable: true)]}
> {org.eclipse.emf.ecore.impl.EClassImpl@1546dbc (name: EPackage)
> (instanceClassName: null) (abstract: false, interface:
> false)=[org.eclipse.emf.ecore.impl.EPackageImpl@c1186f (name: Families)
> (nsURI: Families, nsPrefix: null),
> org.eclipse.emf.ecore.impl.EPackageImpl@12b3349 (name: PrimitiveTypes)
> (nsURI: PrimitiveTypes, nsPrefix: null)],
> org.eclipse.emf.ecore.impl.EClassImpl@dc86eb (name: EDataType)
> (instanceClassName: null) (abstract: false, interface:
> false)=[org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a (name: String)
> (instanceClassName: java.lang.String) (serializable: true)]}
> null
> false
> {Member=org.eclipse.emf.ecore.impl.EClassImpl@6a63d3 (name: Member)
> (instanceClassName: null) (abstract: false, interface: false),
> Families::Family=org.eclipse.emf.ecore.impl.EClassImpl@b9b8d0 (name:
> Family) (instanceClassName: null) (abstract: false, interface: false),
> PrimitiveTypes::String=org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a
> (name: String) (instanceClassName: java.lang.String) (serializable:
> true), Families::Member=org.eclipse.emf.ecore.impl.EClassImpl@6a63d3
> (name: Member) (instanceClassName: null) (abstract: false, interface:
> false), String=org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a (name:
> String) (instanceClassName: java.lang.String) (serializable: true),
> Family=org.eclipse.emf.ecore.impl.EClassImpl@b9b8d0 (name: Family)
> (instanceClassName: null) (abstract: false, interface: false)}
> org.eclipse.m2m.atl.core.emf.EMFModelFactory@1972e3a
> []
> org.eclipse.m2m.atl.core.emf.EMFReferenceModel@1955970
>
>
> Since i'm new to all this EMF and ATL world i can't seem to figure out
> if the injected metamodel is correct.
>
Have a look in your Model using text editor to get its way to refer to
the metamodel. May be the model point out on another instance/flavour of
Families.ecore
--
Cordialement
Vincent MAHÉ
Ingénieur plate-forme - Cesar/Artemisia - Équipe Espresso
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
Tél: +33 (0) 2 99 84 71 00, Fax: +33 (0) 2 99 84 71 71
|
|
|
Re: ATL launch error [message #522389 is a reply to message #521660] |
Mon, 22 March 2010 14:19   |
Eclipse User |
|
|
|
Vincent MAHE wrote on Thu, 18 March 2010 08:31 | Vaz a écrit :
> Sylvain EVEILLARD wrote on Thu, 18 March 2010 04:57
>> Looks like you're missing some dependencies. Try to add
>> org.eclipse.m2m.atl.common as a dependency.
>
> Thanks, it did really help... although now a new problem arises when
> launching the vm:
> org.eclipse.m2m.atl.engine.emfvm.VMException: Could not find model Families
>
>
> It seems that the metamodel Families isn't being loaded correctly. Just
> debugged the code, and added a watch to the Families Metamodel and i'm
> pretty much sure it isn't correct.
> To load the Families metamodel i'm using:
>
> EMFReferenceModel Metamodel1 =
> (EMFReferenceModel)factory.newReferenceModel();
> injector.inject(Metamodel1, "file:/C:/wS/BS/Families.ecore");
>
>
> And the Watch i added returned this:
>
> {org.eclipse.emf.ecore.impl.EClassImpl@dc86eb (name: EDataType)
> (instanceClassName: null) (abstract: false, interface:
> false)=[org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a (name: String)
> (instanceClassName: java.lang.String) (serializable: true)]}
> {org.eclipse.emf.ecore.impl.EClassImpl@1546dbc (name: EPackage)
> (instanceClassName: null) (abstract: false, interface:
> false)=[org.eclipse.emf.ecore.impl.EPackageImpl@c1186f (name: Families)
> (nsURI: Families, nsPrefix: null),
> org.eclipse.emf.ecore.impl.EPackageImpl@12b3349 (name: PrimitiveTypes)
> (nsURI: PrimitiveTypes, nsPrefix: null)],
> org.eclipse.emf.ecore.impl.EClassImpl@dc86eb (name: EDataType)
> (instanceClassName: null) (abstract: false, interface:
> false)=[org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a (name: String)
> (instanceClassName: java.lang.String) (serializable: true)]}
> null
> false
> {Member=org.eclipse.emf.ecore.impl.EClassImpl@6a63d3 (name: Member)
> (instanceClassName: null) (abstract: false, interface: false),
> Families::Family=org.eclipse.emf.ecore.impl.EClassImpl@b9b8d0 (name:
> Family) (instanceClassName: null) (abstract: false, interface: false),
> PrimitiveTypes::String=org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a
> (name: String) (instanceClassName: java.lang.String) (serializable:
> true), Families::Member=org.eclipse.emf.ecore.impl.EClassImpl@6a63d3
> (name: Member) (instanceClassName: null) (abstract: false, interface:
> false), String=org.eclipse.emf.ecore.impl.EDataTypeImpl@134263a (name:
> String) (instanceClassName: java.lang.String) (serializable: true),
> Family=org.eclipse.emf.ecore.impl.EClassImpl@b9b8d0 (name: Family)
> (instanceClassName: null) (abstract: false, interface: false)}
> org.eclipse.m2m.atl.core.emf.EMFModelFactory@1972e3a
> []
> org.eclipse.m2m.atl.core.emf.EMFReferenceModel@1955970
>
>
> Since i'm new to all this EMF and ATL world i can't seem to figure out
> if the injected metamodel is correct.
>
Have a look in your Model using text editor to get its way to refer to
the metamodel. May be the model point out on another instance/flavour of
Families.ecore
--
Cordialement
Vincent MAHÉ
Ingénieur plate-forme - Cesar/Artemisia - Équipe Espresso
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
Tél: +33 (0) 2 99 84 71 00, Fax: +33 (0) 2 99 84 71 71
|
Hi,
Thanks for your help. After taking an intensive look at the models (and modifying them) i couldn't solve the problem, though if i had to guess i'd say I have a problem in the "sample-families.xmi" reference to the ecore model "Families".
I still get:
org.eclipse.m2m.atl.engine.emfvm.VMException: Could not find model Families
Both models are in the same directory and the used models refer to the ATL Families-Persons example.
Families.ecore:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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="Families">
<eClassifiers xsi:type="ecore:EClass" name="Family">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lastName" ordered="false" unique="false" lowerBound="1" eType="/1/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="father" ordered="false" lowerBound="1" eType="/0/Member" containment="true" eOpposite="/0/Member/familyFather"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="mother" ordered="false" lowerBound="1" eType="/0/Member" containment="true" eOpposite="/0/Member/familyMother"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sons" ordered="false" upperBound="-1" eType="/0/Member" containment="true" eOpposite="/0/Member/familySon"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="daughters" ordered="false" upperBound="-1" eType="/0/Member" containment="true" eOpposite="/0/Member/familyDaughter"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Member">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="firstName" ordered="false" unique="false" lowerBound="1" eType="/1/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="familyFather" ordered="false" eType="/0/Family" eOpposite="/0/Family/father"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="familyMother" ordered="false" eType="/0/Family" eOpposite="/0/Family/mother"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="familySon" ordered="false" eType="/0/Family" eOpposite="/0/Family/sons"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="familyDaughter" ordered="false" eType="/0/Family" eOpposite="/0/Family/daughters"/>
</eClassifiers>
</ecore:EPackage>
<ecore:EPackage name="PrimitiveTypes">
<eClassifiers xsi:type="ecore:EDataType" name="String"/>
</ecore:EPackage>
</xmi:XMI>
And the sample-Families.xmi:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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"
xmlns="Families">
<Family lastName="March">
<father firstName="Jim"/>
<mother firstName="Cindy"/>
<sons firstName="Brandon"/>
<daughters firstName="Brenda"/>
</Family>
<Family lastName="Sailor">
<father firstName="Peter"/>
<mother firstName="Jackie"/>
<sons firstName="David"/>
<sons firstName="Dylan"/>
<daughters firstName="Kelly"/>
</Family>
</xmi:XMI>
Thanks,
João Vaz
[Updated on: Mon, 22 March 2010 14:20] by Moderator Report message to a moderator
|
|
|
Re: ATL launch error [message #524055 is a reply to message #522389] |
Tue, 30 March 2010 13:36   |
Eclipse User |
|
|
|
Finally i understood where the error was:
// Launching
launcher.addInModel(model1, "IN_MODEL", "IN_META"); //$NON-NLS-1$ //$NON-NLS-2$
launcher.addOutModel(model2, "OUT_MODEL", "OUT_META"); //$NON-NLS-1$ //$NON-NLS-2$
The names of both model and metamodel were wrong and thus returning the null pointer error. 
Thanks,
João Vaz
|
|
|
Re: ATL launch error [message #524082 is a reply to message #521486] |
Tue, 30 March 2010 15:32   |
Eclipse User |
|
|
|
Care to share the full working code with us? Including the imports. I'm trying to get a similar thing to work but everything fails as soon as I try to create an EMF model factory.
Thanks
|
|
| |
Goto Forum:
Current Time: Mon Feb 10 07:51:55 GMT 2025
Powered by FUDForum. Page generated in 0.03450 seconds
|