Skip to content

[GR-64746] [Native Image] Dependencies from GraalVM collide with svm-wasm-guava.jar when building to wasm #11112

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

Open
2 tasks done
treblereel opened this issue May 1, 2025 · 9 comments
Assignees
Labels
bug native-image wasm-backend Issues related to the Wasm backend of GraalVM.

Comments

@treblereel
Copy link

Describe the Issue

SDK: 25.ea.20-graal
OS X: macOS

In my Maven project I have a dependency on org.kie:kie-ci:jar:10.0.0:compile, which in turn transitively depends on com.google.guava:guava:jar:32.0.1-jre:compile.

During the build I see many warnings like:

Warning: Class-path entry file:///Users/treblereel/.m2/repository/com/google/guava/guava/32.0.1-jre/guava-32.0.1-jre.jar contains class com.google.common.base.Joiner. This class is part of the image builder itself (in file:///Users/treblereel/.sdkman/candidates/java/25.ea.20-graal/lib/svm/tools/svm-wasm/builder/svm-wasm-guava.jar) and must not be passed via -cp.
Warning: Class-path entry file:///Users/treblereel/.m2/repository/com/google/guava/guava/32.0.1-jre/guava-32.0.1-jre.jar contains class com.google.common.base.Joiner$MapJoiner. This class is part of the image builder itself (in file:///Users/treblereel/.sdkman/candidates/java/25.ea.20-graal/lib/svm/tools/svm-wasm/builder/svm-wasm-guava.jar) and must not be passed via -cp

However, at runtime I get:

Exception in thread "main" java.lang.NoClassDefFoundError: com.google.common.collect.ImmutableSet

Could it be that the Guava from my transitive dependency and the Guava bundled in svm-wasm-guava.jar are incompatible?

I tried excluding Guava in my native-maven-plugin configuration:

<plugin>
  <groupId>org.graalvm.buildtools</groupId>
  <artifactId>native-maven-plugin</artifactId>
  <configuration>
    <mainClass>org.treblereel.graalvm.wasm.App</mainClass>
    <imageName>../web/app</imageName>
    <exclusions>
      <exclusion>
        <groupId>org.google.guava</groupId>
        <artifactId>guava</artifactId>
      </exclusion>
    </exclusions>
  </configuration>
</plugin>

—but it didn’t help.

Thank you for your assistance.

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

java version "25" 2025-09-16 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 25-dev+20.1 (build 25+20-LTS-jvmci-b01)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 25-dev+20.1 (build 25+20-LTS-jvmci-b01, mixed mode, sharing)

Operating System and Version

osx 15.3.1 (24D70)

Troubleshooting Confirmation

Run Command

I use maven:

                <plugin>
                    <groupId>org.graalvm.buildtools</groupId>
                    <artifactId>native-maven-plugin</artifactId>
                    <version>0.10.6</version>
                    <extensions>true</extensions>
                    <executions>
                        <execution>
                            <id>build-native</id>
                            <goals>
                                <goal>compile-no-fork</goal>
                            </goals>
                            <phase>package</phase>
                        </execution>
                    </executions>
                    <configuration>
                        <buildArgs>
                            <buildArg>--tool:svm-wasm</buildArg>
                            <buildArg>-g</buildArg>
                        </buildArgs>
                            <mainClass>org.treblereel.graalvm.wasm.App</mainClass>
                            <imageName>../web/app</imageName>
                    </configuration>
                </plugin>


Expected Behavior

no exception during the run

Actual Behavior

Exception in thread "main" java.lang.NoClassDefFoundError: com.google.common.collect.ImmutableSet

Steps to Reproduce

  1. create maven project
  2. add dependency with transitive guava dependency
  3. setup a wasm build of native image
  4. compile and run

Additional Context

No response

Run-Time Log Output and Error Messages

No response

@treblereel
Copy link
Author

build.log.zip

@treblereel
Copy link
Author

export_wasm.zip

reproducer

@treblereel
Copy link
Author

@fniephaus may I ask you to take a look please?
Thank you

@fniephaus
Copy link
Member

Sure, @treblereel. It seems we've added Guava as a dependency recently (see here), but forgot to shade it.

@patrick96 Could you please make sure that all dependencies of the web-image suite are properly shaded? Thanks!

@treblereel
Copy link
Author

Thank you @fniephaus for such a quick response!

I still haven’t been able to get JS.Export to work (I tried the example from JSObject), but that’s beyond the scope of this issue.

@fniephaus
Copy link
Member

Please file another ticket for JS.Export. Not sure what you try to do, so please elaborate and provide a code snippet. Maybe @patrick96 can help you with this, too.

@fniephaus fniephaus added the wasm-backend Issues related to the Wasm backend of GraalVM. label May 2, 2025
@patrick96
Copy link
Member

We're tracking this internally as GR-64746

@treblereel
Copy link
Author

@patrick96 thank you for work you do, do you have any time estimates regarding this bug? Thanks.

@patrick96
Copy link
Member

The goal is to get the fix for this merged before June

@axel22 axel22 changed the title [Native Image] Dependencies from GraalVM collide with svm-wasm-guava.jar when building to wasm [GR-64746] [Native Image] Dependencies from GraalVM collide with svm-wasm-guava.jar when building to wasm May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug native-image wasm-backend Issues related to the Wasm backend of GraalVM.
Projects
None yet
Development

No branches or pull requests

3 participants