简体   繁体   English

spring 启动时是否使用外部服务器或嵌入式服务器作为战争部署在外部服务器上?

[英]Does spring boot uses external server, or embedded server when deployed on external server as war?

I know that if we want to deploy spring boot web app on external server we should exclude the embedded server,but what happens if we dont?我知道如果我们想在外部服务器上部署 spring 启动 web 应用程序,我们应该排除嵌入式服务器,但如果我们不这样做会怎样? Lets say Im deploying spring boot war on jboss external server,but I did not exclude tomcat server?In that case, Does spring boot uses jboss external server, or still uses embedded tomcat one? Lets say Im deploying spring boot war on jboss external server,but I did not exclude tomcat server?In that case, Does spring boot uses jboss external server, or still uses embedded tomcat one?

If you do not exclude tomcat-dependencies nor declare the dependency as provided , then deployment of war fails on wildfly 19.0.0.如果您不排除 tomcat-dependencies 也不将依赖项声明为provided ,则在 wildfly 19.0.0 上部署 war 失败。 with java.lang.RuntimeException: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer ` with java.lang.RuntimeException: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer `

In dual packaging scenario, ideally you should specify tomcat dependencies as provided so that you will have tomcat dependencies under WEB-INF/lib-provided rather than WEB-INF/lib.在双重打包方案中,理想情况下,您应该指定 tomcat 依赖项,以便在 WEB-INF/lib-provided 而不是 WEB-INF/lib 下拥有 tomcat 依赖项。 Therefore with an external server lib-provided folder will be ignored bu with a standalone spring boot application tomcat dependencies will be loaded as embedded from lib-provided folder.因此,使用外部服务器 lib 提供的文件夹将被忽略,但使用独立的 spring 引导应用程序 tomcat 依赖项将作为嵌入从 lib 提供的文件夹加载。

Note that If you do not exclude or make provided the tomcat dependencies, external server might fail or work in inconsistence state or even can work without error in some version while failing in another version version depending on the server handling of duplicate libraries.请注意,如果您不排除或提供 tomcat 依赖项,外部服务器可能会失败或工作不一致 state 甚至可以在某些版本中正常工作,而在另一个版本中失败,具体取决于服务器对重复库的处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 spring boot的嵌入式tomcat服务器如何加载外部“war”文件 - How load a external "war" file to the embedded tomcat server of spring boot 部署在外部tomcat 9服务器上时,Spring Boot REST Controller返回404 - Spring Boot REST Controller returns 404 when deployed on external tomcat 9 server Spring Boot MVC应用程序在部署到外部Tomcat / tc Server实例时返回HTTP 404 - Spring Boot MVC Application returns HTTP 404 when deployed to an external Tomcat/tc Server instance Spring Boot:部署到外部服务器时如何设置异步超时 - Spring Boot: how to set Async timeout when deploying to an external server 另一台服务器上的 Spring Boot 外部配置 - Spring Boot external configuration on another server Spring Boot 应用程序在部署到 Tomcat 时提供 404,但适用于嵌入式服务器 - Spring Boot application gives 404 when deployed to Tomcat but works with embedded server Spring boot:部署为war时如何读取驻留在Tomcat中的外部文件 - Spring boot: How to read external files reside in Tomcat when deployed as war Spring引导嵌入式容器或war文件在外部容器中进行生产 - Spring boot embedded container or war file in an external container for production 当以传统方式部署时,Spring Boot尝试运行嵌入式Tomcat - Spring Boot tries to run an embedded Tomcat when deployed as traditional war 春季引导战争到外部雄猫 - spring boot war to external tomcat
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM