Anton Arhipov | 30 Jul 23:28

[groovy-dev] get scripting engine by file extension

Hello!

I have an application where I use JSR-223 for evaluating the scripts, and I use file extension for identifying the scripting engine that is required to evaluate the script:

ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
ScriptEngine engine = scriptEngineManager.getEngineByExtension("groovy");

With groovy-1.0 it works fine.
but with groovy-1.1-beta2 this code throws a following exception:

Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface groovy.lang.MetaClass, but class was expected
    at com.sun.script.groovy.GroovyScriptEngine.<clinit>(GroovyScriptEngine.java:63)
    at com.sun.script.groovy.GroovyScriptEngineFactory.getScriptEngine (GroovyScriptEngineFactory.java:87)
    at javax.script.ScriptEngineManager.getEngineByExtension(ScriptEngineManager.java:275)
    at <user code stack trace follows>


And in the version 1.0 there really was "public abstract class MetaClass" which is now "public interface MetaClass extends MetaObjectProtocol"

So the question is:  is the groovy API not following JSR or the JSR engine implementations is outdated ? :)
Can anyone suggest?

Thx,
--
Anton Arhipov

Guillaume Laforge | 1 Aug 08:05

Re: [groovy-dev] get scripting engine by file extension

Sorry to answer late on this.
Sun's current JSR-223 Groovy scripting engine only works with Groovy 1.0.
Another Groovy user is investigating upgrading the scripting engine to
make it work with Groovy 1.1-beta-2, so that we don't get those nasty
errors.
We'll then submit those changes back to the scripting.dev.java.net project.

On 7/30/07, Anton Arhipov <ant.arhipov@...> wrote:
> Hello!
>
> I have an application where I use JSR-223 for evaluating the scripts, and I
> use file extension for identifying the scripting engine that is required to
> evaluate the script:
>
> ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
> ScriptEngine engine =
> scriptEngineManager.getEngineByExtension("groovy");
>
> With groovy-1.0 it works fine.
> but with groovy-1.1-beta2 this code throws a following exception:
>
> Exception in thread "main"
> java.lang.IncompatibleClassChangeError: Found interface
> groovy.lang.MetaClass, but class was expected
>     at
> com.sun.script.groovy.GroovyScriptEngine.<clinit>(GroovyScriptEngine.java:63)
>     at
> com.sun.script.groovy.GroovyScriptEngineFactory.getScriptEngine
> (GroovyScriptEngineFactory.java:87)
>     at
> javax.script.ScriptEngineManager.getEngineByExtension(ScriptEngineManager.java:275)
>     at <user code stack trace follows>
>
>
> And in the version 1.0 there really was "public abstract class MetaClass"
> which is now "public interface MetaClass extends MetaObjectProtocol"
>
> So the question is:  is the groovy API not following JSR or the JSR engine
> implementations is outdated ? :)
> Can anyone suggest?
>
> Thx,
> --
> Anton Arhipov

--

-- 
Guillaume Laforge
Groovy Project Manager
http://glaforge.free.fr/blog/groovy

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Gmane