2007年12月9日

在使用Spring相关产品时,你可能会碰到下面这种异常:
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
这是异常的第一行,按以往的经验,第一行应该就是问题所在,但是实际上,从这行来看你根本不知道错在哪里。

后面接下来的是:
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'

上面的内容是我将重复信息去掉,并分块后的结果。

从报错机制可以看出来,spring出现异常不同于普通的java异常,我们查异常的习惯一般是关注第一行,但是sping恰恰相反,要在sping中查错,你必须分解他,因为spring的嵌套层次比较多,它报错是从最高层报起,然后逐层往下,每个层次都会要报错,直到最终出错的地方,因此查sping的错必须逐层分解到最底层,那里才是真正出错的地方。

OK,现在看出来了,真正错误的原因是:
Failed to convert property value of type [net.sf.ehcache.Cache]
to required type [net.sf.ehcache.Ehcache] for property 'cache'

我出现这个错误的原因是使用了Acegi 1.0.5,它本身自带了ehcache 1.2.4.jar
但是我同时还使用了hibernate3.1,从Eclipse导入hibernate3.1时,将会导入ehcache 1.1.jar,因为hibernate本身也要使用EHCache,但是版本不同。

posted @ 2007-12-25 10:02 Exiler 阅读(3189) | 评论 (0)编辑 收藏

公司做了套由JMS做消息队列,从JMS取出对象后转交给RTX服务器发送RTX消息的机制。
前几天出现重大BUG:消息不发送。

经过两天的测试发现了症结所在:
我们通过RTX服务器发送RTX消息的机制是通过向一个URL后面加参数来实现的,而这个请求URL,在RTX服务器上默认超时时间设置为0,即永不超时,同时此服务器设置的同一个连接两次发送消息的最短间隔时间为15毫秒。
因为我们网管的失误,打开了8012端口,此端口为RTX服务器接收消息的端口,致使开发环境中的消息能够发送到工作环境的服务器,使得RTX服务器接收的并发量出现瞬时过大现象,RTX服务器判断为DDOS攻击,因此拒绝服务,此服务器拒绝服务的方式为不返回任何值。
同时,因为设置的超时时间为0,因此后继的消息因为前面的并未抛出超时异常也未发送完成,所以积压在JMS队列中,造成了消息发送失败的现象。

一开始我一直在找JMS的原因,因为曾经在某处看到过JMS服务器并不稳定的文章,但是我在测试过程中发现,JMS还是很强大的,在消息积压的时候,其队列中最高曾积压了4000多条消息,仍然能够继续工作,我使用的是ActiveMQ+Tomcat6.10。

希望能给碰到类似JMS消息积压现象的朋友一点启示,从JMS消息不能正常取出入手,或许会有收获!

posted @ 2007-12-24 09:33 Exiler 阅读(3814) | 评论 (5)编辑 收藏

类似Hibernate异常:
%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: Could not read mappings from resource:
这种错误出现的情况只有在人为改动了Hibernate生成的文件的时候出现。

情况有两种
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 阅读(8512) | 评论 (4)编辑 收藏


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

Copyright © Exiler