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\184.108.40.206379\runtime\bundles\org.scala-lang.modules.scala-java8-compat_2.12.jar C:\Program Files\Mendix\220.127.116.11379\runtime\bundles\org.scala-lang.scala-library.jar C:\Program Files\Mendix\18.104.22.168379\runtime\bundles\com.typesafe.akka.akka-actor_22.214.171.124.17.jar C:\Program Files\Mendix\126.96.36.199379\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
Just to clarify, I'm using the Java API for Akka
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.
🏎️ Nikel HDI
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)