eclipse常见问题解决

xiaoxiao2021-02-28  94

问题1:

maven工程报“Dynamic Web Module 3.0 requires Java 1.6 or newer.”错误。

或者maven工程修改jdk版本,都可以采用以下方法

解决方法:

在pom.xml文件的build标签中,加入如下语句:

<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <!--这句可以不要--> <configuration> <source>1.6</source> <target>1.6</target> <encoding>UTF-8</encoding><!--这句可以不要--> </configuration> </plugin> </plugins>

保存pom.xml文件,项目构建完成后在项目文件夹上点右键,选择Maven->Update Project ...,即可解决问题。

问题2:eclipse启动tomcat报如下错误:

Port 8080 required by Tomcat v7.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s)

解决方法参考:http://blog.csdn.net/cryhelyxx/article/details/17919897

问题3:

使用maven将web项目部署到tomcat时,提示如下错误:

严重: Exception starting filter encodingFilter java.lang.ClassCastException: org.springframework.web.filter.CharacterEncodingFilter cannot be cast to javax.servlet.Filter

解决方法:在pom.xml文件中的j依赖项中,找到javax,添加一句<scope>provided</scope>

修改成如下所示:

<dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>7.0</version> <scope>provided</scope><!--添加这一句--> </dependency>

参考资料:http://blog.csdn.net/wenguang_hz/article/details/46227275

问题4:

严重: Error initializing endpoint java.net.BindException: Address already in use: JVM_Bind <null>:8080

解决方法:在任务管理器中找到javaw.exe进程,结束该进程。

问题5:

maven项目报如下错误:

JavaServer Faces 2.2 can not be installed : One or more constraints have not been satisfied. JavaServer Faces 2.2 requires Dynamic Web Module 2.5 or newer.mymaven Cannot change version of project facet Dynamic Web Module to 2.3.

解决方法:修改web.xml文件,将原始文件的

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>Archetype Created Web Application</display-name> </web-app>修改为:

<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <display-name>Archetype Created Web Application</display-name> </web-app> 然后保存pom.xml文档,右键项目->Maven->Update Project。

另一解决方法:

修改项目中.settings文件夹中的org.eclipse.wst.common.project.facet.core.xml文件,将<installed facet="jst.web" version="3.1"/>这项的version修改为与web.xml中的version值一致的。即图中的两个地方。

然后保存,更新项目。

问题6:

提示错误:Referenced file contains errors (http://www.springframework.org/schema/context/spring-context-3.1.xsd)

解决方法:

(1)首先为了确保 Eclipse 可以从远程拿到 xsd 文件,到 Window -> Preferences -> General -> Network Connections -> Cache 下的 Cache entries 框内检查所需要的文件是否正确,如果不确定,就点击 "Remove All",然后右击当前的 Project 选择 Validator,Eclipse 会重新加载 xsd 文件;

(2)如果Cache中没有记录,那么需要删掉 xsd 文件的版本号,例如:

http://www.springframework.org/schema/context/spring-context-3.0.xsd

改成: http://www.springframework.org/schema/context/spring-context.xsd

然后保存,更新工程。

问题7:

提示错误:Target runtime Apache Tomcat v8.0 is not defined

右键项目->Properties->TargetedRuntimes,选择tomcatv9.0,点击Apply。

问题8:

Missing artifact jdk.tools:jdk.tools:jar:1.8

原因:tools.jar包是JDK自带的,pom.xml中以来的包隐式依赖tools.jar包,而tools.jar并未在库中,

只需要将tools.jar包添加到jdk库中即可。

解决方案:在pom文件中添加如下代码即可。

<dependency> <groupId>jdk.tools</groupId> <artifactId>jdk.tools</artifactId> <version>1.8</version> <scope>system</scope> <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath> </dependency>

转载请注明原文地址: https://www.6miu.com/read-51851.html

最新回复(0)