java.lang.NoClassDefFoundError: org/camunda/spin/plugin/variable/SpinValues

I’m having trouble trying to use the SpinValues class. I’m trying to follow the instructions on https://docs.camunda.org/manual/latest/user-guide/data-formats/json/ and my project compiles and produces a WAR but when I run it in wildfly I get java.lang.NoClassDefFoundError: org/camunda/spin/plugin/variable/SpinValues. Is there something special I need to do to get Spin to load?

Hi @marshall.burns,

In pom.xml you need a provided scope dependency to camunda-engine-plugin-spin. I assume you already have this or else your application should not build. For it to run on Wildfly, your application must declare a module dependency to org.camunda.bpm.camunda-engine-plugin-spin.

Cheers,
Thorben

1 Like

Thank you, I was missing the module dependency. Ultimately what I’m trying to do is encode a JSON value such that it can be saved as a process variable without hitting the dreaded 4000 char limitation. I thought I could do this by:
JsonValue jsonValue = SpinValues.jsonValue(json).create();
execution.setVariable(“customerJonny”, jsonValue);
However it still seems that I’m running into the limitation. What method(s) or type(s) are not affected, could you point me at the right doc because the various documentation available for how to store data in process variables isn’t clear about which ones have what limitations in terms of size.

As far as I know, a JsonValue should be persisted in a BLOB field that does not have this restriction. Could you share the exception stacktrace and if possible a failing test case (see https://github.com/camunda/camunda-engine-unittest to get started quickly)?

You were absolutely right, when I wrote a test case it did work, so I went back and found that I had incorrectly included a wrong version of the library where I was setting the value (an older one that was using a string). All is working now. Many many thanks for the assistance!!!