I found the following post on a blog and followed it to build the apache
sling scala script engine. (I removed the classes related to OSGI and JCR.)
I'm trying to run the scripting example but can't get past 
<?language scala?> in the bxml file. It indicates following error message.

An error occurred at line number 45 in file
/D:/devEclipse/workspace/Scalaling/bin/main/resources/pivot_scala/scripting.bxml:
org.apache.pivot.serialization.SerializationException: Unable to find
scripting engine for language "scala".

I left a couple of messages on the blog post but have not received an
answer. Any insight would be appreciated.

http://my.opera.com/zilti/blog/index.dml/tag/JSR-233

The sources of that "sub-project" are located at
http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/ and
are easily to fetch and can then be built using Maven.
After doing this, you have a jar-file ready for usage - the only dependency
is the slf4j-api-package which you can get from http://www.slf4j.org, and,
of course, the scala-compiler jar with the scala.tools-packages (Both are
available via Maven as well).
A script must be wrapped inside an object - which can either be a class or
an object.
Either you can just use this plain object as a starting point. Or, and now
it's getting more interesting, you can use the ScriptArgs argument:

import org.apache.sling.scripting.scala._
class Script(arg:ScriptArgs) {}
ScriptArgs contains methods to access the surrounding environment. You can
use the standard java.reflection classes to find out more about the methods,
e.g. to print out all method names:

var methods:Seq[Method] = arg.getClass.getMethods
methods.foreach(p => println(p.getName))


--
View this message in context: 
http://apache-pivot-users.399431.n3.nabble.com/Trying-to-run-a-scala-script-tp2738919p2766927.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Reply via email to