quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.35k stars 2.56k forks source link

Class Not Found org/graalvm/polyglot/Value 1.4.1 #41306

Open abdallah-rashwan opened 1 week ago

abdallah-rashwan commented 1 week ago

Describe the bug

Using Karate for int testing, getting the below error when trying to run tests using `

com.intuit.karate
        <artifactId>karate-junit5</artifactId>
        <scope>test</scope>
    </dependency>`. The `Value` class is missing.

java.lang.NoClassDefFoundError: org/graalvm/polyglot/Value at com.intuit.karate.core.Variable.<init>(Variable.java:72) at com.intuit.karate.core.Variable.<clinit>(Variable.java:66) at com.intuit.karate.core.Config.<init>(Config.java:94) at com.intuit.karate.core.ScenarioCall.getParentConfig(ScenarioCall.java:67) at com.intuit.karate.core.ScenarioRuntime.<init>(ScenarioRuntime.java:74) at com.intuit.karate.core.ScenarioIterator.tryAdvance(ScenarioIterator.java:162) at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:292) at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206) at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161) at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:298) at java.base/java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681) at com.intuit.karate.junit5.FeatureNode.hasNext(FeatureNode.java:63) at com.intuit.karate.junit5.Karate.iterator(Karate.java:65) at java.base/java.lang.Iterable.spliterator(Iterable.java:101) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

I managed to overcome this by adding graal-sdk 22.3.3 manually to be compatible with Truffle.

found this `

org.graalvm.sdk
    <artifactId>graal-sdk</artifactId>
    <version>23.1.2</version>
    <exclusions>
      <exclusion>
        <groupId>org.graalvm.polyglot</groupId>
        <artifactId>polyglot</artifactId>
      </exclusion>
    </exclusions>
  </dependency>` in "quarkus-bom-3.10.2.pom", might be useful.

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

  1. Quarkus version 3.10.2
  2. com.intuit.karate karate-junit5-1.4.1

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

jamailun commented 1 week ago

Same issue here, with Quarkus 3.11.2.

gsmet commented 1 week ago

A small Maven reproducer might help.

jamailun commented 1 week ago

How to reproduce

Ok, so that's what I found.I don't expect any real answer : I'm just writting my search :) Here's the project holding a small demo: https://github.com/jamailun/karate-quarkus. It will work on Quarkus 3.8.2 : the demo feature will run properly.

Step 1: upgrade Quarkus to 3.8.3+

From the version 3.8.3 (and commit #39442) sdk-graal has been excluded. So when launching the test, we obtain a : java.lang.NoClassDefFoundError: org/graalvm/polyglot/Value

Step 2 : Add sdk-graal (you can skip this one)

By adding the graal-sdk (and decommenting the block on line 69 of my demo), you'll have a new exception: ServiceConfiguration org.graalvm.polyglot.impl.AbstractPolyglotImpl: com.oracle.truffle.polyglot.PolyglotImpl not a subtype. Same for previous versions.

Step 3 : Add a only the most recent Graal's polyglot dependency

I discovered that from 23.1.0 onward, developpers should import Graal SDK differently. By recommenting the previous block and importing only the org.graalvm.polyglot.polyglot:24.0.1 (decomment block line 77 on my pom.xml) now everything will compile... but the tests won't be found. Even with debug mode, Karate just doesn't find the .feature anymore. FooUnitTests.testAllUnitTests no features or scenarios found: [classpath:org/jamailun]

Need help

And now I don't really know where to look. We'd like to keep our karate tests (we do have a lot of them) so any help would be gladly received.