新建Maven+Spring项目错误集锦

来源:互联网 发布:怎么健身 知乎 编辑:程序博客网 时间:2024/05/01 21:02
以下为本人新建Maven工程时,所碰到的一起问题,给出了相应的解决方案,总结如下: 

问题1:
1). The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path     index.jsp     /user_cms/src/main/webapp  

2). javax.servlet.jsp cannot be resolved to a type     main.jsp     /midware_web/src/main/webapp/WEB-INF/view/common/decorators     line 14     JSP Problem

解决方法:
1).
 

2).选择项目->properties->project facets修改java版本和Dynamic web module


同时修改项目路径文件
工程路径\.settings\org.eclipse.wst.common.project.facet.core.xml

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="java" version="1.7"/>
  <installed facet="jst.web" version="3.0"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

3).修改properties->java compiler中java版本


4).解决只显示resource文件


问题2:Maven项目,右键-update project后报错如下的解决办法:
1)、DescriptionResourcePathLocationType
Java compiler level does not match the version of the installed Java project facet.SSMDemo Maven WebUnknownFaceted Project Problem (Java Version Mismatch)
2)、DescriptionResourcePathLocationType
JAX-RS (REST Web Services) 2.0 requires Java 1.7 or newer.SSMDemo Maven Webline 1Maven Java EE Configuration Problem
3)、DescriptionResourcePathLocationType
One or more constraints have not been satisfied.SSMDemo Maven Webline 1Maven Java EE Configuration Problem
4). Type One or more constraints have not been satisfied.
解决办法:在pom.xml配置文件中加入如下语句:
<plugins>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-compiler-plugin</artifactId>  <configuration>  <source>1.7(JDK的版本)</source>  <target>1.7(JDK的版本)</target>  </configuration>  </plugin>  </plugins>   


问题3:启动tomcat的时候就报错“Server Tomcat v7.0 Server at localhost failed to start.”

解决办法
1).把你工作空间文件夹下的如下路径打开:
<workspace-directory>\.metadata\.plugins\org.eclipse.core.resources
然后删除 .snap 文件,我在eclipse打开的情况下有这个.snap文件,但是当我关闭eclipse再看这个文件夹的时候,发现.snap文件不见了,所以这个办法没有使用成功,网上说有人使用成功了。大家可以试一下。
2).把你工作空间文件夹下的如下路径打开:
<workspace-directory>\.metadata\.plugins\org.eclipse.wst.server.core
删除里面的temp*文件夹,我这有temp0和temp1,可能是一个tomcat对应一个temp吧,不太清楚,删除后重启eclipse,tomcat就可以用了。


1 0
原创粉丝点击