aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes not able to get ObjectMessage at the JMS listner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "not able to get ObjectMessage at the JMS listner" Watch "not able to get ObjectMessage at the JMS listner" New topic
Author

not able to get ObjectMessage at the JMS listner

ambika mullasseri
Greenhorn

Joined: Jun 01, 2009
Posts: 28
I have 2 different wars,

1. a publisher that publishes Person into a JMS topic




2.a servlet that has a subscriber registered to listner which accepts this data and uses it.

i am able to get the ObjectMessage at the Listner but when i try to typecast it to Person



it says Person cannot be cast to Person...please help


the same code works when both pub and sub are in same war

I am using Jboss 5.0 AS

SCJP 6.0 86%
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

Do you have the latest .class file on the client side? Does this class have a serialVersionUID? Have you by any chance compiled the class on the server side after copying the .class file on to the client?
Please post the exact stack trace.

ram.



ambika mullasseri
Greenhorn

Joined: Jun 01, 2009
Posts: 28
i am totally new to JMS. should i have the compiled class files from publisher in subscriber?
but i also tried creating a jar with the class files can you tell me exactly what to do ?

should i copy paste the .class files from publisher to subscriber?

i tried giving a default serialized version id is that correct?
ambika mullasseri
Greenhorn

Joined: Jun 01, 2009
Posts: 28
Hi Ram

I tried putting a serialized version Id and copying the same class file to the client war.No luck

The stacktrace simply says cannot cast from Person to person. nothing else


12:01:08,430 ERROR [STDERR] java.lang.ClassCastException: Person cannot be cast to Person
12:01:08,430 ERROR [STDERR] at MyListener.onMessage(MyListener.java:56)
12:01:08,430 ERROR [STDERR] at org.jboss.jms.client.container.ClientConsumer.callOnMessage(ClientConsumer.java:229)
12:01:08,430 ERROR [STDERR] at org.jboss.jms.client.container.ClientConsumer$ListenerRunner.run(ClientConsumer.java:1043)
12:01:08,430 ERROR [STDERR] at org.jboss.messaging.util.OrderedExecutorFactory$ChildExecutor.run(OrderedExecutorFactory.java:120)
12:01:08,430 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
12:01:08,430 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
12:01:08,430 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

Hello Ambika,

I guess it's a defect in JBoss implementation when you have Message Listeners in a web application. I googled around for you and there have been others who have reported this issue.

Some relevant links -
http://community.jboss.org/message/204668#204668
http://community.jboss.org/thread/129195.pdf
http://community.jboss.org/message/441475#441475


ram.
ambika mullasseri
Greenhorn

Joined: Jun 01, 2009
Posts: 28
ohh...Thanks a lot...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: not able to get ObjectMessage at the JMS listner