本篇文章记录了老猫在学习整合Maven和SSH过程中遇到的问题,有的问题可以解决。有的问题还不能解决。

方法不一定适合全部的环境。但绝对是本人常遇到的常见异常。在这里做一个笔记和记录,也分享给大家,希望大家多多给出见解。

假设有不同的见解,请依照编号写出自己的见解吧,老猫愿闻其详!

此文老猫原创。转载请加本文连接:http://blog.csdn.net/nthack5730/article/details/46633287

很多其它有关老猫的文章:http://blog.csdn.net/nthack5730





    1.ReasonPhrase: Forbidden:
        |--- 1.注意用户的权限以及角色role的设置,通常是没有权限才会被禁止的。




    2.Failed to collect dependencies:
        |--- 1.须要把parentproject,也就是package是pom的那个project先install一下。或者deploy
        |--- 2.须要注意在设置的<profile>工厂里面能否够訪问,假设直接訪问public分组,那么就要检查public分组是否加入了自己设置的工厂




    3.child module ....pom.xml does not exist:
        |---- 1.注意module的名称是否正确,有时候命名问题会导致找不到项目的
        |---- 2.注意一開始项目命名的规则问题




    4.Cannot detect Web Project version. Please specify version of Web Project through <version> configuration property of war plugin. E.g.: <plugin> <artifactId>maven-war-plugin</artifactId>
<configuration> <version>3.0</version> </configuration> </plugin>
        |---- 1.和第五条一样在pom.xml增加plugin多的定义就可以
<plugin>

    <artifactId>maven-war-plugin</artifactId>

    <configuration>

        <version>3.0</version>

    </configuration>

</plugin>





    5.Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project marer-test-weixin: Error assembling WAR: webxml attribute is required (or pre-existing
WEB-INF/web.xml if executing in update mode)
        |---- 1.增加下面插件引用:主要是由于没有指定web.xml的位置,在pom.xml中增加
<plugin>

    <artifactId>maven-war-plugin</artifactId>

    <configuration>

        <version>3.0</version>

        <webXml>WebRoot\WEB-INF\web.xml</webXml><!-- 这里指定位置 -->

    </configuration>

</plugin>





    6.javax.servlet.jsp.PageContext cannot be resolved to a type
        |---- 1.这是由于没有引入jsp-api引发的问题,在pom.xml引入:
<dependency>

    <groupId>javax.servlet</groupId>

    <artifactId>jsp-api</artifactId>

    <version>2.0</version>

</dependency>





    7.Failed to clean project: Failed to delete F:\project\Stest......\target
        |---- 1.又一次使用命令clean一遍就可以




    8.The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory
        |---- 1.注意:jsp-api的依赖的scope一定要provide。即不打包进去。否则会和tomcat冲突
<dependency>

    <groupId>javax.servlet</groupId>

    <artifactId>jsp-api</artifactId>

    <scope>provided</scope>

</dependency>


此文老猫原创。转载请加本文连接:http://blog.csdn.net/nthack5730/article/details/46633287

很多其它有关老猫的文章:http://blog.csdn.net/nthack5730



    9.java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld
        |---- 1.缺少Spring的aspects的jar包,在pom.xml中引入
        |---- 2.注意Spring的ORM框架也要导入,读取配置文件失败,原因是由于不能给txManager和hibernate注入Bean
        |---- 3.注意2:我在上面已经用全局变量指定了Spring的<version>...</version>
<dependency>

    <groupId>org.springframework</groupId>

    <artifactId>spring-aspects</artifactId>

</dependency>






    10.Spring注入失败,【在action中注入service的对象或在service中注入dao对象】发生空指针异常
        |---- 1.首先须要确定你的配置文件是否起了作用:applicationContext.xml是否已经在使用了
        |---- 2.确定全部的properties文件是正确无误的
        |---- 3.确定是否使用了struts2-spring-plugin依赖:
<dependency>

    <groupId>org.apache.struts</groupId>

    <artifactId>struts2-spring-plugin</artifactId>

</dependency>





    11.-Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.
        |---- 1.eclipse中使用maven插件的时候,执行run as maven build的时候报错。是由于JDK有问题
        |---- 2.假设确定自己的Eclipse中的Window->Preference->Java->Installed JREs 设置好相应的JDK环境
        |---- 3.在Default VM arguments中增加:-Dmaven.multiModuleProjectDirectory=$M2_HOME





    12.Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project jiabo-motor:Deployment failed: repository element was not specified
in the POM inside distributionManagement element or in -DaltDeploymentRepositor 
        |--- 1.deploy的设置没有设置好,这是由于在Maven中使用了Nexus中央仓库。可是在项目的pom.xml中没有设置
        |--- 2.增加例如以下设置:【自己之前自己定义的deploy的地址】
<!-- 设置deploy的地址 -->

<distributionManagement>

    <repository>

        <id>user-release</id>

        <name>user release resp</name>

        <url>http://localhost:8081/nexus/content/repositories/user-release/</url>

    </repository>



    <snapshotRepository>

        <id>user-snapshot</id>

        <name>user snapshot</name>

        <url>http://localhost:8081/nexus/content/repositories/user-snapshot/</url>

    </snapshotRepository>



</distributionManagement>


此文老猫原创,转载请加本文连接:http://blog.csdn.net/nthack5730/article/details/46633287

很多其它有关老猫的文章:http://blog.csdn.net/nthack5730



    13. The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
        |---缺少jstl的包,在pom.xml增加
<dependency>

    <groupId>jstl</groupId>

    <artifactId>jstl</artifactId>

    <version>1.2</version>

</dependency>





     14. SSH和SpringMVC框架在使用IDE自带的tomcat管理的情况下,须要增加Servlet.api以及设置他的声明周期为provide
