oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.3k stars 1.63k forks source link

native-image compilation of java netty programs for exe execution appears NioSocketChannal requires a parameterless construction #7719

Closed Arbor4 closed 8 months ago

Arbor4 commented 11 months ago
    public synchronized void start(EventLoopGroup workerGroup,
                                   ChannelInitializer channelInitializer, String host, int port) {
        try {
            Bootstrap bootstrap = new Bootstrap();
            bootstrap.group(workerGroup)
                    .channel(NioSocketChannel.class)
                    .option(ChannelOption.SO_KEEPALIVE, true)
                    .handler(channelInitializer);
            Channel channel = bootstrap.connect(host, port).sync().channel();
            channel.closeFuture().addListener((ChannelFutureListener) future -> {
                channel.deregister();
                channel.close();
            });

        } catch (Exception e) {

            workerGroup.shutdownGracefully();
            System.out.println(this.getClass() + "bootStart()中出现错误");
            e.printStackTrace();
        }
    }
Arbor4 commented 11 months ago
<dependencies>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.24</version>
            </dependency>
            <dependency>
                <groupId>org.example</groupId>
                <artifactId>JavaFrp-Model</artifactId>
                <version>1.0-SNAPSHOT</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-all</artifactId>
                <version>4.1.100.Final</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.yaml/snakeyaml -->
            <dependency>
                <groupId>org.yaml</groupId>
                <artifactId>snakeyaml</artifactId>
                <version>2.0</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2 -->
            <dependency>
                <groupId>com.alibaba.fastjson2</groupId>
                <artifactId>fastjson2</artifactId>
                <version>2.0.40</version>
            </dependency>

        </dependencies>

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <java.version>17</java.version>
    </properties>
medoussboug commented 11 months ago

Hello,I cannot see the issue you are facing. Please follow the templates in here for us to be able to process your issue.

Arbor4 commented 11 months ago

您好,我看不到您面临的问题。请按照此处的模板进行操作,以便我们能够处理您的问题。

image

Arbor4 commented 11 months ago

您好,我看不到您面临的问题。请按照此处的模板进行操作,以便我们能够处理您的问题。

The java program can run during debugging, but the above error occurs after packaging it into an exe executable program through native-image. I am using java17. I think there is a problem with the conversion result. There is no error during the conversion process.

medoussboug commented 11 months ago

Can you please try following this guide https://www.graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/.


From: Arbor @.> Sent: Thursday, November 2, 2023 5:37:45 PM To: oracle/graal @.> Cc: Mohamed Oussama Bougueddach @.>; Comment @.> Subject: [External] : Re: [oracle/graal] native-image compilation of java netty programs for exe execution appears NioSocketChannal requires a parameterless construction (Issue #7719)

您好,我看不到您面临的问题。请按照此处https://urldefense.com/v3/__https://github.com/oracle/graal/issues/new/choose__;!!ACWV5N9M2RV99hQ!PtqyLGTkJA-Q99eyxSdObRj3RsQoPmgd6EX5ko_mJcQN31d01El8DjTAT_AHozcaHKmQV27-C_7Gi4ynHNMqqK5cb4j9cAj-2LPcvxM$的模板进行操作,以便我们能够处理您的问题。

The java program can run during debugging, but the above error occurs after packaging it into an exe executable program through native-image. I am using java17. I think there is a problem with the conversion result. There is no error during the conversion process.

― Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/oracle/graal/issues/7719*issuecomment-1791086123__;Iw!!ACWV5N9M2RV99hQ!PtqyLGTkJA-Q99eyxSdObRj3RsQoPmgd6EX5ko_mJcQN31d01El8DjTAT_AHozcaHKmQV27-C_7Gi4ynHNMqqK5cb4j9cAj-GrdY3Gs$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AUMHB34YZ3JSW5XJLCBBM7LYCPD5TAVCNFSM6AAAAAA62U2DQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJRGA4DMMJSGM__;!!ACWV5N9M2RV99hQ!PtqyLGTkJA-Q99eyxSdObRj3RsQoPmgd6EX5ko_mJcQN31d01El8DjTAT_AHozcaHKmQV27-C_7Gi4ynHNMqqK5cb4j9cAj-CmyHvv4$. You are receiving this because you commented.Message ID: @.***>