How to call java API from javascript server-side functions?


seeing this post (, I thought it would be easy to create a javascript server-side function calling java API.

My function is as follow:

and the error is as follow:

=> is it truly possible to call java API using javascript server-side functions on odb 3.0.29?

Thanks in advance.

Hi @cmichon

this worked until 3.0.28, which didn’t contain the JS sandbox. Now we implemented the sandbox and by default you cannot access to any java code, only to the injected context which is the database for query.

If you want to use OSecurity manager you should activate it in the configuration file. something like this

                <parameter name="enabled" value="true"/>
                <parameter name="allowedLanguages" value="SQL"/>
                <!--  Comma separated packages  allowed in JS scripts eg. java.math.*, java.util.ArrayList -->
                <parameter name="allowedPackages" value=""/>

Let me know if this helps


Thanks! It worked the sandboxing was the issue to reach the java class.

Please note that digest2String() is not available in that particular version. So I used another function.