question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nashorn cast error when running in jdk11

See original GitHub issue

Cast error using karate.merge when running in jdk11 It run fine on jdk8

  Scenario: tests karate.merge on jdk11
  * def req = {}
  * def authHeader = { 'Basic': 'xxx' }
  * def headers = karate.merge(req.headers, authHeader)
[ERROR] Failures:
[ERROR]   UsersRunner.testUsers users.feature:10 - javascript evaluation failed: karate.merge(req.headers, authHeader), Cannot cast jdk.nashorn.internal.runtime.Undefined to java.util.Map

Sample project included karate-issue.zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ptrthomascommented, Jun 9, 2020

@ivangsa it is up to you how you want to proceed. feel free to contribute a PR and fix this. Nashorn has slight differences across OS and JDK versions, you ran into one of them. we plan to move to Graal - so I’m not investing time in this. closing as wontfix

0reactions
ptrthomascommented, Dec 5, 2020

@ivangsa and please do test on 1.0 to avoid surprises: https://github.com/intuit/karate/wiki/1.0-upgrade-guide

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nashorn cast error when running in jdk11 · Issue #1163 - GitHub
Cast error using karate.merge when running in jdk11 It run fine on jdk8 Scenario: ... authHeader), Cannot cast jdk.nashorn.internal.runtime.
Read more >
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...
Read more >
ClassCastException: cannot cast jdk.nashorn.internal.scripts.JO
ACTUAL - ClassCastException ERROR MESSAGES/STACK TRACES THAT OCCUR : Exception in thread "main" java.lang.ClassCastException: Cannot cast jdk.nashorn.internal.
Read more >
Under certain conditions, GraalJS is slower than Nashorn : r/java
I discovered that Running GraalJS on stock JDK11 project a few days ago while investigating GraalJS for a Windows-hosted project I was working ......
Read more >
jdk.scripting.nashorn (Java SE 11 & JDK 11 )
Provides the implementation of Nashorn script engine and the runtime environment for programs written in ECMAScript 5.1. Nashorn is a runtime environment ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found