Maven_启动Tomcat配置

  使用Tomcat启动Maven工程时,可能会出现 警告: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:a' did not find a matching property. 然后导致页面404的错误。

  查询了百度和GOOLE,网上提供了一种解决方案:

  即在Server下鼠标Tomcat配置(现将Tomcat中项目remove),然后如勾上图中选项,重启Tomcat。

  

  但是试过之后仍然出现相同的错误情景,问题仍然存在。继续查询原因,在某位大神的博客(忘记大神的博客名了)中,发现Eclipse在创建Maven功能时,默认WEB-INF应该在src/main/webapp下,然后刚新建的Maven项目需修改为Dynamic Web Module,在修改过程中会出现如下场景:

  如上图可发现会让你指定Content_directory目录,如果你直接点OK,即默认那么WebContent会建立在src路径下,在启动Tomcat时也会出现 警告: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:a' did not find a matching property.  页面404

  这种时候有两种解决方案:

    1. 将WebContent目录修改为src/main/webapp。

    2.找到工作空间下该项目的.settings文件夹,修改org.eclipse.wst.common.component文件

  将source-path指定为 /src/WebContent,重新部署代码,重启Tomcat,问题解决。

猜你喜欢

转载自www.cnblogs.com/dandelZH/p/9069572.html