问题: log4j:ERROR Error occured while converting date.

运行JBoss+JMS+Log4J时,出现下面错误:

18:29:05,359 ERROR [STDERR] log4j:ERROR Error occured while converting date.
18:29:05,000 ERROR [STDERR] java.lang.NullPointerException
18:29:05,000 ERROR [STDERR]  at java.lang.System.arraycopy(Native Method)
18:29:05,000 ERROR [STDERR]  at java.lang.AbstractStringBuilder.getChars(Unknown Source)
18:29:05,000 ERROR [STDERR]  at java.lang.StringBuffer.getChars(Unknown Source)
18:29:05,000 ERROR [STDERR]  at org.apache.log4j.helpers.AbsoluteTimeDateFormat.format(AbsoluteTimeDateFormat.java:117)
18:29:05,000 ERROR [STDERR]  at java.text.DateFormat.format(Unknown Source)
18:29:05,000 ERROR [STDERR]  at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444)
18:29:05,000 ERROR [STDERR]  at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64)
18:29:05,000 ERROR [STDERR]  at org.apache.log4j.PatternLayout.format(PatternLayout.java:503)
18:29:05,000 ERROR [STDERR]  at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)
18:29:05,000 ERROR [STDERR]  at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
18:29:05,000 ERROR [STDERR]  at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
18:29:05,000 ERROR [STDERR]  at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
18:29:05,000 ERROR [STDERR]  at org.apache.log4j.Category.callAppenders(Category.java:203)
18:29:05,000 ERROR [STDERR]  at org.apache.log4j.Category.forcedLog(Category.java:388)
18:29:05,000 ERROR [STDERR]  at org.apache.log4j.Category.log(Category.java:853)
18:29:05,000 ERROR [STDERR]  at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:110)
18:29:05,000 ERROR [STDERR]  at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:324)
18:29:05,000 ERROR [STDERR]  at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:254)
18:29:05,000 ERROR [STDERR]  at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:870)
18:29:05,000 ERROR [STDERR]  at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:810)
18:29:05,000 ERROR [STDERR]  at java.lang.Thread.run(Unknown Source)
18:29:05,046 ERROR [STDERR] log4j:ERROR Error occured while converting date.
18:29:05,046 ERROR [STDERR] java.lang.NullPointerException
18:29:05,046 ERROR [STDERR]  at java.lang.System.arraycopy(Native Method)
18:29:05,046 ERROR [STDERR]  at java.lang.AbstractStringBuilder.getChars(Unknown Source)
18:29:05,046 ERROR [STDERR]  at java.lang.StringBuffer.getChars(Unknown Source)
18:29:05,046 ERROR [STDERR]  at org.apache.log4j.helpers.AbsoluteTimeDateFormat.format(AbsoluteTimeDateFormat.java:117)
18:29:05,046 ERROR [STDERR]  at java.text.DateFormat.format(Unknown Source)
18:29:05,046 ERROR [STDERR]  at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444)
18:29:05,046 ERROR [STDERR]  at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64)
18:29:05,046 ERROR [STDERR]  at org.apache.log4j.PatternLayout.format(PatternLayout.java:503)
18:29:05,046 ERROR [STDERR]  at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)
18:29:05,046 ERROR [STDERR]  at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
18:29:05,046 ERROR [STDERR]  at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
18:29:05,046 ERROR [STDERR]  at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
18:29:05,046 ERROR [STDERR]  at org.apache.log4j.Category.callAppenders(Category.java:203)
18:29:05,046 ERROR [STDERR]  at org.apache.log4j.Category.forcedLog(Category.java:388)
18:29:05,046 ERROR [STDERR]  at org.apache.log4j.Category.log(Category.java:853)
18:29:05,046 ERROR [STDERR]  at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:110)
18:29:05,046 ERROR [STDERR]  at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:324)
18:29:05,046 ERROR [STDERR]  at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:254)
18:29:05,046 ERROR [STDERR]  at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:870)
18:29:05,046 ERROR [STDERR]  at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:810)
18:29:05,046 ERROR [STDERR]  at java.lang.Thread.run(Unknown Source)

 

起初以为是LOG4J问题,就把log4j.properties文件的时间模式调整,问题依然,干脆把Log4j的特性都去掉,问题还在。

 

仔细阅读了一下错误信息,发现了下面一句:

at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:810)

 

 

查了一下文档http://blog.csdn.net/shiqiang1234/archive/2009/09/22/4582067.aspx,有这句:

如果maxMessagesPerTask属性的值小于0,那么AsyncMessageListenerInvoker.run方法会在循环中反复尝试接收消息,并在接收到消息后调用MessageListener(或者SessionAwareMessageListener);如果 maxMessagesPerTask属性的值不小于0,那么AsyncMessageListenerInvoker.run方法里最多会尝试接收消息 maxMessagesPerTask次,每次接收消息的超时时间由其父类 AbstractPollingMessageListenerContainer的receiveTimeout属性指定。如果在这些尝试中都没有接收到消息,那么AsyncMessageListenerInvoker的idleTaskExecutionCount属性会被累加。

 

郁闷,原来是OnListener的线程一直在运行,等待不到消息而出错,就改用了:SimpleMessageListenerContainer

好像是发送方或接受发没收到消息而进入了死循环之中,原因还待研究。。。

问题清除。。。

后续工作:

改solution在使用queue是没问题,改用topic是依旧存在,

看来这个线程的问题挺严重的。

 

 

OK.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值