maven的各种异常
1. 问题
本文将讨论Spring中最常见的配置问题 —— Spring的一个命名空间的名称空间处理程序没有找到。 大多数情况下,是由于一个特定的Spring的jar没有配置在classpath下,让我们列出多数可能出现的缺失配置以及导致的异常。
2. http://www.springframework.org/schema/security
安全名称空间可能是迄今为止在实践中遇到的最广泛的问题:

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"> </beans:beans>

导致以下异常:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem:
Unable to locate Spring NamespaceHandler for XML schema namespace
[http://www.springframework.org/schema/security]
Offending resource: class path resource [securityConfig.xml]
解决方法很简单 —— 把spring-security-config的jar配置在classpath中(如:maven的pom.xml):
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
配置正确的名称空间处理程序 —— 在这种情况下classpath下的SecurityNamespaceHandler会解析安全名称空间中的元素。
3. http://www.springframework.org/schema/aop
发生在使用aop名称空间时,没有将相应的spring的jar配置在classpath下:

<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd"> </beans>

导致以下异常:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem:
Unable to locate Spring NamespaceHandler for XML schema namespace
[http://www.springframework.org/schema/aop]
Offending resource: ServletContext resource [/WEB-INF/webConfig.xml]
解决方法与问题2类似,只需将spring-aop的jar配置calsspath下:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
4. http://www.springframework.org/schema/tx
使用事务名称空间 —— 一个小但非常有用的名称空间配置:

<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"> </beans>

导致以下异常:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem:
Unable to locate Spring NamespaceHandler for XML schema namespace
[http://www.springframework.org/schema/tx]
Offending resource: class path resource [daoConfig.xml]
解决方法,将事务的jar配置到classpath下:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
5. http://www.springframework.org/schema/mvc
下面是spring的mvc名称空间

<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"> </beans>

导致以下异常:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem:
Unable to locate Spring NamespaceHandler for XML schema namespace
[http://www.springframework.org/schema/mvc]
Offending resource: class path resource [webConfig.xml]
遇到这种异常,是因为没有将spring的mvc的jar配置在classpath中:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
6.结论
最后,如果你是使用Eclipse来管理web服务器和部署,确保部署的组装部分项目是配置正确的 —— 即Maven的依赖,实际上是在部署时包含在类classpath中。
maven的各种异常的更多相关文章
- maven ssm 编译异常记录:
maven ssm 编译异常记录: javax.servlet.jsp 解决: 清除 tomacat libraries 修改 pom 文件 <dependency> <groupI ...
- Maven工程无异常 启动没有出现Starting ProtocolHandler的原因
这个情况可能的原因 一般来说有3种1.数据库没连接上2.注册中心没连接上3.逆向工程生成的mapper 有问题解决:哪个Maven工程出问题,就那个工程的src/main/resource目录下面添加 ...
- Tomcat发布Maven项目遇到异常:java.lang.OutOfMemoryError: PermGen space
前言: 本问题出现在tomcat 7发布 web3.0Maven项目的时候出现. 问题阐述: 异常:java.lang.OutOfMemoryError:PermGen space 解决如下: 1. ...
- maven 整合 ssm 异常分析
异常一:使用tomcat 7 启动没问题访问(JSP)页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP ...
- spring + spring mvc 使用 maven 编译出现异常
异常如下: [INFO] Scanning for projects...[INFO] [INFO] ------------------------------------------------- ...
- Maven运行时异常java.lang.UnsupportedClassVersionError的解决方案
我用的Maven版本为最新版:3.3.9,但是我执行一个简单的clean命令会报如下错误: Exception in thread "main" java.lang.Unsuppo ...
- Jenkins Maven打包出错异常的解决方法
Jenkins是一个很好用的打包部署工具,实现一键式部署项目,在项目处于测试阶段或者对于运维人员来讲是非常方便的一个工具. 但是最近使用Jenkins部署项目时老是出错,主要是maven打包的问题,错 ...
- maven jetty struts异常 There is no Action mapped for namespace [/] and action name [] associated with context path
毕业设计中用maven jetty插件调试时,struts出现这个错误,直接http://localhost:8080 无法进入默认主页,但换tomcat就没问题,最后在这篇文章找到答案 http:/ ...
- maven tomcat jstl 异常
在跑一个带jstl的例子的时候,遇到了这样一个错误: org.springframework.web.util.NestedServletException: Handler processing f ...
随机推荐
- PHP商城的搜索功能
大家好,今天分享一个商城的搜索功能,建立在上一篇文章的基础上实现的. 搜索功能简单的说就是通过sql语句在数据库中实现模糊查找 连接数据库,实现分页功能(可以参考上一篇文章) 定义一个变量接收传过来的 ...
- k8sIngress资源
k8s提供了两种内建的云端负载均衡机制用于发布公共应用,一种是工作于传输层的service资源,它实现的是TCP负载均衡器,另一种是Ingress资源,它实现的是HTTP(S)负载均衡器. 1)TCP ...
- K8S概念
1.master master是集群的网关和中枢,负责诸如为用户和客户端暴露api.跟踪其他服务器的健康状态.以最优方式调度工作负载,以及编排其他组件之间的通信等服务,它是用户或客户端与集群之间的核心 ...
- Mybatis日志无打印的问题
添加maven依赖 <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j1 ...
- Django 文件配置、pycharm及django连接数据库、表的增删改查 总结
静态文件配置 1.你在浏览器中输入网址能够有响应的资源返回给你 是因为后端已经提前给你开设该资源的接口,也就意味着你所能 访问到的资源 都是人家事先定义好的 2.django如何给用户开设资源接口呢? ...
- 初识linux(简单命令)
之前一直搞不懂,为什么全是命令行的linux系统这么多公司都在用,当你看不懂那一行行命令时你一定会和我一样觉得头大.但当你学习了命令再结合桌面版觉得linux还是挺不错的
- buuctf@helloword
- Eclipse中注释乱码解决办法
问题描述:将别人的Java工程导入自己的工作空间之后,有时候会出现注释乱码问题. 这是由于IDE对汉字的编码方式不同造成的.比如,原来的开发人员使用的是UTF-8编码方式,而现在开发人员使用的IDE使 ...
- 51 Nod 1068 Bash游戏v3
1068 Bash游戏 V3 题目来源: Ural 1180 基准时间限制:1 秒 空间限制:131072 KB 分值: 20 难度:3级算法题 收藏 关注 有一堆石子共有N个.A B两个人轮流 ...
- HGOI20190815 题解
Problem A modsum 求$\sum\limits_{i=1}^{n} \sum\limits_{j=1 , i \neq j}^{m} (n \ mod \ i)(m \ mod \ j) ...