You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Scott Murphy (JIRA)" <ji...@apache.org> on 2010/04/29 01:45:54 UTC

[jira] Created: (SLING-1511) CLONE -Make Scala Scripting JSR 223 compliant

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.


[jira] Commented: (SLING-1511) CLONE -Make Scala Scripting JSR 223 compliant

Posted by "Scott Murphy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862003#action_12862003 ] 

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

If I package the script engine like done in the jsr223-engines examples release, I am unable to run jrunscript on the engine.

{code}
/Users/sdmurphy/Desktop/scripts/jsr223-engines/scala-sling/bin
air:bin sdmurphy$ jrunscript -cp ../build/org.apache.sling.scripting.scala.script-0.9.0-SNAPSHOT.jar:../lib/scala-compiler-2.7.7.jar:../lib/scala-library-2.7.7.jar:../lib/slf4j-api-1.5.2.jar:../lib/slf4j-simple-1.5.2.jar -l scala $*

scala> println("hello")
script error: Error executing script
scala> 
{code}

> 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.


[jira] Commented: (SLING-1511) CLONE -Make Scala Scripting JSR 223 compliant

Posted by "Michael Dürig (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862141#action_12862141 ] 

Michael Dürig commented on SLING-1511:
--------------------------------------

The Scala scripting engine [1] *is* independent from Sling already. It just still lives within Sling. Ultimately it should move to a better home though [2].
The support material of my session at Scala Days 2010 [3] contains some demo code which shows how to use the Scala script engine in standalone mode. 
For configuring the script engine (i.e. setting a custom classpath) see org.apache.sling.scripting.scala.config.AbstractSettingsProvider. 

NB: Please use the mailing list for questions [4] next time.

[1] http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/

[2] http://dev.day.com/discussion-groups/content/lists/sling-dev/2009-12/2009-12-01_Scala_scripting_support_was_Re_And_another_one____Michael_D_rig.html

[3] http://people.apache.org/~mduerig/scala4scripting/

[4] http://mail-archives.apache.org/mod_mbox/sling-users/

> 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.


[jira] Commented: (SLING-1511) CLONE -Make Scala Scripting JSR 223 compliant

Posted by "Scott Murphy (JIRA)" <ji...@apache.org>.
    [ 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.