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

[Native Image] com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing com.ibm.mq.MQMessage #9830

Open
1 task done
shahbaz-dgtera opened this issue Oct 7, 2024 · 8 comments
Assignees

Comments

@shahbaz-dgtera
Copy link

Describe the Issue

Running command ./mvnw package -Dnative

[14:06:06,182 WARN [io.net.res.dns.DnsServerAddressStreamProviders] Can not find io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider in the classpath, fallback to system defaults. This may result in incorrect DNS resolutions on MacOS. Check whether you have a dependency on 'io.netty:netty-resolver-dns-native-macos'

Failed generating 'quarkus-app-1.0.0-SNAPSHOT-runner' after 27.5s.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35.371 s
[INFO] Finished at: 2024-10-07T14:06:10+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.14.3:build (default) on project quarkus-app: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:489)
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:278)
[ERROR] at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
[ERROR] at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
[ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:1575)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:483)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

sali@MacBook-Air quarkus-dumplog-api % java -version
java version "23" 2024-09-17
Java(TM) SE Runtime Environment Oracle GraalVM 23+37.1 (build 23+37-jvmci-b01)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 23+37.1 (build 23+37-jvmci-b01, mixed mode, sharing)

Operating System and Version

MacOS

Build Command

./mvnw package -Dnative

Expected Behavior

Build success

Actual Behavior

Build fail

Steps to Reproduce

I am using simple quarkus app where i add ibm mq jars

my pomfile

4.0.0
<groupId>org.acme</groupId>
<artifactId>quarkus-app</artifactId>
<version>1.0.0-SNAPSHOT</version>

<properties>
    <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
    <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
    <quarkus.platform.version>3.14.3</quarkus.platform.version>
    <compiler-plugin.version>3.11.0</compiler-plugin.version>
    <surefire-plugin.version>3.1.2</surefire-plugin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
    <maven.compiler.parameters>true</maven.compiler.parameters>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>${quarkus.platform.group-id}</groupId>
            <artifactId>${quarkus.platform.artifact-id}</artifactId>
            <version>${quarkus.platform.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>io.quarkiverse.helm</groupId>
        <artifactId>quarkus-helm</artifactId>
        <version>1.2.3</version>
    </dependency>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-junit5</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>rest-assured</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>ibm-mq-jar</artifactId>
        <version>1.0.0</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/libs/com.ibm.mq.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>com.ibm.mq.jmqi</groupId>
        <artifactId>ibm-mq-jmqi-jar</artifactId>
        <version>1.0.0</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/libs/com.ibm.mq.jmqi.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>connector</groupId>
        <artifactId>connector-jar</artifactId>
        <version>1.0.0</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/libs/connector.jar</systemPath>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${compiler-plugin.version}</version>
        </plugin>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${surefire-plugin.version}</version>
            <configuration>
                <systemPropertyVariables>
                    <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                    <maven.home>${maven.home}</maven.home>
                </systemPropertyVariables>
            </configuration>
        </plugin>
        <plugin>
            <groupId>${quarkus.platform.group-id}</groupId>
            <artifactId>quarkus-maven-plugin</artifactId>
            <version>${quarkus.platform.version}</version>
            <executions>
                <execution>
                    <goals>
                        <goal>build</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>


<profiles>
    <profile>
        <id>native</id>
        <activation>
            <property>
                <name>native</name>
            </property>
        </activation>
        <properties>
            <quarkus.native.enabled>true</quarkus.native.enabled>
            <quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${surefire-plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                            <configuration>
                                <systemPropertyVariables>
                                    <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                                    <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                                    <maven.home>${maven.home}</maven.home>
                                </systemPropertyVariables>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

Additional Context

No response

Build Log Output and Error Messages

No response

@selhagani
Copy link
Member

Hi @shahbaz-dgtera,

Thank you for reaching out to us! Could you please share a reproducer with me?

@shahbaz-dgtera
Copy link
Author

Can you use attached jars and my pom file just create a simple quarkus app and test to build it native way
libs.zip

Right now I am using old school jar execution which is working fine for me
./mvnw package -Dquarkus.package.jar.type=legacy-jar

but if i use

./mvnw package -Dnative

it ddn't work

@selhagani
Copy link
Member

Due to internal policies I'm afraid I can't use the zip file you attached. Could you please create a reproducer and share it with us using a github repo please?

@shahbaz-dgtera
Copy link
Author

Here please find code clone it and try to build natively
https://github.com/shahbaz-dgtera/public.git

@shahbaz-dgtera
Copy link
Author

Is there any update on it ?

@selhagani
Copy link
Member

I have tested the provided reproducer and can confirm the issue you encountered. During my investigation, I removed the dependencies related to IBM MQ, which allowed for successful native image generation. This leads me to believe that the IBM MQ libraries may utilize reflection, which can hinder the native image generation process.

To address this issue, I recommend testing with the tracing agent. This tool will help generate the necessary configuration files to accommodate reflection usage in your application. You can find more detailed information about the tracing agent and its usage in the following documentation: GraalVM Tracing Agent Documentation.

@shahbaz-dgtera
Copy link
Author

Sorry I don't get you I need those libraries if I remove that dependencies then I know it will work, right now legacy-jar is working fine for me so is it possible to make native build with IBM MQ dependencies.

Or if it can work with reflection so please tell me the way for it ?

@selhagani
Copy link
Member

It is possible that your application includes components that rely on reflection, which can interfere with the successful generation of a native image. To address this, I recommend using the GraalVM Tracing Agent. This tool generates the necessary configuration files to resolve such issues. Based on your current challenge, I suspect that reflection might be the underlying cause. That’s why I suggested using the tracing agent earlier. For more details, please refer to the link provided in my previous comment.

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

No branches or pull requests

2 participants