项目中使用了maven,而且搭建了nexus 私服。
经常会遇到如下问题:
解决方法:在项目的pom.xml中添加:
Xml代码
1.
2.
3.
4.
5.
6.
7. 1.7
8.
9.
10.
11.
12.
解决方法:
执行deploy时指定jre的参数
-Xms128M -Xmx512M
解决方法:
对nexus 中Public Repositories 先执行“Rebuild Metadata”,再执行“Update Index”:
Xml代码
1. Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project demoManagement: Failed to deploy artifacts: Could not find artifact com.kunlunsoft.jn:demoManagement:war:1.1.0-RELEASE in tdr_vks_management_release (http://192.168.2.150:8088/nexus/content/repositories/kunlun_management_release/) -> [Help 1]
项目名为demoManagement
刚开始以为是pom。xml中finalName 引起的。结果发现nexus 压根儿没有叫“kunlun_management_release”的仓库。
根本原因:pom.xml中snapshotRepository指定的仓库不存在。
maven install web项目时报错:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project spring2: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
1
1
原因分析:
maven的web项目默认的webroot是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常。
解决办法:
将webroot修改为webapp
在pom.xml中指定web.xml,如下:
解决办法:
根据错误提示信息检查配置文件,把重复的jar删除
解决办法:
根据错误信息,删除mavan的本地仓库中对应的jar包,从新下载即可。
解决办法:
ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project hrm-manager: Failed to clean project: Failed to delete D:\work\20170529\hrm-manager\target\tomcat\logs\access_log.2017-07-09 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
解决办法:
启动任务管理器【ctrl】+【Alt】+【Delete】-> 进程 -> 并把javaw.exe的进程终止。
DEBUG [localhost-startStop-1] - Ignoring bean class loading failure for bean 'dataSource'
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.mchange.v2.c3p0.ComboPooledDataSource] for bean with name 'dataSource' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource
解决方案:说明缺少c3p0.jar 查看pom文件
或是因为配置Spring.xml有问题,可参考(基于maven管理的项目中spring+mybatis配置数据源读取不到properties属性文件的问题)http://www.henryxi.com/read-values-from-properties-file-in-spring
去加载properties文件
出现.lastUpdated结尾的文件的原因:由于网络原因没有将Maven的依赖下载完整,导致。
解决方案:
1、 删除所有以.lastUpdate结尾的文件
a) 1、切换到maven的本地仓库
b) 2、在当前目录打开cmd命令行
c) 3、执行命令:for /r %i in (*.lastUpdated) do del %i
2、 在项目上执行 Maven Update (Alt + F5)
l 将课后资料中代码导入到你的Eclipse中,执行Maven Update(推荐)
l 回到家里无法连接教室的私服?
n 把私服地址注释掉,默认会通过网络去apache的远程的中央仓库下载
l 开源中国的私服:http://maven.oschina.net/help.html
解决办法:删除重复的头信息
1)angular-1.6.4.js:14525 Possibly unhandled rejection
解决办法:
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:META-INF/spring/wms-*.xml]
Offending resource: class path resource [applicationContext.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 19 in XML document from URL [jar:file:/C:/data/zengdq/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps/wms-web-biz/WEB-INF/lib/wms-core.jar!/META-INF/spring/wms-core.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 19; columnNumber: 51; 元素 "mybatis:scan" 的前缀 "mybatis" 未绑定。
解决办法:
解决办法:出现此问题时,先检查配置文件,配置文件用的是注解的形式,而系统使用的xml的形式。
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deptMapper' defined in file [D:\Sofe\apache-tomcat-7.0.59\webapps\bawm_hr\WEB-INF\classes\com\bawei\hrm\mapper\DeptMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Sofe\apache-tomcat-7.0.59\webapps\bawm_hr\WEB-INF\classes\mapper\EmployeeMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 4; 与元素类型 "mapper" 相关联的 "namespace" 属性值不能包含 '<' 字符。
解决办法:这种情况一般都是配置文件格式写错了,根据报的错误坐标去找对应的错误