Encounter problems
对Spring Boot观察了好久,最近终于开始有机会使用Spring Boot来做项目的开发,Spring Boot不需要部署,用jar包模式运行的机制,非常适合做快速开发,能在项目演示和迭代期间起到快速的推进作用。整体来说是一个非常好快速开发框架。 今天着重要说一下的是Spring Boot项目打包成war包,部署到J2EE容器,特别是Websphere遇到的问题。 首先Spring Boot项目build的war包,在Tomcat 7,8,Jetty等容器下,不论是嵌入到eclipse中,还是部署运行都是ok的.在Websphere 8.5.5 liberty profile中运行也没有问题,但是在 Websphere 8.5.5的正式版本中,就有几个地方需要注意,否则Spring Boot相关的包不会被服务器load,导致项目部署好了所有的访问都是404.
Solutions
Package a project with the MAVEN packages
Create a shared library, specify the project-related jar package storage path, and copy the jar files from the Lib folder in the war package to that path
Use eclipse repackaging to exclude dependent MAVEN libraries from packaged files, or remove all jars directly from the packaged war file
Modify the ClassLoader order of the deployment project
- So far, basically the project will work, if you continue to 404, restart WebSphere, or click on the startup behavior of the project (here I guess, the item will be re-loaded again by the container, which will load all the relevant jar files)
Related versions
- Spring Boot Version 1.3.3
- IBM WebSphere application Server Network Deployment 8.5.5.1
- JDK7
Where the Spring boot project is deployed to IBM WebSphere 8.5.5 needs attention