Hậu Chử :
I run application by: java -jar app.jar
. Its working good!
But setup run like service by https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html.
When sudo service ccth start
, then following error occurs:
/etc/init.d/ccth: line 1: $'PK\003\004': command not found
/etc/init.d/ccth: line 2:Dr�Lorg/PK: No such file or directory
/etc/init.d/ccth: line 3:Dr�Lorg/springframework/PK: No such file or directory
/etc/init.d/ccth: line 4:Dr�Lorg/springframework/boot/PK: No such file or directory
/etc/init.d/ccth: line 5: $'\bDr\376L': command not found
/etc/init.d/ccth: line 6:Dr�L%org/springframework/boot/loader/data/PK: No such file or directory
/etc/init.d/ccth: line 7:Dr�L/springframework/boot/loader/jar/PK: No such file or directory
/etc/init.d/ccth: line 8: syntax error near unexpected token `$'org/springframework/boot/loader/archive/PK\003\004''
/etc/init.d/ccth: line 8: Dr�L(org/springframework/boot/loader/archive/PK'
How i can fix them?
Karol Dowbecki :
You are most likely missing the <executable>
option in your build configuration. Without it you are producing a regular JAR, not executable one.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>