关于Maven报错的一些解决办法(别处贴的)

摘要:
而且这个Java版本跟Project安装的有关系。--将Action交给spring容器管理--˃4、Eclipse:Anerroroccurredwhilefilteringresources解决:Maven-˃UpdateProject...resolvedthisproblemforme5、org.dom4j.DocumentException:Softwarecausedconnectionabort:recvfailed这个错误有可能是hibernate的配置文件.hbm.xml里这个声明有问题用下面这个解决问题如果不行,则是颠倒过来,即如果原来使用6、CannotchangeversionofprojectfacetDynamicWebModuleto3.0.和Oneormoreconstraintshavenotbeensatisfied.需要修改project的properties的projectfacts的DynamicWebMoudleVersion版本和web.xml中的版本一直,然后在通过mavenupdate以下为web.xml的各个版本:web.xmlv2.3[xml]viewplaincopy1.˂?

1、警告:The tag handler class for "s:form"(org.apache.struts2.views.jsp.ui.FormTag) was not found on theJavaBuild Path
这个问题终于可以解决了,在出问题的页面 <s:form>标签前后删除空格后保存文件警告即可消失,即<s:form>为改行的起始,然后保存。

2、Eclipse下javacompiler level does not match the version of theinstalledJavaproject facet的问题.

javacompilerfaceteclipsepropertiesjdk问题现象:项目图标报错“Java compiler level does not match the version of theinstalled Java project facet.”。
分析原因:根据错误信息的字面意思,应该是Java版本设定不一致的问题。而且这个Java版本跟Project安装的有关系。

解决办法:

既然是project出的问题,自然要从项目属性入手。其实很简单,

修改项目的org.eclipse.wst.common.project.facet.core.xml
<installed facet="jst.web"version="2.5"/> --Dynamic Web Moudle Version
<installed facet="java"version="1.5"/> --java Version
根据自身机器开发环境设置
或者
右键项目“Properties”,在弹出的“Properties”窗口左侧,单击“Project Facets”,打开“Project Facets”页面。

在页面中的“Java”下拉列表中,选择“1.5”

3、Struts2 +spring
需要在pom.xml中加入:
<!-- struts2 spring plugins -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.3.16</version>
</dependency>
同时在struts.xml中加入
<!--将Action交给spring容器管理-->
<constant name="struts.objectFactory"value="spring" />
4、Eclipse : An error occurred while filtering resources
解决:Maven ->Update Project... resolved this problem for me

5、org.dom4j.DocumentException:Software caused connection abort:recv failed

这个错误有可能是hibernate的配置文件.hbm.xml里

<!DOCTYPE hibernate-mapping PUBLIC"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

这个声明有问题

用下面这个解决问题

<!DOCTYPE hibernate-mapping PUBLIC"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.NET/hibernate-configuration-3.0.dtd">

如果不行,则是颠倒过来,即如果原来使用

<!DOCTYPE hibernate-mapping PUBLIC"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
则用

<!DOCTYPE hibernate-mapping PUBLIC"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

6、Cannot change version of project facet Dynamic Web Module to3.0.和One or more constraints have not been satisfied.

需要修改project的properties的project facts的Dynamic Web Moudle Version版本和web.xml中的版本一直,然后在通过maven update

以下为web.xml的各个版本:

web.xml v2.3

[xml]view plaincopy

1.<?xmlversion="1.0"encoding="ISO-8859-1"?>

2.<!DOCTYPEweb-appPUBLIC"-//SunMicrosystems,Inc.//DTDWebApplication2.3//EN""http://java.sun.com/dtd/web-app_2_3.dtd">

3.

4.<web-app>

5.

6.</web-app>

web.xml v2.4

[xml]view plaincopy

1.<?xmlversion="1.0"encoding="UTF-8"?>

2.<web-appid="WebApp_9"version="2.4"xmlns="http://java.sun.com/xml/ns/j2ee"

3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

4.xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

5.

6.</web-app>

web.xml v2.5

[xml]view plaincopy

1.<?xmlversion="1.0"encoding="UTF-8"?>

2.<web-appxmlns=<atarget="_blank"href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a>

3.xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

4.xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

5.version="2.5">

6.

7.</web-app>

web.xml v3.0

[xml]view plaincopy

1.<?xmlversion="1.0"encoding="UTF-8"?>

2.

3.<web-app

4.version="3.0"

5. xmlns="http://java.sun.com/xml/ns/javaee"

6.xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

7. xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

8.

9.</web-app>

7、An internal error occurred during:"Updating MavenProject"

mvn archetype:generate -DgroupId=com.mkyong -DartifactId=HibernateExample -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

)--java application

mvn archetype:generate -DgroupId=com.mkyong -DartifactId=HibernateExample -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

)--java web application

命令行创建maven项目转为eclipse项目时,在eclipse中打开存在的maven项目,不能通过maven update解决:

问题提示:An internal error occurred during:"Updating MavenProject"
解决:
1、把该项目从eclipse中删除,不要删除掉项目文件(只是从eclipse项目视图中删除);
2、进入cmd,然后进入到该项目目录下比如:E:workspacemavenProject ,其中mavenProject为项目名称;
3、执行命令:mvneclipse:clean;
4、检查项目目中是否还存在.classpath、.project、.settings ,如果存在,则删除掉;
5、通过右键-->import-->Existing Maven Projects,重新导入即可。

8、

hibernatejava.lang.UnsupportedOperationException: The user must supply a JDBC connection

是hibernate的配置文件hibernate.cfg.xml配置存在问题,检查数据连接的driver_class、url、username、root等参数名及参数值是否正确

9、MySQL中,如果hibernate的主键用uuid.hex,报异常如下:

java.sql.BatchUpdateException: Data truncation: Data too longfor column 'SID' at row 1 .

解决:
修改mysql的字符集和创建表的一样即可,比如创建表create table aa() default charset=utf8 ;
那么通过命令:setnames utf8 ;,修改mysql的字符集;

重新运行程序即可。

10、maven在eclipse中创建maven project报一下错误解决:

Could not resolvearchetypeorg.apache.maven.archetypes:maven-archetype-quickstart:RELEASE fromany of theconfigured repositories.

Could not resolve artifact

Failed to resolve versionfororg.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE: Couldnotfindmetadataorg.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xmlinlocal (E:maven3 epository)

Failed to resolve versionfororg.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE: Couldnotfindmetadataorg.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xmlinlocal (E:maven3 epository)

解决思路:

a、修改conf/settings.xml,在<mirrors>…</mirror>中间加入以下内容:

<mirror>

<id>ibiblio.org</id>

<name>ibiblio Mirror ofhttp://repo1.maven.org/maven2/</name>

<url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>

<mirrorOf>central</mirrorOf>

<!-- UnitedStates, North Carolina-->

</mirror>

<mirror>

<id>cica.es</id>

<url>http://ftp.cica.es/mirrors/maven2</url>

<mirrorOf>central</mirrorOf>

<!-- Spain,Sevilla -->

</mirror>

<mirror>

<id>skynet.be</id>

<url>http://maven2.mirrors.skynet.be/pub/maven2</url>

<mirrorOf>central</mirrorOf>

<!-- Belgium-->

</mirror>

b、如果机器使用代理,则需要修改代理信息,在<proxies>…</proxies>之间加入

<proxy>

<id>my-proxy</id> <!—起一个名字-->

<active>true</active> <!—固定为true-->

<protocol>http</protocol><!—固定为http-->

<username>user</username><!—如果不需要设置,则屏蔽掉username属性—>

<password>pwd</password><!—如果不需要设置,则屏蔽掉password属性—>

<host>10.17.75.2</host><!—代理服务器地址-->

<port>3128</port><!—代理服务器端口-->

<nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>

</proxy>

