今天在做项目进行测试的时候发现不能运行JSP文件,具体如下:

查了资料后发现解决问题的方法其实很简单,就是你插件中的Jetty版本和JDK版本不匹配的原因,我这里使用的是JDK11
之前的插件:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.25</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<contextPath>/SpringMVC01</contextPath>
</configuration>
</plugin>
只需修改成9以上的版本就能正常运行了:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.5.v20170502</version>
<configuration>
<httpConnector>
<port>8080</port>
</httpConnector>
<webApp>
<contextPath>/SpringMVC01</contextPath>
</webApp>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
本文介绍了在项目测试中遇到JSP文件无法运行的问题,原因是使用的Jetty插件版本与JDK11不兼容。通过将Jetty插件版本从6.1.25更新到9.4.5.v20170502,成功解决了该问题,确保了项目的正常运行。
370

被折叠的 条评论
为什么被折叠?



