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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to