Hi,

Is the scala interpreter using the thread context class loader ? In this
case, you should set the thread context class loader to be the bundle
class loader before calling the scala interpreter.

For example in your eval method:

     ClassLoader current =
Thread.currentThread().getContextClassLoader();
     try {

Thread.currentThread.setContextClassLoader(getClass().getClassLoader());

         .... call the interpreter now ....

     } finally {
         Thread.currentThread.setContextClassLoader(old);
     }

Hope this helps.

Regards
Felix

Am Dienstag, den 10.06.2008, 01:17 +0530 schrieb janandith jayawardena:
> Hi Felix,
> 
> Thanks for the advice. I added the following to the pom.xml .
> 
> 
> <Embed-Dependency>scala-library;scala-compiler;inline=true</Embed-Dependency>
> 
>                         <Import-Package>
>                             org.apache.tools.ant.*;resolution:=optional, *
>                         </Import-Package>
> 
> Now the error messages do not appear in launchpad. But when I run the
> interpreter I get an exception.
> 
> scala.tools.nsc.FatalError: object scala not found.
>         at
> scala.tools.nsc.symtab.Definitions$definitions$.getModuleOrClass(Definitions.scala:352)
>         at
> scala.tools.nsc.symtab.Definitions$definitions$.getModule(Definitions.scala:323)
>         at
> scala.tools.nsc.symtab.Definitions$definitions$.ScalaPackage(Definitions.scala:34)
>         at
> scala.tools.nsc.symtab.Definitions$definitions$.ScalaPackageClass(Definitions.scala:35)
>         at
> scala.tools.nsc.symtab.Definitions$definitions$.init(Definitions.scala:653)
>         at scala.tools.nsc.Global$Run.<init>(Global.scala:459)
>         at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:467)
> 
> I did some searching on this error and I found this link with a solution.
> 
> http://www.softwaresecretweapons.com/jspwiki/scalatoolsnscfatalerror-object-scala-not-found
> 
> But the solution is for ant. How can I fix the pom.xml to reflect what's
> done in this ant script. I've tried to set the class path using the
> CLASSPATH variable but that didn't work.
> 
> janandith.

Reply via email to