[jboss-user] [JBoss Messaging] - Re: ClassCastException when casting ObjectMessage object

chicken do-not-reply at jboss.com
Tue Feb 3 20:16:30 EST 2009


I change the two lines to 

if (message instanceof ObjectMessage) {
  | 	System.out.println(CustomMessageBean.class.getClassLoader().toString() + " - " + CustomMessageBean.class.getProtectionDomain().getCodeSource().getLocation().toString());
  | 	System.out.println(message.getClass().getClassLoader().toString() + " - " + message.getClass().getProtectionDomain().getCodeSource().getLocation().toString());
  | 

- Out put before the application is reloaded:

09:57:31,957 INFO  [STDOUT] onMessage at JMS Receiver
  | 09:57:31,965 INFO  [STDOUT] WebappClassLoader
  |   delegate: false
  |   repositories:
  |     /WEB-INF/classes/
  | ----------> Parent Classloader:
  | java.net.FactoryURLClassLoader at 1e5ed7b
  |  - file:/export/home/JBoss/jboss-eap-4.3/jboss-as/server/default/deploy/webapps.war/WEB-INF/classes/mail/CustomMessageBean.class
  | 09:57:31,967 INFO  [STDOUT] org.jboss.mx.loading.UnifiedClassLoader3 at 12bcd4b{ url=null ,addedOrder=2} - file:/export/home/JBoss/jboss-eap-4.3/jboss-as/server/default/lib/jboss-messaging-client.jar
  | 

- Out put after reloading application: 

10:01:38,617 INFO  [STDOUT] onMessage at JMS Receiver
  | 10:01:38,629 INFO  [STDOUT] WebappClassLoader
  |   delegate: false
  |   repositories:
  |  - file:/export/home/JBoss/jboss-eap-4.3/jboss-as/server/default/deploy/webapps.war/WEB-INF/classes/mail/CustomMessageBean.class
  | 10:01:38,630 INFO  [STDOUT] org.jboss.mx.loading.UnifiedClassLoader3 at 12bcd4b{ url=null ,addedOrder=2} - file:/export/home/JBoss/jboss-eap-4.3/jboss-as/server/default/lib/jboss-messaging-client.jar
  | 10:01:38,634 INFO  [STDOUT] ERROR: java.lang.ClassCastException: mail.CustomMessageBean
  | 10:01:38,635 INFO  [WebappClassLoader] Illegal access: this web application instance has been stopped already.  Could not load org.apache.log4j.spi.ThrowableInformation.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
  | java.lang.IllegalStateException
  |         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1244)
  |         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
  |         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
  |         at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:159)
  |         at org.apache.log4j.Category.forcedLog(Category.java:391)
  |         at org.apache.log4j.Category.error(Category.java:322)
  |         at mail.AsyncQueueReceiver.onMessage(AsyncQueueReceiver.java:150)
  |         at org.jboss.jms.client.container.ClientConsumer.callOnMessage(ClientConsumer.java:159)
  |         at org.jboss.jms.client.container.ClientConsumer$ListenerRunner.run(ClientConsumer.java:976)
  |         at org.jboss.messaging.util.JBMExecutor$TCLExecutor.run(JBMExecutor.java:99)
  |         at EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run(QueuedExecutor.java:89)
  |         at java.lang.Thread.run(Thread.java:595)
  | 10:01:38,640 ERROR [ClientConsumer] Failed to deliver message
  | java.lang.NoClassDefFoundError: org/apache/log4j/spi/ThrowableInformation
  |         at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:159)
  |         at org.apache.log4j.Category.forcedLog(Category.java:391)
  |         at org.apache.log4j.Category.error(Category.java:322)
  |         at mail.AsyncQueueReceiver.onMessage(AsyncQueueReceiver.java:150)
  |         at org.jboss.jms.client.container.ClientConsumer.callOnMessage(ClientConsumer.java:159)
  |         at org.jboss.jms.client.container.ClientConsumer$ListenerRunner.run(ClientConsumer.java:976)
  |         at org.jboss.messaging.util.JBMExecutor$TCLExecutor.run(JBMExecutor.java:99)
  |         at EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run(QueuedExecutor.java:89)
  |         at java.lang.Thread.run(Thread.java:595)
  | 

Beside the old error, I also get the error with Log4J :(
It is so strange!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4206763#4206763

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4206763



More information about the jboss-user mailing list