11、eclipse执行mvn install的时候报如下错误
[ERROR] Failed to parse plugin descriptor fororg.apache.maven.plugins:maven-install-plugin:2.3.1(E:maven3 epositoryorgapachemavenpluginsmaven-install-plugin2.3.1maven-install-plugin-2.3.1.jar):error in opening zip file -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -eswitch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, pleaseread the following articles:
[ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/PluginDescriptorParsingException

解决方法:

删除:E:maven3 epositoryorgapachemavenpluginsmaven-install-plugin2.3.1目录,操作后:E:maven3 epositoryorgapachemavenpluginsmaven-install-plugin下没有2.3.1目录,然后重新执行mvn Install;

如果执行mvn Clear存在相同问题,这只需要删除对应的目录,让Maven重新下载对应的jar即可。

Cannot change version of project facet Dynamic Web Module to 3.1 (Eclipse Maven唯一解决方案)

If you want to use version 3.1 you need to use the following schema:

Note that 3.0 and 3.1 are different: in 3.1 there's no Sun mentioned, so simply changing 3_0.xsd to 3_1.xsd won't work

de><?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee                 http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"         version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"></web-app>de>

Also, make sure you're depending on the latest versions in your pom.xml. That is,

de><plugin>    <groupId>org.apache.maven.plugins</groupId>    <artifactId>maven-war-plugin</artifactId>    <version>2.4</version>    <configuration>        ...    </configuration></plugin>de>

and

de><dependency>    <groupId>javax.servlet</groupId>    <artifactId>javax.servlet-api</artifactId>    <version>3.1.0</version>    <scope>provided</scope></dependency>de>

Also, you should compile with Java 7 or 8:

de><plugin>    <groupId>org.apache.maven.plugins</groupId>    <artifactId>maven-compiler-plugin</artifactId>    <version>3.1</version>    <configuration>        <source>1.7</source>        <target>1.7</target>    </configuration></plugin>de>

免责声明:文章转载自《关于Maven报错的一些解决办法(别处贴的)》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇C++使用OLE高速读写EXCEL的源码Unity3d 创建线程 子线程与主线程通信下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Openfire配置过程,以及与php交互注意事项。

使用 XMPP 构建一个基于 web 的通知工具 转 使用 XMPP 构建一个基于 web 的通知工具 使用 XMPP、PHP 和 JavaScript 编写实时 web 应用程序 Ben Werdmuller, 顾问和作者, Freelance Ben Werdmuller 是一位 Web 策划师和开发人员,他专注于开放源码平台。他是开源社交网络框架...

Metasploit 安装及使用

    官网 https://www.metasploit.com/ 使用手册 https://metasploit.help.rapid7.com/docs 简介 开源安全漏洞检测工具,附带数百个已知的软件漏洞,并保持频繁更新。被安全社区冠以“可以黑掉整个宇宙”之名的强大渗透测试框架。 MetaSploit 截止目前(2020/06/29)有两个版本:...

spring/spring boot/spring mvc中用到的注解

在spring Boot中几乎可以完全弃用xml配置文件,本文的主题是分析常用的注解。 Spring最开始是为了解决EJB等大型企业框架对应用程序的侵入性,因此大量依靠配置文件来“非侵入式”得给POJO增加功能,然而,从Spring 3.x开始,Spring被外界最为诟病的一点就是配置繁多,号称“配置地狱”,各种xml文件,出了问题非常难排查。从Sprin...

在.net中读写config文件的各种方法

阅读目录 开始 config文件 - 自定义配置节点 config文件 - Property config文件 - Element config文件 - CDATA config文件 - Collection config文件 - 读与写 读写 .net framework中已经定义的节点 xml配置文件 xml配置文件 - CDATA xml文件读写...

JSON的数据格式

1. 什么是 JSON       JSON概念很简单,JSON 是一种轻量级的数据格式,他基于 javascript 语法的子集,即数组和对象表示。由于使用的是 javascript 语法,因此JSON 定义可以包含在javascript 文件中,对其的访问无需通过基于 XML 的语言来额外解析。不过在使用 JSON 之前,很重要的一点是理解 javas...

KETTLE集群搭建

KETTLE集群搭建 说明: 本文档基于kettle5.4 一、集群的原理与优缺点 1.1集群的原理          Kettle集群是由一个主carte服务器和多个从carte服务器组成的,类似于master-slave结构,不同的是’master’处理具体任务,只负责任务的分发和收集运行结果。 Master carte结点收到请求后,把任务分成多个部...