Unfortunately it's a third party library that uses class loader for getting a class and I cannot change it to use ActorSystem's classloader. I know Akka microkernal is deprecated but replacing it is not an option for now.
For now I'm just modifying start scripts for adding one more class path to AKKA_CLASSPATH as a fix. On Thursday, May 19, 2016 at 10:29:13 AM UTC+5:30, Patrik Nordwall wrote: > > Did you try to use the classloader of the ActorSystem? > Note that Akka microkernel is deprecated and better replacement is > documented. > > /Patrik > ons 18 maj 2016 kl. 08:36 skrev Sidharth Khattri <sidh...@knoldus.com > <javascript:>>: > >> I know this thread is quite old now, but encountered similar kind of >> problem. Did you find any solution? >> >> >> On Wednesday, February 26, 2014 at 7:20:33 AM UTC+5:30, Constantine Kozak >> wrote: >>> >>> Hello, >>> >>> I've created an Akka microkernel distribution (2.2.3) and having a >>> problem on a launch. My application depends on a library, which uses >>> reflection to instantiate a logger implementation >>> >>> val c = >>>> Class.forName(logger.className).getConstructor(classOf[Class[_]], >>>> classOf[TypesafeConfig]) >>>> c.newInstance(getClass, logger.props).asInstanceOf[Logger] >>> >>> >>> I specify className in properties and implementation class is located in >>> my application code. So X library through reflection instantiates a class >>> which is located in my app. It works fine when I launch in from IntelliJ >>> Idea. >>> >>> But when I use Akka Microkernel these jars are located in different >>> folders: my app's jar is in deploy folder, and lib's jar in lib folder. I >>> use default start.sh so AKKA_CLASSPATH looks like this: >>> >>> AKKA_CLASSPATH="$AKKA_HOME/config:$AKKA_HOME/lib/*" >>> >>> So when I run it I get >>> >>>> java.lang.ClassNotFoundException: my.LoggerImpl >>>> >>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:366) >>>> >>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:355) >>>> >>>> at java.security.AccessController.doPrivileged(Native Method) >>>> >>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:354) >>>> >>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:423) >>>> >>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) >>>> >>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:356) >>>> >>>> at java.lang.Class.forName0(Native Method) >>>> >>>> at java.lang.Class.forName(Class.java:188) >>>> >>>> at my.LoggerFactory$class.$init$(LoggerFactory.scala:25) >>>> >>>> >>> If I copy my app's jar to a lib directory or change Akka classpath to >>> AKKA_CLASSPATH="$AKKA_HOME/config:$AKKA_HOME/deploy/*:$AKKA_HOME/lib/*" it >>> works fine so it looks like my app's jar is not in classpath. But it was >>> able to find my app's launch class because it tries to start properly. >>> >>> So I know that I can always edit start.sh to make it work or use >>> external scripts to fix it, but would prefer something what lives in SBT. >>> So is there a way to do that automatically through SBT configuration? Like >>> edit AKKA_CLASSPATH or copy my app into a lib folder (I've also found a >>> source code for akka.sbt.AkkaKernelPlugin and it looks like that sh file is >>> hardcoded). >>> >>> Thanks, Constantine >>> >> -- >> >>>>>>>>>> Read the docs: http://akka.io/docs/ >> >>>>>>>>>> Check the FAQ: >> http://doc.akka.io/docs/akka/current/additional/faq.html >> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user >> --- >> You received this message because you are subscribed to the Google Groups >> "Akka User List" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to akka-user+...@googlegroups.com <javascript:>. >> To post to this group, send email to akka...@googlegroups.com >> <javascript:>. >> Visit this group at https://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.