Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » MOFScript » call transformation from Java API
call transformation from Java API [message #589779] Thu, 11 March 2010 12:16 Go to next message
yeliu is currently offline yeliuFriend
Messages: 145
Registered: July 2009
Senior Member
Hello,
I tried running the TestAPI.java found in the user guide.
The execution is suspended at the line: Resource resource = rSet.getResource(uri, true);
throwing the following exceptions:
-----------------
Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.eclipse.org/uml2/2.1.0/UML' not found. (file:/home/yeliu/workspace/MOFScriptApp/Architectural_Descr iption.uml, 2, 177)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDe mandLoadException(ResourceSetImpl.java:315)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:274)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:397)
at TestAPI.execute(TestAPI.java:65)
at TestAPI.test(TestAPI.java:98)
at TestAPI.main(TestAPI.java:120)
Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.eclipse.org/uml2/2.1.0/UML' not found. (file:/home/yeliu/workspace/MOFScriptApp/Architectural_Descr iption.uml, 2, 177)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:2590)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:2421)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1299)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1468)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1019)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:83)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:1001)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:712)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:169)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(AbstractSAXParser.java:501)
at

--------------------
I inserted a print statement right after :
URI uri = URI.createFileURI(sourceModelFile.getAbsolutePath());
and get the following URI printed.
file:/home/yeliu/workspace/MOFScriptApp/Architectural_Descri ption.uml
The input model of the transformation is :http://www.eclipse.org/uml2/3.0.0/UML
Any one can help with this ?
Thanks a lot!


M
Re: call transformation from Java API [message #589788 is a reply to message #589779] Fri, 12 March 2010 12:11 Go to previous messageGo to next message
Gøran K. Olsen is currently offline Gøran K. OlsenFriend
Messages: 184
Registered: July 2009
Senior Member
Hello,

the exception says uml2/2.1.0/UML not found, you say that your input is
3.0.0.

What does the input model in your transformation say, http//.........?

Cheers,
G
Re: call transformation from Java API [message #589797 is a reply to message #589788] Fri, 12 March 2010 12:22 Go to previous messageGo to next message
yeliu is currently offline yeliuFriend
Messages: 145
Registered: July 2009
Senior Member
Hello,
The header of the input model which we wanna transform is the following:
---------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML" xmi:id="_dcOv4OiaEd6gMtZRCjS81g" name="Metamodel">
------------------

The input metamodel to the transformation now is uml:"http://www.eclipse.org/uml2/3.0.0/UML". It was uml="http://www.eclipse.org/uml2/2.1.0/UML before, but then there are parsing errors. The parsing errors are gone after change it to uml2/3.0.0.
We are very confused.



M
Re: call transformation from Java API [message #589805 is a reply to message #589797] Fri, 12 March 2010 16:19 Go to previous messageGo to next message
Gøran K. Olsen is currently offline Gøran K. OlsenFriend
Messages: 184
Registered: July 2009
Senior Member
And what org.eclipse...uml...jars are you adding to your classpath?

The versions are supposed to match....

If you are not able to make this work, you will have to send me the model,
transformation and the java code so I can take a detailed look.

/G
Re: call transformation from Java API [message #911896 is a reply to message #589805] Wed, 12 September 2012 14:41 Go to previous messageGo to next message
Federico Toledo is currently offline Federico ToledoFriend
Messages: 97
Registered: April 2012
Location: Ciudad Real, Spain
Member
Hello!

I am trying also to execute my MOFScript from a java program. I have a different exception, and I didnt find anything about it (at the end is the stack trace).
I am trying with the example TestAPI.java, but I needed to adjust it here:

public ExecuteMofScript () {	
		lePackage = UMLPackage.eINSTANCE;
		parserUtil = new ParserUtil();
		execMgr = ExecutionManager.getExecutionManager();
	}


because in the example it is an error, because the private attributes were redefined in the constructor.
I am trying with a foo mofscript, very simple, in order to simplify the test.

It seems like I am missing a library, but I've added all the required to compile as indicated.

The exception is thrown in this line: execMgr.executeTransformation();
calling a method of ExecutionManager.

BTW: when is the mofscript passed to this class? with the "parse" function?

thank you so much!!



Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/mofscript/fileresourcemodel/frm/FrmFactory
	at org.eclipse.mofscript.runtime.MofScriptExecuterFactory.createExecutionEnvironment(MofScriptExecuterFactory.java:223)
	at org.eclipse.mofscript.runtime.ExecutionManager.executeTransformation(ExecutionManager.java:1082)
	at mofScriptExecution.ExecuteMofScript.execute(ExecuteMofScript.java:98)
	at mofScriptExecution.ExecuteMofScript.test(ExecuteMofScript.java:112)
	at mofScriptExecution.ExecuteMofScript.main(ExecuteMofScript.java:131)
Caused by: java.lang.ClassNotFoundException: org.eclipse.mofscript.fileresourcemodel.frm.FrmFactory
	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)
	... 5 more
Re: call transformation from Java API [message #911903 is a reply to message #911896] Wed, 12 September 2012 14:56 Go to previous message
Federico Toledo is currently offline Federico ToledoFriend
Messages: 97
Registered: April 2012
Location: Ciudad Real, Spain
Member
solved!

I needed to add another jar:

org.eclipse.mofscript.fileresourcemodel_1.4.0.3\org.eclipse.mofscript.fileresourcemodel.jar
Previous Topic:Setting 'type' on uml.Property
Next Topic:[Help] Problem with MOFscript installation
Goto Forum:
  


Current Time: Thu Apr 18 02:08:19 GMT 2024

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

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

Back to the top