Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [MWE] No logging and strange errors when workflow is run in a context of a plugin
[MWE] No logging and strange errors when workflow is run in a context of a plugin [message #649700] Thu, 20 January 2011 11:36 Go to next message
Tom Brandenburg is currently offline Tom Brandenburg
Messages: 58
Registered: October 2010
Location: Abstatt, Germany
Member
Hello everyone,

My uml-2-ansic project is set up in a way that it makes contributions to the popup menu in the ResourceExplorer of the Java perspective. Said more precisely, once you right-click on a UML file you can select "Generate Code..." and C-Code is generated out of the UML file. At least it should be like that Smile
For this I have an UI-plugin that invokes a method contained in a package of another plugin which again invokes a WorkflowRunner with the specified workflow:
		[...]
		NullProgressMonitor npm = new NullProgressMonitor();
		WorkflowRunner wRunner = new WorkflowRunner();
		wRunner.prepare(this.workflowUri.getPath(), npm, properties);
		IssuesImpl issues = new IssuesImpl();
		result = wRunner.executeWorkflow(slotContents, issues);

Executing this procedure works fine in a workspace context, but once I launch a eclipse application with the UI plugin, the log disappears and executeWorkflow has false as a result.

After some debugging session I found out that somehow org.apache.commons.logging.impl.NoOpLog is assigned to WorkflowRunner's logger and that executeWorkflow ends up with an exception handling, which is not shown at all in the console or somewhere else. It could only be seen in the debugger. The error comes up after
workflow.invoke(wfContext, monitor, issues);

in executeWorkflow and looks like:
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.core.internal.resources.ResourceException: Resource '/temp/eclipse.uml' does not exist.

Although e.val$location is "/C:/temp/eclipse.uml".

So I have two problems: At first I have no logging at all and my paths get somehow cutted.
As I already said, in the workspace everything works fine with the same paths, but once executed as a plugin the workflow execution fails.

Do you have any idea?

Thanks in advance and best regards
Tom Smile
Re: [MWE] No logging and strange errors when workflow is run in a context of a plugin [message #649710 is a reply to message #649700] Thu, 20 January 2011 12:09 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten Thoms
Messages: 354
Registered: July 2009
Location: Dortmund
Senior Member

Hi Tom!

To your second problem: You should use platform resource URIs to resolve the file.

Maybe this code helps, it is from a project where a MWE transformation is invoked through an action:

http://www.edna-site.org/svn/trunk/rcp/org.edna.datamodel.tr ansformations.ui/src/org/edna/datamodel/transformations/ui/a ctions/TransformAction.java
http://www.edna-site.org/svn/trunk/rcp/org.edna.datamodel.tr ansformations.ui/src/org/edna/datamodel/transformations/ui/u til/

~ Karsten


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: [MWE] No logging and strange errors when workflow is run in a context of a plugin [message #649714 is a reply to message #649710] Thu, 20 January 2011 12:17 Go to previous messageGo to next message
Tom Brandenburg is currently offline Tom Brandenburg
Messages: 58
Registered: October 2010
Location: Abstatt, Germany
Member
Hey Karsten,

thank you for your answer! I am going to try out platform URIs and analyse your referenced files.
I'll give a note about the output Smile

Thanks and bye
Tom
Re: [MWE] No logging and strange errors when workflow is run in a context of a plugin [message #649730 is a reply to message #649714] Thu, 20 January 2011 13:27 Go to previous messageGo to next message
Tom Brandenburg is currently offline Tom Brandenburg
Messages: 58
Registered: October 2010
Location: Abstatt, Germany
Member
Hello,

I am a little bit confused. In your mentioned project they use platform resource URIs:
			URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), false);
			[...]
			args.put("modelFile", fileURI.toString());

And directly feed them into their workflow:
	<property name="standalone" value="true"/>
    <!-- initializes resourcemaps, urimaps, etc. -->
    <bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
    	<platformUri value=".."/>
    </bean>

    [...]

	<!-- read the UML model -->
    <component class="org.eclipse.emf.mwe.utils.Reader" id="UML Reader">
        <uri value="${modelFile}"/>
        <modelSlot value="${modelSlot}"/>
    </component>

In my past projects I had to define an uriMap for every different platform URI. Why they don't have to? When I follow your suggestion and use URI maps then I also get an error that my path is unmapped.

Any idea?

Thanks and bye
Tom
Re: [MWE] No logging and strange errors when workflow is run in a context of a plugin [message #649788 is a reply to message #649730] Thu, 20 January 2011 15:35 Go to previous messageGo to next message
Tom Brandenburg is currently offline Tom Brandenburg
Messages: 58
Registered: October 2010
Location: Abstatt, Germany
Member
Hello,

unfortunately I couldn't manage to activate any logging in the console. Even with the given project it wasn't possible. Only System.out.println works - that's really frustrating Confused
Does anyone no why no logger is present (NoOpLog)?

Thanks in advance and best regards
Tom
Re: [MWE] No logging and strange errors when workflow is run in a context of a plugin [message #649878 is a reply to message #649788] Thu, 20 January 2011 20:17 Go to previous messageGo to next message
Tom Brandenburg is currently offline Tom Brandenburg
Messages: 58
Registered: October 2010
Location: Abstatt, Germany
Member
Ok, I think I have to move a step back, since I am facing that console output for a plugin seems to be not the easiest thing. That's why a general question:
Is it possible to get these messages from the workflow in any form in my plugin?
0    INFO  WorkflowRunner     - --------------------------------------------------------------------------------------
125  INFO  WorkflowRunner     - EMF Modeling Workflow Engine 0.7.2, Build v200908120417
125  INFO  WorkflowRunner     - (c) 2005-2009 openarchitectureware.org and contributors
125  INFO  WorkflowRunner     - --------------------------------------------------------------------------------------
125  INFO  WorkflowRunner     - running workflow: C:\temp\test.mwe
125  INFO  WorkflowRunner     - 
187  INFO  WorkflowRunner     - workflow completed in 0ms!


Thanks and bye
Tom
Re: [MWE] No logging and strange errors when workflow is run in a context of a plugin [message #649995 is a reply to message #649878] Fri, 21 January 2011 11:15 Go to previous message
Tom Brandenburg is currently offline Tom Brandenburg
Messages: 58
Registered: October 2010
Location: Abstatt, Germany
Member
Hello,

ok, now, I managed to get the log outputs with the help of this code and launching with "-console -consoleLog".

Now I get those outputs:

[INFO] WorkflowRunner - [my log] --------------------------------------------------------------------------------------
[INFO] WorkflowRunner - [my log] EMF Modeling Workflow Engine Development-Snapshot
[INFO] WorkflowRunner - [my log] (c) 2005-2009 openarchitectureware.org and contributors
[INFO] WorkflowRunner - [my log] --------------------------------------------------------------------------------------
[INFO] WorkflowRunner - [my log] running workflow: C:\Programme\Eclipse_Modeling\Workspace\dev.test.plugin\src\dev\test\plugin\handler\main.mwe
[INFO] WorkflowRunner - [my log] 
[INFO] StandaloneSetup - [my log] Registering platform uri 'C:\Programme\Eclipse_Modeling\Workspace'
...
[ERROR] VisitorCreator - [my log] java.lang.IllegalStateException: Missing required plugin 'org.eclipse.uml2.uml.resources' in classpath. <java.lang.RuntimeException: java.lang.IllegalStateException: Missing required plugin 'org.eclipse.uml2.uml.resources' in classpath.>java.lang.RuntimeException: java.lang.IllegalStateException: Missing required plugin 'org.eclipse.uml2.uml.resources' in classpath.
	at org.eclipse.emf.mwe.internal.core.ast.util.InjectorSimple.setValue(InjectorSimple.java:35)
	at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.visitSimpleParamAST(VisitorCreator.java:200)
	at org.eclipse.emf.mwe.internal.core.ast.util.VisitorBase.visit(VisitorBase.java:49)
	at org.eclipse.emf.mwe.internal.core.ast.AbstractASTBase.accept(AbstractASTBase.java:44)
	at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.createBean(VisitorCreator.java:155)
	at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.visitComponentAST(VisitorCreator.java:116)
	at org.eclipse.emf.mwe.internal.core.ast.util.VisitorBase.visit(VisitorBase.java:37)
	at org.eclipse.emf.mwe.internal.core.ast.AbstractASTBase.accept(AbstractASTBase.java:44)
	at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.createBean(VisitorCreator.java:155)
	at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.visitComponentAST(VisitorCreator.java:116)
	at org.eclipse.emf.mwe.internal.core.ast.util.VisitorBase.visit(VisitorBase.java:37)
	at org.eclipse.emf.mwe.internal.core.ast.AbstractASTBase.accept(AbstractASTBase.java:44)
	at org.eclipse.emf.mwe.internal.core.ast.util.WorkflowFactory.parseInitAndCreate(WorkflowFactory.java:72)
	at org.eclipse.emf.mwe.internal.core.ast.util.WorkflowFactory.parseInitAndCreate(WorkflowFactory.java:51)
	at org.eclipse.emf.mwe.core.WorkflowRunner.prepare(WorkflowRunner.java:331)
	at dev.test.plugin.handler.WorkflowRunnerAdapter.run(WorkflowRunnerAdapter.java:19)
	at dev.test.plugin.handler.CommandHandler.execute(CommandHandler.java:29)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:770)
	at org.eclipse.ui.menus.CommandContributionItem.access$10(CommandContributionItem.java:756)
	at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:746)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
	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(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	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: java.lang.IllegalStateException: Missing required plugin 'org.eclipse.uml2.uml.resources' in classpath.
	at org.eclipse.xtend.typesystem.uml2.Setup.setStandardUML2Setup(Setup.java:70)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.emf.mwe.internal.core.ast.util.InjectorSimple.setValue(InjectorSimple.java:33)
	... 50 more

What's interesting is that if the plugin is executed as an eclipse app I had to change
<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" platformUri="..">

to
<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" platformUri="Workspace">

so that the platform uri 'C:\Programme\Eclipse_Modeling\Workspace' is registered and not 'C:\Programme'.

I follow up the error "Missing required plugin 'org.eclipse.uml2.uml.resources' in classpath." in here.

Maybe now someone has an idea Smile

Thanks and bye
Tom Smile

[Updated on: Fri, 21 January 2011 11:17]

Report message to a moderator

Previous Topic:Acceleo 3 Problem with Stereotypes
Next Topic:Problems integrating
Goto Forum:
  


Current Time: Sat Oct 25 18:59:37 GMT 2014

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

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