【环境问题】消灭红叉-The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path
环境:
Windows 7 旗舰版
jdk7
Spring Tool Suite(STS,version:3.6.0.RELEASE)
经常使用Eclipse(STS)作为发开IDE的,经常会碰到项目莫名奇妙的红叉
1. index.jsp 红叉:The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path
2. spring-*.xml配置文件 红叉:cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element ‘mvc:default-servlet-handler’.
…未完待续
详细说明:
1. index.jsp红叉
解决办法
右击“项目名称”-》Properties—》Java Build Path-》Libraries-》Add Library…-》Server Runtime-》Apache Tomcat v[6|7|8].0
2.spring-*.xml 红叉
解决办法
由于spring-.xml的头部schema不匹配导致的。所以对应mvc:default-servlet-handler(mvc:*)这种配置,需要mvc 的schema头部。即把篮圈cache都改成mvc即可(这里并未用到cache)。
效果图:
3.pom.xml 红叉
org/apache/maven/plugins/war/WarMojo : Unsupported major.minor version 51.0
如图:
消灭红叉:
分析:由于jdk1.7环境配置maven的plugins插件有问题,改成2.1.1版本就不报错了。
方法:1.直接在pom.xml文件的plugin标签中配置
2.右键项目-》Maven-》Add Plugin:配置对应1中的内容,保存即可。
参考:
java错误:The superclass “javax.servlet.http.HttpServlet” was not found on the Java Bu
JavaWeb:报错信息The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path
项目忽然出现 The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path 解决方法
Eclipse 中 XML 警告 No grammar constraints (DTD or XML Schema) 解决方法
3—新建maven项目时pom.xml文件第一行报org.apache.maven.plugin.war.WarMojo的解决方法