0

SpringXMLスキーマに関して奇妙な問題に気づいています。

SpringFrameworkを使用するスタンドアロンの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たが、役に立ちませんでした。

4

1 に答える 1

3

アプリケーションにはspring-core-3.1.x(そのクラスが使用されているため)などのjarが含まれているようですが、spring-tx-3.1.x.RELEASE.jar(Spring Transactionクラスを保持しているもの)がありません。

于 2012-08-08T13:09:21.583 に答える