[ 
https://issues.apache.org/jira/browse/SLING-1511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862010#action_12862010
 ] 

Scott Murphy commented on SLING-1511:
-------------------------------------

Also, I am having problems trying to run a script from a java web application 
because of the fact the classpath is being built from environment variable 
Strings.  Is it possible to use the existing ClassLoader?  I see this was 
discussed here:

http://scala-programming-language.1934581.n4.nabble.com/How-to-compile-Scala-code-from-java-using-the-current-ClassLoader-instead-of-a-string-based-classpat-td1955873.html#a1955873

but no one every replied to it.

The problem I am having is I get a read java.security.AccessControlException 
when trying to execute the following code:

new ScriptEngineManager().getEngineByName("scala").eval("println(\"hello\")")

javax.script.ScriptException: Error executing script
        at 
org.apache.sling.scripting.scala.ScalaScriptEngine.eval(ScalaScriptEngine.scala:155)
        at com.codeconsole.ScriptRunner.run(ScriptRunner.java:95)
        at execute.run(execute.groovy:11)
Caused by: java.security.AccessControlException: access denied 
(java.io.FilePermission 
/Applications/pictage-dev/appengine-java-sdk-1.3.3/lib/appengine-tools-api.jar 
read)
        at scala.tools.nsc.io.AbstractFile$.getDirectory(AbstractFile.scala:44)
        at scala.tools.nsc.io.AbstractFile$.getDirectory(AbstractFile.scala:33)
        at 
scala.tools.nsc.util.ClassPath$Build$$anonfun$addFilesInPath$1.apply(ClassPath.scala:287)
        at 
scala.tools.nsc.util.ClassPath$Build$$anonfun$addFilesInPath$1.apply(ClassPath.scala:286)
        at scala.List.foreach(List.scala:841)
        at 
scala.tools.nsc.util.ClassPath$Build.addFilesInPath(ClassPath.scala:286)
        at scala.tools.nsc.util.ClassPath$Build.<init>(ClassPath.scala:230)
        at 
org.apache.sling.scripting.scala.interpreter.ScalaClasspath$BuildClasspath.<init>(ScalaClasspath.scala:30)
        at 
org.apache.sling.scripting.scala.interpreter.ScalaCompiler.classPath(ScalaCompiler.scala:34)
        at 
org.apache.sling.scripting.scala.interpreter.ScalaCompiler.classPath(ScalaCompiler.scala:27)
        at scala.tools.nsc.Global.rootLoader(Global.scala:233)
        at 
scala.tools.nsc.symtab.Definitions$definitions$.RootClass(Definitions.scala:25)
        at 
scala.tools.nsc.symtab.Definitions$definitions$.EmptyPackage(Definitions.scala:27)
        at 
scala.tools.nsc.symtab.Definitions$definitions$.EmptyPackageClass(Definitions.scala:29)
        at 
scala.tools.nsc.symtab.Definitions$definitions$.init(Definitions.scala:658)
        at scala.tools.nsc.Global$Run.<init>(Global.scala:476)
        at 
org.apache.sling.scripting.scala.interpreter.ScalaInterpreter.compile(ScalaInterpreter.scala:153)
        at 
org.apache.sling.scripting.scala.interpreter.ScalaInterpreter.compile(ScalaInterpreter.scala:169)
        at 
org.apache.sling.scripting.scala.interpreter.ScalaInterpreter.compile(ScalaInterpreter.scala:179)
        at 
org.apache.sling.scripting.scala.ScalaScriptEngine$$anonfun$1.apply(ScalaScriptEngine.scala:118)
        at 
org.apache.sling.scripting.scala.ScalaScriptEngine$$anonfun$1.apply(ScalaScriptEngine.scala:118)
        at 
org.apache.sling.scripting.scala.ScalaScriptEngine.writeLocked(ScalaScriptEngine.scala:174)
        at 
org.apache.sling.scripting.scala.ScalaScriptEngine.eval(ScalaScriptEngine.scala:117)
        ... 2 more

Which is obviously happing because of the following code from 
ScalaCompiler.scala:

    new classPath0.BuildClasspath(settings.classpath.value, 
settings.sourcepath.value,
      settings.outdir.value, settings.bootclasspath.value, 
settings.extdirs.value,
      settings.Xcodebase.value, classes)
    }

because it is building the classpath from Strings.

> CLONE -Make Scala Scripting JSR 223 compliant
> ---------------------------------------------
>
>                 Key: SLING-1511
>                 URL: https://issues.apache.org/jira/browse/SLING-1511
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Scott Murphy
>            Assignee: Carsten Ziegeler
>            Priority: Minor
>
> As discussed [1] it would be nice if we could decouple the Scala scripting 
> engine from Sling making it into a independent JSR 223 compliant script 
> engine which is 'just' used by Sling.
> [1] http://markmail.org/message/mkvjbuk5dfrekvqv?q=scala+another+sling

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to