contiki-ng / cooja

This is a fork of the Cooja network simulator from contiki-os/contiki
Other
30 stars 48 forks source link

ScriptRunner doesn't load #38

Closed bofh69 closed 2 years ago

bofh69 commented 4 years ago

I'm using the latest master and try to run it with:

openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)

When loading a simulation I get the following exception:

org.contikios.cooja.Cooja$PluginConstructionException: Construction error for tool of class: org.contikios.cooja.plugins.ScriptRunner
    at org.contikios.cooja.Cooja.startPlugin(Cooja.java:1878)
    at org.contikios.cooja.Cooja.tryStartPlugin(Cooja.java:1774)
    at org.contikios.cooja.Cooja.setPluginsConfigXML(Cooja.java:3689)
    at org.contikios.cooja.Cooja.loadSimulationConfig(Cooja.java:3443)
    at org.contikios.cooja.Cooja.loadSimulationConfig(Cooja.java:3363)
    at org.contikios.cooja.Cooja.doLoadConfig(Cooja.java:2410)
    at org.contikios.cooja.Cooja$4.run(Cooja.java:625)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.contikios.cooja.Cooja.startPlugin(Cooja.java:1858)
    ... 7 more
Caused by: java.lang.ClassCastException: class javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper cannot be cast to class javax.swing.text.AbstractDocument$DefaultDocumentEvent (javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper and javax.swing.text.AbstractDocument$DefaultDocumentEvent are in module java.desktop of loader 'bootstrap')
    at jsyntaxpane.CompoundUndoMan.undoableEditHappened(CompoundUndoMan.java:63)
    at java.desktop/javax.swing.text.AbstractDocument.fireUndoableEditUpdate(AbstractDocument.java:293)
    at java.desktop/javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:761)
    at java.desktop/javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:716)
    at java.desktop/javax.swing.text.PlainDocument.insertString(PlainDocument.java:131)
    at java.desktop/javax.swing.text.DefaultEditorKit.read(DefaultEditorKit.java:274)
    at java.desktop/javax.swing.JEditorPane.setText(JEditorPane.java:1428)
    at org.contikios.cooja.plugins.ScriptRunner.updateScript(ScriptRunner.java:619)
    at org.contikios.cooja.plugins.ScriptRunner.<init>(ScriptRunner.java:276)
    ... 12 more

After that the simulation works as expected (except my script obviously isn't running).

I tried to run with java8 first, but then cooja hangs when loading a simulation.

I guess the classes have been loaded by two different class-loaders, but that's about all I remember about java. What more can I do to debug or fix this?

alexrayne commented 4 years ago

there is provided docker container in contiki-ng, where i works with cooja. cooja not properly work on 64bit-platform. it is old issue

azeemjahangir commented 3 years ago

Any one know about the pdr and latency code in C file for cooja simulator

bofh69 commented 3 years ago

@azeemjahangir That question has nothing to do with this issue so please create a new issue for it.

nfi commented 2 years ago

This issue was addressed in #55.