Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

380
Views
Nashhorn engine fails on Java 11 with "unknown call type" error

I have a JS script which is failing when evaluated using Nashorn engine from Java. This code works fine on Java 8 but fails on Java 11. I am getting an error:

unknown call type GET:PROPERTY|ELEMENT|METHOD:NODE_PATH(Object)int@jdk.nashorn.internal.scripts.Script$Recompilation$20$11678$\^eval\_
   java.lang.AssertionError: unknown call type GET:PROPERTY|ELEMENT|METHOD:NODE_PATH(Object)int@jdk.nashorn.internal.scripts.Script$Recompilation$20$11678$\^eval\_
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker.NashornBottomLinker.linkBean(NashornBottomLinker.java:126)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker.NashornBottomLinker.getGuardedInvocation(NashornBottomLinker.java:78)
     at jdk.dynalink/jdk.dynalink.linker.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:109)

The code is:

function __toCall() {
return require('nashorn-invoker')(
    function (require) {
        var Text = function Text() {
            StringLeaf.call(this);
        };
        extend(Text, StringLeaf);
        Text.prototype.ontologyType = function () {
            return 'cmd.ontology.types.Text';
        };

        var BasicTest = function BasicTest() {
            var _field = new Text();
            _field._fieldName = 'field';
            _field._name = 'Field';
            _field._defaultValue = '';

            var curNode = this;
            Structure.call(this, {
                field: _field
            });
        };
        extend(BasicTest, Structure);
        BasicTest.prototype.ontologyType = function () {
            return 'cmd.ontology.test.BasicTest';
        };
        BasicTest.prototype._name = 'Basic Test';
        return (function () {
            var model = [];
            var callbackFn = function (result) {
                if (result !== true) model.push.apply(model, result);
            };
            test.child('field').validate(vc, callbackFn);
            var result = model.length === 0 ? true : model;
            print('Callback function result: ' + JSON.stringify(result));
            return result;
        })();
    }
);

}

File nashorn-invoker.js

 module.exports = function nashornInvoker(callback) {
      return callback(require); // runs the given callback and provide our "require" context
   };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Similar problem was answered here.

JS script doesn't run with Java 11 but works with Java 8

This sounds like it could be the JDK-8261926 bug. The good news is that this is fixed, but only in the standalone Nashorn, not the one integrated into Java 11. There's also a page describing how you can ensure that standalone Nashorn is used by your program instead of the integrated one on Java 11.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!