Not able to call Java class via Karate."org.graalvm.polyglot.PolyglotExcepti1on: TypeError: Access to host class is not allowed or does not exist."

1.1k views Asked by At

I am trying to call a Java class which has two methods in it. But the execution fails in the below line.

 `* def javademo = Java.type('feature.AuthCode')

Error:

* def javademo = Java.type('feature.AuthCode')
js failed:
>>>>
01: Java.type('feature.AuthCode')
<<<<
org.graalvm.polyglot.PolyglotException: TypeError: Access to host class feature.AuthCode is not allowed       or does not exist.
- <js>.:program(Unnamed:1)`

Please help with the query. Some blogs show to change the Karate Jar Command line argument to target/test-classes. But it doesn't work in my case. Is it something related to Java version? I am using Java 17

0

There are 0 answers