0

I try to describe my problem. Following configuration:

  1. On Servicemix I have two bundles: one with model, second with service. Model bundle exports model packages, service bundle imports model packages from model bundle.
  2. In the service bundle I have Web Service (CXF) with one service method: execute. This method uses two parameters: the first (String) is the name of javascript file and the second is the map (HashMap) of arguments. The service executes javascript script using javax.scipt.CompiledScript.eval(Bindings bindings). The idea is to have business logic in scripting language.
  3. The javascript script has access to Java objects via:

a/ bindings - without problems. I see in the script all objects' instances which I added using bindings.put(name, object)

b/ importPackage(Packages.my.java.package.from.model.bundle) - now I have the problem: when I try to create in javascript Java object from model bundle with keyword "new" I get following error:

class com.google.code.scriptengines.js.util.ExtendedScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "Product" is not defined. (#4) at [4] in file

where Product is my Java class from model bundle and in line 4 i try to create this object with:

var product = new Product();

And, I think, very important information: everything was fine in Servicemix 4.2.0. Now I have to upgrade to 4.3.1 and doesn't work (both version from Fusesource)

Any help?

Regards, Jacek

рüффп
  • 5,172
  • 34
  • 67
  • 113
user1337302
  • 113
  • 8

1 Answers1

0

Seems like the script engine bundle does not have package visibility to your Product package.

You can try enable dynamic imports on the bundle with the script engine

list | grep -i javascript

And then find the bundle id for the bundle with the engine, eg for example

And then use

dev:dynamic-import  ID of that bundle

And you may need to restart the ESB if the change is not picked up.

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65
  • Its a problem with the javascript bundle. A ticket has been created to fix this in the future: https://issues.apache.org/jira/browse/SM-2200 – Claus Ibsen May 13 '13 at 05:32