簡體   English   中英

Spring XML模式

[英]Spring XML schemas

我注意到關於Spring XML模式的一個奇怪的問題。

我有一個使用spring框架的獨立Java應用程序。 只要我在Eclipse中運行此應用程序,我就不會遇到任何問題。 但是,當我將其打包為jar文件(如本鏈接中所述 )並執行jar時,出現以下異常:

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/tx]
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)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:316)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1416)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184)

我在applicationContext.xml中有以下條目,並且在eclipse中工作良好:

<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.1.xsd
           http://www.springframework.org/schema/tx 
           http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">

任何幫助深表感謝。

我什至嘗試將http://www.springframework.org/schema/tx/spring-tx-3.1.xsd更改為classpath:/org/springframework/transaction/config/spring-tx-3.1.xsd但這沒有幫助。

看起來您的應用程序包含一些jar,例如spring-core-3.1.x(因為正在使用其類),但是缺少了spring-tx-3.1.x.RELEASE.jar (用於保存Spring Transaction類的類)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM