简体   繁体   中英

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? 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. 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. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM