NoClassDefFoundError: scala/compat/java8/OptionConverters$RichOptionForJava8$

0
I'm experimenting with Akka in a Mendix 7.20.1 project, using the versions of Scala and Akka as bundled with the distrbution:  C:\Program Files\Mendix\7.20.1.42379\runtime\bundles\org.scala-lang.modules.scala-java8-compat_2.12.jar C:\Program Files\Mendix\7.20.1.42379\runtime\bundles\org.scala-lang.scala-library.jar C:\Program Files\Mendix\7.20.1.42379\runtime\bundles\com.typesafe.akka.akka-actor_2.12.2.5.17.jar C:\Program Files\Mendix\7.20.1.42379\runtime\bundles\com.typesafe.config.1.3.3.jar The project requires a tweak to the .policytemplate to allow read and write from java.util.PropertyPermission (or disable cloud security) When my child actors throw an exception with the supervisor strategy set to restart, I get the following error: Uncaught error from thread [application-akka.actor.default-dispatcher-2]: scala/compat/java8/OptionConverters$RichOptionForJava8$, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application] java.lang.NoClassDefFoundError: scala/compat/java8/OptionConverters$RichOptionForJava8$   This is despite the scala-java8-compat_2.12.jar file being present in the build path as shown above. I can also import these classes into my code without obvious issue. I have cleaned an fully rebuilt the project. Has anybody got any pointers on where to look to track down this problem?   Thanks
asked
3 answers
0

Just to clarify, I'm using the Java API for Akka

answered
0

Someone with more knowledge on the way OSGi is used in Mendix should chime in here. But I can tell you as much as that there are different scope for libraries. If you want to be able to use something in your own Java actions, you should put the libraries you need in the userlib folder of your project.

Everything bundles with the Mendix runtime should not be useable at all from you own code, so I am somwehat surprised that is is. Maybe this has something to do with the way you start your application?

As a quick fix, try try putting the required libs in the userlib folder.

answered
0

Thanks for the suggestion. I can confirm that I originally tried copying the jars into the userlib folder, which had the same result as linking them as external jars in the eclipse project - it doesn't seem to work either way.

Both approaches allow the code to be compiled, and for the OptionConverter classes to be used within the project, but both show the same runtime NoClassDefFoundError exception when the supervisor actor tries to handle an exception from the child actor (in the case of restart supervisor strategy)

 

answered