Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fail when using Java 17 #90

Closed
Riduidel opened this issue Mar 3, 2022 · 7 comments
Closed

Build fail when using Java 17 #90

Riduidel opened this issue Mar 3, 2022 · 7 comments
Assignees

Comments

@Riduidel
Copy link
Owner

Riduidel commented Mar 3, 2022

When trying to build on Java 17, we all get those exceptions Could not initialize class cucumber.deps.com.thoughtworks.xstream.converters.collections.TreeMapConverter

@Riduidel
Copy link
Owner Author

Riduidel commented Mar 3, 2022

Seems interesting, no? cucumber-attic/cucumber-jvm-deps#6

Riduidel added a commit that referenced this issue Mar 3, 2022
…the problem behind #90).

We have one issue remaining with markdown_to_asciidoc (Parboiled version used by Pegdown doesn't seems to support Java modules 😨)
Riduidel added a commit that referenced this issue Mar 3, 2022
…the problem behind #90). (#91)

We have one issue remaining with markdown_to_asciidoc (Parboiled version used by Pegdown doesn't seems to support Java modules 😨)
@sebvelay
Copy link

on my side the error on java 17 was :
java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @6ee417d8

@Riduidel
Copy link
Owner Author

Yeah, if you want to spend some time making things work on new Java version, I would be very happy. But for me, all that module fuckery is really awful

@BeatrizLo
Copy link

Hello! I'm using version 17 of java to run my tests, and the error I'm getting is this:

java.lang.ExceptionInInitializerError
at cucumber.deps.com.thoughtworks.xstream.XStream.setupConverters(XStream.java:820)

Is this going to be fixed at some point? Because the tests only work for me when I use java 1.8, and I need to use my own library that uses java 17, can someone help me?
I have also tried adding this in the pom:

<dependency>
                 <groupId>io.cucumber</groupId>
                 <artifactId>cucumber-jvm</artifactId>
                 <version>7.3.4</version>
                 <type>pom</type>
             <exclusions>
                 <exclusion>
                     <groupId>io.cucumber</groupId>
                     <artifactId>cucumber-jvm-deps</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>

But it still doesn't work, can someone help me?

@Riduidel
Copy link
Owner Author

Riduidel commented Jun 9, 2022

Hello @BeatrizLo I'm happy you're trying to use our project!
The problem you've seen seems to come from cucumber (quite sure this is a repackaging of xstream through some kind of shading - like what the maven-shade-plugin does).

Can you confirm it is the same stack trace than in this stackoverflow question ?

Unfortunatly, I can find no public support forum for cucumber, so I can't investigate any further.
Anyway, yes, we have some troubles regarding java 17, but unfortunatly for you this one directly come from Cucumber.

@Riduidel Riduidel self-assigned this Jun 20, 2022
@jhedin-csam
Copy link

jhedin-csam commented Oct 26, 2022

Found this while searching for the same error in our products. Thought I should share the solution I found at
https://stackoverflow.com/questions/69753263/unable-to-make-field-final-transient-java-lang-class-java-util-enumset-elementty

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <buildDirectory>${project.build.directory}</buildDirectory>
                    </systemPropertyVariables>
                    <testFailureIgnore>true</testFailureIgnore>
                    <argLine>
                        --add-opens java.base/java.lang=ALL-UNNAMED
                        --add-opens java.base/java.util=ALL-UNNAMED
                        --add-opens java.base/java.lang.reflect=ALL-UNNAMED
                        --add-opens java.base/java.text=ALL-UNNAMED
                        --add-opens java.desktop/java.awt.font=ALL-UNNAMED
                    </argLine>
                </configuration>
            </plugin>

@Amity007
Copy link

Facing similar kind of issue, but adding the plugin in pom doesn't help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants