HEADS-project / training

Training material to get started with the HEADS technologies
10 stars 16 forks source link

Not longer abel to run ThingML HellowThing #45

Closed sdalgard closed 9 years ago

sdalgard commented 9 years ago

I have started on training 3. , but are not able to get anything working..... When trying to go back to basics ... it doesnt work either....

When doing "run" from Netbeans I get:

Building HelloCfg 1.0-SNAPSHOT

--- exec-maven-plugin:1.2.1:exec (default-cli) @ HelloCfg --- Terminating ThingML app... Exception in thread "Thread-1" java.lang.NullPointerException at org.thingml.java.Component.stop(Component.java:96)

at org.thingml.generated.Main$1.run(Main.java:25)

BUILD SUCCESS

brice-morin commented 9 years ago

First of all, update your ThingML plugins as described here

Note that I have also re-built the HEADS IDE (minimal version) so that it includes by default the latest version of ThingML.

I indeed made changes both in the ThingML-to-Java compiler and in the Java framework for the execution of state machines to better integrate it with Kevoree. I suspect you are generating "old" code and using the new framework, but I will re-test in details and keep you updated.

brice-morin commented 9 years ago

@sdalgard Also, please assign me explicitly for the ThingML-related issues, so that I get an explicit email (instead of continuously watching my github home page). That will make the process more efficient.

brice-morin commented 9 years ago

Here is the code you should obtain for the Main.java of the very first sample of Tutorial 1 (which worked for me in CLI-mode and in Netbeans):

package org.thingml.generated;

import org.thingml.java.*;
import org.thingml.java.ext.*;

import java.util.*;
public class Main {
//Things
public static HelloThing HelloThing_HelloCfg_my_instance;
public static void main(String args[]) {
//Things
HelloThing_HelloCfg_my_instance = (HelloThing) new HelloThing("HelloCfg_my_instance: HelloThing").buildBehavior();
//Connectors
//Starting Things
HelloThing_HelloCfg_my_instance.init();
HelloThing_HelloCfg_my_instance.start();
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
System.out.println("Terminating ThingML app...");HelloThing_HelloCfg_my_instance.stop();
System.out.println("ThingML app terminated. RIP!");}
});

}
}

I guess you are missing the following line: HelloThing_HelloCfg_my_instance.init();, which would explain the null pointer.

Retry after updating your HEADS IDE and close the issue if it works, or post a comment if it still does not work.

sdalgard commented 9 years ago

I updated the HEADS IDE ... now it works :-)