昨天有个群里的小伙伴,是一个springboot项目,说他的项目打成jar可以正常运行,但是放到war下面就报错了

然后,我就让他贴日志,贴完日志发现tomcat启动报错,报错内容如下

file

简单意思下就是 El不支持那个类,springboot内置的tomcat是8的,但是他是用tomcat7打的包,所以内部会抛异常,


然后我让他下载并配置tomcat8

然后用mvn clean mvn install下 发现可以构建成功

丢到webapp的ROOT下面,然后项目正常编译,进入登录页,登录进去发现报了一个错,但是控制台没有打印出来

我f12下查看了他的接口,/manager/xxx,

找了半天没有找出来,最后细心的我发现,

报错内容

The page you tried to access (/manager/asdas) does not exist.

The Manager application has been re-structured for Tomcat 7 onwards and some of URLs have changed. All URLs used to access the Manager application should now start with one of the following options:

/manager/html for the HTML GUI
/manager/text for the text interface
/manager/jmxproxy for the JMX proxy
/manager/status for the status pages
Note that the URL for the text interface has changed from "/manager" to "/manager/text".

You probably need to adjust the URL you are using to access the Manager application. However, there is always a chance you have found a bug in the Manager application. If you are sure you have found a bug, and that the bug has not already been reported, please report it to the Apache Tomcat team.

搜了一下网上也没有这类的错

最后我看了一下Tomcat的webapps,发现有个manager的文件夹,于是更换了接口/manager前缀,正常访问!

于是我帮他快速定位了这个细心的问题

至于打成jar包为什么没有报错呢? 我猜想springboot内置的tomcat webapps下应该没有设置manager的文件夹吧


然后小伙子又一个个接口全部都改掉了

总结: 写代码的时候定义内容的时候应该注意一下,为了避免不必要的错误,某些关键字慎用