[英]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.