2015-02-23 66 views
-1

當我通過創建一個動態web項目在eclipse Helios中運行我的應用程序時,出現以下錯誤。我也用cxf從wsdl自動生成類。使用jpa和彈簧時的配置錯誤

 
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/persistence.xml] 

我的persistence.xml是在src文件夾META-INF: 請幫助解決錯誤。 我用spring從JPA中檢索數據庫。

回答

0

那麼,你的應用程序中有一個機制來加載你的spring上下文。正如你在談論一個web應用程序,我想你的上下文被加載到web.xml中。 在你的web.xml會有一個部分,如:

<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>/META-INF/*.xml</param-value> 
</context-param> 

這種模式也是你的persistence.xml匹配。

因此,讓這變爲:

<param-value>/WEB-INF/springContext*.xml</param-value> 

現在,春天將只加載上下文開頭的文件springContext和結束與XML。

不幸,您的問題不詳細解釋您的應用程序,所以這是一個狂野的猜想。

+0

<的context-param> ​​contextConfigLocation的 WEB-INF/beans.xml中 sneha22 2015-02-24 04:38:59

+0

這是我的web.xml文件。我有一個persistence.xml和一個spring.xml – sneha22 2015-02-24 04:39:48

+0

\t \t sneha22 2015-02-24 05:02:11