2012-01-06 154 views
0

我目前正在通過'Spring in Action'工作。從各方面入手,我想知道是否有人能看到我的錯誤。 在我AppConfig.xml,我開始了豆declaratiotn有:Spring XML命名空間

<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" 
    xmlns:p="http://www.springframework.org/schema/p" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> 

運行的應用程序,我得到以下異常:

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [config/AppConfig.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice 

的定義可能是錯誤的?

任何幫助表示讚賞!

問候, 馬庫斯

+0

這不是一個配置錯誤,它是一個缺少的庫錯誤。你正在部署aop依賴關係嗎? – 2012-01-06 12:38:27

回答

0

請確保您有彈簧aop.jar,aopalliance.jar或aspectjtools-1.6.0.jar包含在你的項目中。該錯誤表明在類路徑中找不到Advice類。它可以在我提到的兩個罐子之一中找到,具體取決於您使用的Spring版本。

http://forum.springsource.org/showthread.php?82282-ava-lang-ClassNotFoundException-org-aopalliance-aop-Advice

+0

實際上,這是缺少aspectjtools-1.6.0.jar,春季分佈似乎是完整的。沒有什麼可以探索新語言的領域8) – 2012-01-06 13:03:47

+0

@馬庫斯Toepper感謝您的更新,我編輯我的答案,包括你的發現。 – 2012-01-06 14:13:06

0

我也面臨着同樣的問題,同時啓動應用程序的開發春天3.0版本。

AOP從3.0版本中刪除。因此,你需要明確地下載並在你的類路徑中包含這個特定的jar {0}。

這將解決問題。