2007年12月9日

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

          后面接下來的是:
          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é)果。

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

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

          我出現(xiàn)這個錯誤的原因是使用了Acegi 1.0.5,它本身自帶了ehcache 1.2.4.jar
          但是我同時還使用了hibernate3.1,從Eclipse導(dǎo)入hibernate3.1時,將會導(dǎo)入ehcache 1.1.jar,因為hibernate本身也要使用EHCache,但是版本不同。

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

          公司做了套由JMS做消息隊列,從JMS取出對象后轉(zhuǎn)交給RTX服務(wù)器發(fā)送RTX消息的機(jī)制。
          前幾天出現(xiàn)重大BUG:消息不發(fā)送。

          經(jīng)過兩天的測試發(fā)現(xiàn)了癥結(jié)所在:
          我們通過RTX服務(wù)器發(fā)送RTX消息的機(jī)制是通過向一個URL后面加參數(shù)來實現(xiàn)的,而這個請求URL,在RTX服務(wù)器上默認(rèn)超時時間設(shè)置為0,即永不超時,同時此服務(wù)器設(shè)置的同一個連接兩次發(fā)送消息的最短間隔時間為15毫秒。
          因為我們網(wǎng)管的失誤,打開了8012端口,此端口為RTX服務(wù)器接收消息的端口,致使開發(fā)環(huán)境中的消息能夠發(fā)送到工作環(huán)境的服務(wù)器,使得RTX服務(wù)器接收的并發(fā)量出現(xiàn)瞬時過大現(xiàn)象,RTX服務(wù)器判斷為DDOS攻擊,因此拒絕服務(wù),此服務(wù)器拒絕服務(wù)的方式為不返回任何值。
          同時,因為設(shè)置的超時時間為0,因此后繼的消息因為前面的并未拋出超時異常也未發(fā)送完成,所以積壓在JMS隊列中,造成了消息發(fā)送失敗的現(xiàn)象。

          一開始我一直在找JMS的原因,因為曾經(jīng)在某處看到過JMS服務(wù)器并不穩(wěn)定的文章,但是我在測試過程中發(fā)現(xiàn),JMS還是很強(qiáng)大的,在消息積壓的時候,其隊列中最高曾積壓了4000多條消息,仍然能夠繼續(xù)工作,我使用的是ActiveMQ+Tomcat6.10。

          希望能給碰到類似JMS消息積壓現(xiàn)象的朋友一點(diǎn)啟示,從JMS消息不能正常取出入手,或許會有收獲!

          posted @ 2007-12-24 09:33 Exiler 閱讀(3967) | 評論 (5)編輯 收藏

          類似Hibernate異常:
          %%%% Error Creating SessionFactory %%%%
          org.hibernate.MappingException: Could not read mappings from resource:
          這種錯誤出現(xiàn)的情況只有在人為改動了Hibernate生成的文件的時候出現(xiàn)。

          情況有兩種
          1:hibernate.cfg.xml中,屬性<mapping resource="./Permission.hbm.xml" />里面"./Permission.hbm.xml"所指定的路徑不正確,即改動了生成實體的配置文件的位置。
          2:Permission.hbm.xml中,<class name="db_DAO.Permission" table="ACEGI_PERMISSION" schema="POSTTEST">其中屬性class name="db_DAO.Permission"指定的Permission類名錯誤,即:改動了生成實體類的類名或者包名。

          如果上述兩種情況改動后仍然報錯,clean一下項目后OK

          posted @ 2007-12-09 15:08 Exiler 閱讀(8551) | 評論 (4)編輯 收藏


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

          Copyright © Exiler

          主站蜘蛛池模板: 东山县| 河津市| 兴城市| 江口县| 尼木县| 海门市| 高青县| 贵德县| 盘山县| 嘉定区| 灵石县| 阳曲县| 塘沽区| 玉屏| 隆安县| 荥经县| 东阿县| 黄骅市| 泾阳县| 吉安市| 霍林郭勒市| 潍坊市| 汾西县| 双峰县| 原平市| 淮阳县| 乌苏市| 鹤岗市| 阳江市| 澄城县| 枣强县| 徐州市| 泸溪县| 独山县| 长治市| 视频| 财经| 华阴市| 垫江县| 宁陵县| 汾阳市|