问题描述
限时送ChatGPT账号..我有一个 spring boot 项目,我正在尝试使用嵌入式 Tomcat 10 而不是 Tomcat 7.我将以下内容添加到我的 POM 中...
I have a spring boot project and I am trying to use Tomcat 10 embedded instead of Tomcat 7. I add the following to my POM...
<properties>
<tomcat.version>10.0.5</tomcat.version>
...
</properties>
然后我运行我之前运行的相同命令......
Then I run the same command I was running before...
mvn clean package -U && java -cp target\my.jar;props -Dloader.main=com.my.Main org.springframework.boot.loader.PropertiesLauncher
但现在它只是启动然后自行关闭.最后的消息是...
But now it just starts and then shuts itself down. The final messages are...
2021-05-13 15:35:42.105 INFO 10084 --- [ main] com.my.Main : Started Main in 42.918 seconds (JVM running for 44.009)
2021-05-13 15:35:42.190 INFO 10084 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
为什么会发生这种情况,我如何才能在没有这种副作用的情况下进行升级?
Why would this happen and how can I upgrade without this side effect?
推荐答案
Tomcat 10 是 Jakarta EE 9 servlet 容器.这基本上意味着,出于版权原因,所有 javax.*
包都被重命名为 jakarta.*
(Oracle 不允许 Eclipse 基金会使用 javax.*
).* 名称).
Tomcat 10 is a Jakarta EE 9 servlet container. It basically means, that all javax.*
packages were renamed to jakarta.*
for copyright reasons (Oracle didn't allow the Eclipse Foundation to use the javax.*
names).
Spring Boot 2 和 Spring 5 仅支持之前的 Java EE 8 规范,Tomcat 10 支持需要等待 Spring Boot 3 和 Spring 6.或者,您可以通过 Apache Tomcat Migration Tool 传递 Spring 库,该工具刚刚达到 1.0 版或降级到Tomcat 9.0.
Spring Boot 2 and Spring 5 support only the previous Java EE 8 specification, you need to wait for Spring Boot 3 and Spring 6 for Tomcat 10 support. Alternatively you can pass Spring libraries through the Apache Tomcat Migration Tool, which just reached version 1.0 or downgrade to Tomcat 9.0.
Tomcat 10.0.4 无法加载 servlet(@WebServlet 类)并出现 404 错误这篇关于为什么升级到Tomcat 10.0.5会导致spring boot开机后关机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论