Created Exe of Spring boot application Using GraalVM, It will immediately terminate after start
Build is successful enter image description here
Stop exe immediately automatically after I tried to start enter image description here
I am using below pom.xml file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.0</version>
</parent>
<groupId>com.kpit.diagnostics.tf2</groupId>
<artifactId>tf2-product-launcher-application</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>tf2-product-launcher-application</name>
<packaging>jar</packaging>
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<!-- This copies the JRE used to do the build from java.home - should be 32 bit Windows JRE -->
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/win32/java</outputDirectory>
<resources>
<resource>
<directory>${java.home}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<executions>
<execution>
<id>build-native</id>
<goals>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<mainClass>com.kpit.tf2.configuration.Application</mainClass>
<buildArgs>
<buildArg>-H:EnableURLProtocols=http</buildArg>
<buildArg>-J-Xdebug</buildArg>
<buildArg>-J-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005</buildArg>
<buildArg>-H:-CheckToolchain</buildArg>
<buildArg>-H:+ReportExceptionStackTraces</buildArg>
<buildArg>--initialize-at-build-time=ch.qos.logback</buildArg>
<buildArg>-H:ReflectionConfigurationFiles=src/main/resources/reflection-config.json</buildArg>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Using configuration class which will create bean
package com.kpit.tf2.configuration;
import com.kpit.tf2.application.lifecycle.implementation.backend.ServiceTesterLifeCycleManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
public class WrapperConfiguration {
@Bean
Application getApplicationBean() {
return new Application();
}
@Bean
ServiceTesterLifeCycleManager getServiceTesterLifeCycleManager() {
return new ServiceTesterLifeCycleManager();
}
}
logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
</appender>
<property name="LOG_HOME" value="logs" />
<property name="MIN_INDEX" value="1" />
<property name="MAX_ZIP_FILES" value="10" />
<root level="WARN">
<appender-ref ref="FILE" level="ERROR" />
<appender-ref ref="STDOUT" level="ERROR" />
</root>
<logger name="com.kpit" level="DEBUG" additivity="true">
<appender-ref ref="STDOUT" level="WARNING" />
</logger>
<logger name="com.kpit" level="TRACE" additivity="false">
<appender-ref ref="STDOUT" level="WARNING" />
</logger>
</configuration>
reflection-config.json
[
{
"name": "ch.qos.logback.core.ConsoleAppender",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true,
"allDeclaredClasses": true,
"allPublicClasses": true
},
{
"name": "ch.qos.logback.classic.PatternLayout",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true,
"allDeclaredClasses": true,
"allPublicClasses": true
}
]
All above mentioned files present in the src/main/resources folder
Expectation 1.The generated exe should be keep on running state using application.properties file 1.It should use the application.properties file which contains server.port = 9090
Note - Not getting any error but it will auto terminate if I run exe which is not expected
Can someone please help me here to find the issue.