Javascript with Spin results in ClassNotFoundException org.camunda.spin.Spin.S

I tried to use the Example: https://github.com/camunda/camunda-bpm-examples/tree/master/servicetask/rest-service with the Camunda Full Distribution 7.8 and Java 8_171.
I only changed the External Script to inline script and copied the Javascript code there.

i get this Exception:
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.camunda.spin.Spin.S
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:397)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:449)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
…

I tested this on Windows 7 & Debien 9.4 same Result.
Tomcat & Wildfly 10
Any Ideas ?

I can also see, that Spin is loaded.
2018-04-27 08:09:10,860 INFO [org.camunda.spin] (ServerService Thread Pool – 60) SPIN-01010 Discovered Spin data format provider: org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatProvider[name = application/json]
2018-04-27 08:09:11,741 INFO [org.camunda.spin] (ServerService Thread Pool – 60) SPIN-01010 Discovered Spin data format provider: org.camunda.spin.impl.xml.dom.format.DomXmlDataFormatProvider[name = application/xml]
2018-04-27 08:09:11,790 INFO [org.camunda.spin] (ServerService Thread Pool – 60) SPIN-01009 Discovered Spin data format: org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat[name = application/xml]
2018-04-27 08:09:11,790 INFO [org.camunda.spin] (ServerService Thread Pool – 60) SPIN-01009 Discovered Spin data format: org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat[name = application/json]

is it possible that nashorn doesn’t search in the correct classpath ?

In Expression Language Spin is working, in my first test the JSON was wrong, what brings an different error.

Maybe this Helps:
Caused by: java.lang.ClassNotFoundException: org.camunda.spin.Spin.S
at jdk.nashorn.internal.runtime.NativeJavaPackage.classNotFound(NativeJavaPackage.java:162)
at jdk.nashorn.internal.scripts.Script$3$^eval_.:program(:6)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
Seems that only nashorn can not find the class

Can you test your scenario on the official camunda docker image build ?

1 Like

Just tested it and it WORKS !

Is it possible, that the Java Installation is the problem ?

My first test was with latest and that works, now i tested with wildfly-7.8.0 Docker install and it also fails. Like my Local Install. :frowning:

I tested not the following Options:
Local full install Tomcat 7.9.0 alpha - works
Doker:
Tomcat 7.9.0 alpha 3 - works
latest - works
Wildfly latest - Not working
Wildfly 7.5.0 - Not working ( But it is a different error, something with valid certificate…)
Wildfly 7.9.0-snapshot - Not working
jboss 7.9.0-SNAPSHOT - Not Working ( But it is a different error, something with valid certificate…)

For my Opionion is something with the Wildfly config or integration not ok.

This is my Testfile: GetHoliday.bpmn (7.2 KB)

Thanks for doing the leg work on that,

guys at @camunda should be able to provide more insight now .

In my Case, i fixed the Problem. In Wildfly you can declare Libraries as Global and then it is reachable via JavaScript.

1 Like

Hi Axel,
I recently came across the same ClassNotFoundException on WildFly 14, Camunda 7.10 while executing the following JavaScript snippet in a Script task:

var userName = {“lastname”:“Smith”,“firstname”:“Jack”);
S(JSON.stringify(userName));

Can you share how you fixed the problem? Which library did you declare as global? In which section of the standalone.xml file did you add new lines? How does the standalone.xml look like after your change?
Thanks in advance!
X.

1 Like

I added this:
<subsystem xmlns="urn:jboss:domain:ee:4.0"> <global-modules> <module name="org.jsoup"/> <module name="org.camunda.spin.camunda-spin-core"/> <module name="org.camunda.spin.camunda-spin-dataformat-json-jackson"/> <module name="org.camunda.spin.camunda-spin-dataformat-xml-dom"/> <module name="com.jayway.jsonpath.json-path"/> <module name="org.camunda.template-engines.camunda-template-engines-freemarker"/> </global-modules>

2 Likes

Awesome - works like a charm! How did you find that out?
Thanks for sharing - helped a lot :slight_smile:
Kind regards,
Xaver