猿问

在 ec2 中部署类似 springboot 的服务的问题

我通过运行应用程序:java -jar app.jar。它的工作很好!


但是设置像服务一样通过https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html运行。


时sudo service ccth start,则发生以下错误:


/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'

我该如何修复它们?


陪伴而非守候
浏览 278回答 2
2回答

沧海一幻觉

感谢您发布问题。我花了一些时间研究完全相同的问题。我使用 gradle 来构建 jar,我需要包括:bootJar {     launchScript()}然后只需确保您运行新创建的文件。

慕哥9229398

您很可能<executable>在构建配置中缺少该选项。没有它,您将生成一个常规 JAR,而不是可执行的 JAR。<plugin>&nbsp; <groupId>org.springframework.boot</groupId>&nbsp; <artifactId>spring-boot-maven-plugin</artifactId>&nbsp; <configuration>&nbsp; &nbsp; <executable>true</executable>&nbsp; </configuration></plugin>
随时随地看视频慕课网APP

相关分类

Java
我要回答