2007年12月25日

          在使用Spring相關(guān)產(chǎn)品時(shí),你可能會(huì)碰到下面這種異常:
          Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
          這是異常的第一行,按以往的經(jīng)驗(yàn),第一行應(yīng)該就是問(wèn)題所在,但是實(shí)際上,從這行來(lái)看你根本不知道錯(cuò)在哪里。

          后面接下來(lái)的是:
          Error creating bean with name 'basicProcessingFilter'
          Cannot resolve reference to bean 'authenticationManager'
          while setting bean property 'authenticationManager';

          nested exception is Error creating bean with name 'authenticationManager'
          Cannot resolve reference to bean 'casAuthenticationProvider'
          while setting bean property 'providers' with key [0];

          nested exception is : Error creating bean with name 'casAuthenticationProvider'
          Cannot resolve reference to bean 'statelessTicketCache'
          while setting bean property 'statelessTicketCache';

          nested exception is: Error creating bean with name 'statelessTicketCache'
          Error setting property values;

          nested exception is
          nested PropertyAccessExceptions (1) are:
          PropertyAccessException 1:
          TypeMismatchException:

          Failed to convert property value of type [net.sf.ehcache.Cache]
          to required type [net.sf.ehcache.Ehcache] for property 'cache'

          Error creating bean with name 'authenticationManager'
          Cannot resolve reference to bean 'casAuthenticationProvider'
          while setting bean property 'providers' with key [0];

          nested exception is
          Error creating bean with name 'casAuthenticationProvider'
          Cannot resolve reference to bean 'statelessTicketCache' while setting bean property 'statelessTicketCache';

          nested exception is
          Error creating bean with name 'statelessTicketCache'
          Error setting property values;

          nested exception is
          nested PropertyAccessExceptions (1) are:
          PropertyAccessException 1: org.springframework.beans.TypeMismatchException:
          Failed to convert property value of type [net.sf.ehcache.Cache]
          to required type [net.sf.ehcache.Ehcache] for property 'cache'

          Error creating bean with name 'casAuthenticationProvider'
          Cannot resolve reference to bean 'statelessTicketCache'
          while setting bean property 'statelessTicketCache';

          nested exception is
          Error creating bean with name 'statelessTicketCache'
          Error setting property values;

          nested exception is PropertyAccessExceptionsException;
          nested PropertyAccessExceptions (1) are:
          PropertyAccessException 1:TypeMismatchException:
          Failed to convert property value of type [net.sf.ehcache.Cache]
          to required type [net.sf.ehcache.Ehcache] for property 'cache'

          Error creating bean with name 'statelessTicketCache'
          Error setting property values;

          nested exception is PropertyAccessExceptionsException;
          nested PropertyAccessExceptions (1) are:
          PropertyAccessException 1: org.springframework.beans.TypeMismatchException:
          Failed to convert property value of type [net.sf.ehcache.Cache]
          to required type [net.sf.ehcache.Ehcache] for property 'cache'

          PropertyAccessExceptionsException;
          nested PropertyAccessException details (1) are:
          PropertyAccessException 1:
          ypeMismatchException:
          Failed to convert property value of type [net.sf.ehcache.Cache]
          to required type [net.sf.ehcache.Ehcache] for property 'cache'

          上面的內(nèi)容是我將重復(fù)信息去掉,并分塊后的結(jié)果。

          從報(bào)錯(cuò)機(jī)制可以看出來(lái),spring出現(xiàn)異常不同于普通的java異常,我們查異常的習(xí)慣一般是關(guān)注第一行,但是sping恰恰相反,要在sping中查錯(cuò),你必須分解他,因?yàn)閟pring的嵌套層次比較多,它報(bào)錯(cuò)是從最高層報(bào)起,然后逐層往下,每個(gè)層次都會(huì)要報(bào)錯(cuò),直到最終出錯(cuò)的地方,因此查sping的錯(cuò)必須逐層分解到最底層,那里才是真正出錯(cuò)的地方。

          OK,現(xiàn)在看出來(lái)了,真正錯(cuò)誤的原因是:
          Failed to convert property value of type [net.sf.ehcache.Cache]
          to required type [net.sf.ehcache.Ehcache] for property 'cache'

          我出現(xiàn)這個(gè)錯(cuò)誤的原因是使用了Acegi 1.0.5,它本身自帶了ehcache 1.2.4.jar
          但是我同時(shí)還使用了hibernate3.1,從Eclipse導(dǎo)入hibernate3.1時(shí),將會(huì)導(dǎo)入ehcache 1.1.jar,因?yàn)閔ibernate本身也要使用EHCache,但是版本不同。

          posted @ 2007-12-25 10:02 Exiler 閱讀(3206) | 評(píng)論 (0)編輯 收藏


          posts - 3, comments - 32, trackbacks - 0, articles - 3

          Copyright © Exiler

          主站蜘蛛池模板: 岱山县| 乐亭县| 宜春市| 乌苏市| 赤水市| 陈巴尔虎旗| 靖江市| 金阳县| 军事| 栾城县| 长泰县| 通山县| 固安县| 普陀区| 永和县| 类乌齐县| 疏附县| 永仁县| 阳谷县| 恩施市| 怀宁县| 兴和县| 沙坪坝区| 纳雍县| 嘉鱼县| 外汇| 汝城县| 阳高县| 安福县| 盐边县| 抚顺县| 黔江区| 且末县| 阳高县| 广水市| 垣曲县| 新巴尔虎左旗| 洛宁县| 浦北县| 威远县| 马山县|