首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >“找不到Spring NamespaceHandler”错误

“找不到Spring NamespaceHandler”错误
EN

Stack Overflow用户
提问于 2010-07-26 21:28:15
回答 5查看 20.3K关注 0票数 16

我正在使用Spring创建一个独立的Sava应用程序,以处理JDBC访问。这个应用程序在每次测试中都工作得很好,我决定需要一个jar来部署我们的客户端。

它们的类路径中可能没有spring,所以我使用maven-assembly-plugin来处理带有依赖项的jar创建。

但是,当我尝试运行应用程序时:

代码语言:javascript
复制
java -jar target/myproject-0.0.1-SNAPSHOT-jar-with-dependencies.jar

这将抛出以下错误:

代码语言:javascript
复制
Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/p]
Offending resource: class path resource [applicationContext.xml]

at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
...and so on to the database access class of this project.

主文件位于projectbase/src/ applicationContext.xml /resources中。并将其放在target/packagename库中。

The applicationContext.xml

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:p="http://www.springframework.org/schema/p"
   xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">


    <bean id="dataSourceDesenv" class="org.apache.commons.dbcp.BasicDataSource"... />

    <bean id="simpleJdbcDaoSupport" class="org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport"
      p:dataSource-ref="dataSourceDesenv" />

    <bean id="simpleJdbcTemplate" class="org.springframework.jdbc.core.simple.SimpleJdbcTemplate">
        <constructor-arg ref="dataSourceDesenv" />
    </bean>

</beans>
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3335203

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档