<dependency>

    <groupId>javax.servlet</groupId>

    <artifactId>jsp-api</artifactId>

    <version>2.0</version>

    <scope>provided</scope>

</dependency>


此文老猫原创,转载请加本文连接:http://blog.csdn.net/nthack5730/article/details/46633287

很多其它有关老猫的文章:http://blog.csdn.net/nthack5730



  
     15.overlay [ id com.6dianedu:liudian-web] is not a dependency of the project.
        |---将须要打包的项目依赖进来,增加<type>war</type>属性




     16.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.shiro:shiro-core:jar:${shiro.version}: ArtifactResolutionException: Failure to transfer org.apache.shiro:shiro-core:pom:${shiro.version}
from http://localhost:8081/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.shiro:shiro-core:pom:${shiro.version}
from/to nexus
          这是因为在pom.xml里面的依赖使用了定义的变量${shiro.version},可是却没有在<properties>...</properties>中进行定义,仅仅要在pom.xml加上定义就可以
<properties>

    <shiro.version>1.2.3</shiro.version>

</properties>










Maven常见异常及解决方法(本篇停更至16-4-12)的更多相关文章

  1. Maven常见异常及解决方法

    异常1: [ERROR] Failed to execute goal on project biz_zhuhai: Could not resolve dependencies for projec ...

  2. maven常见异常以及解决方法

    本文写的是我在整合ssm框架时遇到的一些问题,我估计很多人也会遇到,所以,这里作为一个总结,希望能够帮助大家解决问题 一,加入shiro组件时抛出的异常 加入步骤(略) 问题 1,保存后,无法导入sh ...

  3. Maven常见异常及解决方法---测试代码编译错误

    [ERROR] Please refer to E:\maven\web_nanchang\target\surefire-reports for the individual test result ...

  4. python常见异常及解决方法

    异常1: ValueError: unsupported hash type sha224 ERROR:root:code for hash sha256 was not found. Traceba ...

  5. WebServices CXF开发常见异常及解决方法

    2011-7-14 10:10:59 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass ...

  6. Servlet常见错误及解决方法

    常见错误及解决方法 1. 404产生的原因为Web服务器(容器)根据请求地址找不到对应资源,以下情况都会出现404的错误提示: 输入的地址有误(应用名大小写不正确,名称拼写不正确) 在web.xml文 ...

  7. Android 常见异常及解决办法

    Ø  前言 本文主要记录 Android 的常见异常及解决办法,以备以后遇到相同问题时可以快速解决. 1.   java.lang.NullPointerException: Attempt to i ...

  8. MySQL常见错误分析与解决方法总结

    MySQL常见错误分析与解决方法总结 一.Can't connect to MySQL server on 'localhost' (10061)翻译:不能连接到 localhost 上的mysql分 ...

  9. SSH乱码和Xshell异常断开解决方法

    一.SSH Secure Shell Client中文乱码的解决方法 这是SSH Secure Shell Client多年未解决的短板,要求客户端和服务器端都要‘UTF-8’编码,我终于知道Wind ...

随机推荐

  1. [BZOJ1191][HNOI2006]超级英雄Hero 类似二分图的最大匹配

    1191: [HNOI2006]超级英雄Hero Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 4740  Solved: 2162[Submit][ ...

  2. 洛谷 P3955 图书管理员【模拟/思维】

    题目描述 图书馆中每本书都有一个图书编码,可以用于快速检索图书,这个图书编码是一个 正整数. 每位借书的读者手中有一个需求码,这个需求码也是一个正整数.如果一本书的图 书编码恰好以读者的需求码结尾,那 ...

  3. axure8.1.0.3377授权码

    被授权人:zdfans.com 授权密钥:gP5uuK2gH+iIVO3YFZwoKyxAdHpXRGNnZWN8Obntqv7++FF3pAz7dTu8B61ySxli

  4. 前台vue的使用简单小结

    前台vue的使用简单小结 本项目要求:安装有node.js 6.0以及以上安装npm使用vue.js官方安装方法初始化项目npm install安装VueResurce:npm install vue ...

  5. poj1743(后缀数组)

    poj1743 题意 给出一个数字序列(串),现在要去寻找一个满足下列条件的子串: 长度不小于 5 存在重复的子串(如果把一个子串的所有数字都加上或减去一个值,与另一子串的数字对应相同,我们称它们重复 ...

  6. csu1812

    csu1812 题意 求三角形和矩形交的面积. 分析 半平面交.把三角形的三条边当作直线去切割矩形,最后求切割后的多边形面积即可. code #include<algorithm> #in ...

  7. 01Trie树【p2420】 让我们异或吧

    Description 异或是一种神奇的运算,大部分人把它总结成不进位加法. 在生活中-xor运算也很常见.比如,对于一个问题的回答,是为1,否为0.那么: (A是否是男生 )xor( B是否是男生) ...

  8. POJ 3264 Balanced Lineup(zkw线段树)

    [题目链接] http://poj.org/problem?id=3264 [题目大意] 求区间最大值和最小值的差值 [题解] 线段树维护区间极值即可 [代码] #include <cstdio ...

  9. [COCI2015]TRAKTOR

    题目大意: 一个$X\times Y(X,Y\leq10^5)$的格子中,每秒钟依次$n(n\leq10^6)$个蘑菇, 告诉你每个蘑菇出现的时间和位置,问何时第一次出现$k(2\leq k\leq ...

  10. [转]C++函数模板与模板函数

      1.函数模板的声明和模板函数的生成   1.1函数模板的声明 函数模板可以用来创建一个通用的函数,以支持多种不同的形参,避免重载函数的函数体重复设计.它的最大特点是把函数使用的数据类型作为参数. ...