groovy script engine not recognized

Description

The groovy scripting engine is not recognized by rules using scripts (like callouts).
The problem should come from the fact that as of 4.1 groovy is a plugin and not a .jar inside "org.adempiere.base" plugin.

Environment

None

Attachments

5

Activity

Show:

Luis Amesty January 27, 2019 at 10:06 AM

Hola Carlos
El Script Engine lo utilizo para hacer las formulas de una aplicación de nómina de personal.
Lo que tengo son variables contenidas en una expresión Javascript, que finalmente se evalúa y retorna un resultado.
Te anexo las pruebas de formulas simples que hice para poder migrar a la versión 5.1.
Archivos Anexos
TestScriptEngine1.java:
Están identificadas las cuatro pruebas.
TEST No1. Prueba Simple del ScriptEngine
TEST No2. Cambio Utilizando clase javascript.java
TEST No3. Cambio realizado utilizando la librería Mozilla
TEST No4 Prueba tal cual la utilizaba en la versión 2.1 y Retorma Error
Javascript.java:
Clase utilizada para la Prueba 2
Librería Mozilla utilizada:
Js.jar
Js-14.jar

Finalmente modifique el código de mi aplicación porque no estoy utilizando ScriptEngine de Idempiere.

Si necesitas algo mas
Hazme saber.

Saludos

Luis Amesty Linares
Mobile: +34 667 282 457
E-mail: luisamesty@gmail.com <>
luisamesty@hotmail.com

Luis Amesty January 27, 2019 at 10:06 AM

Hola Carlos
El Script Engine lo utilizo para hacer las formulas de una aplicación de nómina de personal.
Lo que tengo son variables contenidas en una expresión Javascript, que finalmente se evalúa y retorna un resultado.
Te anexo las pruebas de formulas simples que hice para poder migrar a la versión 5.1.
Archivos Anexos
TestScriptEngine1.java:
Están identificadas las cuatro pruebas.
TEST No1. Prueba Simple del ScriptEngine
TEST No2. Cambio Utilizando clase javascript.java
TEST No3. Cambio realizado utilizando la librería Mozilla
TEST No4 Prueba tal cual la utilizaba en la versión 2.1 y Retorma Error
Javascript.java:
Clase utilizada para la Prueba 2
Librería Mozilla utilizada:
Js.jar
Js-14.jar

Finalmente modifique el código de mi aplicación porque no estoy utilizando ScriptEngine de Idempiere.

Si necesitas algo mas
Hazme saber.

Saludos

Luis Amesty Linares
Mobile: +34 667 282 457
E-mail: luisamesty@gmail.com

Carlos Ruiz January 26, 2019 at 4:45 PM

, can you please check with latest commit 71f0a06

Also, can you please share a script to test with javascript, I see that nashorn is supported by JVM, but we're forbidding javascript/nashorn on MRule.beforeSave - if that's supported maybe we can open the validation on MRule to allow it.

Regards,

Carlos Ruiz

Luis Amesty March 23, 2018 at 1:53 PM

I have a Plugin using javascript engine.
When :
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine interprete = manager.getEngineByName("javascript");
interprete.put("CN", CND);
i've got a "java.lang.NullPointerException"
It worked fine before Patch.
How do you think i have to carry out this on my plugin ?
Regards Luis Amesty

Carlos Ruiz April 21, 2017 at 8:29 PM

For documentation purposes, tried to make jython work in different ways - integrated the latest stable 2.7.0 version, registered jython as plugin.

In the end it kept failing silently - tracing internally the error shown is:
ImportError: No module named site
which google shows some ways to overcome it uploading a Lib from the standalone.jar of jython with python code and making it accessible.
That sounds like work better for a plugin than to extend more base to attend such need, and I think nobody must be using jython in core because is basically unusable.

So, +1 to drop it from core and make it work as plugin if somebody dares

Regards,

Carlos Ruiz

Fixed

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Created November 18, 2016 at 11:04 AM
Updated March 1, 2019 at 11:44 AM
Resolved January 26, 2019 at 4:45 PM