Bugs item #789318, was opened at 2003-08-15 10:56
Message generated for change (Comment added) made by greenfuzz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=789318&group_id=22866

Category: JBossMX
Group: v3.2
Status: Open
Resolution: None
Priority: 7
Submitted By: Mike Osganian (osganian)
Assigned to: Nobody/Anonymous (nobody)
Summary: ObjectMessage.getObject() doesn't work in JBoss 3.2.1

Initial Comment:
Attached is a zip file containing a simple example of the 
problem.  The problem is simple.  I have an object that i 
wrap in an ObjectMessage and send that message to a 
JMS queue.  My message driven bean receives this 
message and tests to see what type of object the 
wrapped object is.  In a simple case (the wrapped 
object just implements java.io.Serializable) it works.  But 
when the wrapped object extends an Object that 
extends java.util.EventObject (which implements 
java.io.Serializable) the Message Driven bean doesn't 
determine the type of the wrapped object correctly.  
Even if I explicitly define Object2 and/or Object3 as 
implementing java.io.Serializable it still doesn't work.

The attached zip file shows the problem.  I am wrapping 
up a message of type Object1 and Object3.  When the 
message driven bean recieves theses messages it sees 
Object1 as Object1 but it sees Object3 as Object2 EVEN 
through the classname is Object3.

OS: Windows XP
JDK version: 1.4.2
JBoss version: 3.2.1 (with Tomcat 4.1.24)

Console Output (server.log is also bundled in the 
attached zip file):

...
11:28:22,019 INFO  [Server] JBoss (MX MicroKernel) 
[3.2.1 (build: CVSTag=JBoss_3
_2_1 date=200305041533)] Started in 21s:389ms
10:16:28,995 WARN  [ClassLoadingTask] Duplicate class 
found: bug.Object3
Current CS: (file:/C:/jboss-
3.2.1/server/default/tmp/deploy/server/default/deploy/bu
g.jar/44.bug.jar <no certificates>)
Duplicate CS: (file:/C:/jboss-
3.2.1/server/default/deploy/bug.jar <no certificates>)
11:29:23,542 INFO  [STDOUT] .
11:29:23,552 INFO  [STDOUT] Instance of OBJECT 2: 
Object #3
11:29:23,552 INFO  [STDOUT] Classes Equal: false
11:29:23,552 INFO  [STDOUT] OBJECT CLASS: 'class 
bug.Object3'
11:29:23,552 INFO  [STDOUT] OBJECT CLASS 
NAME: 'bug.Object3'
11:29:23,552 INFO  [STDOUT] OBJECT's SUPER: 'class 
bug.Object2'
11:29:23,502 INFO  [STDOUT] .
11:29:23,512 INFO  [STDOUT] Instance of OBJECT 1: 
Object #1
11:29:23,512 INFO  [STDOUT] Classes Equal: true
11:29:23,522 INFO  [STDOUT] OBJECT CLASS: 'class 
bug.Object1'
11:29:23,522 INFO  [STDOUT] OBJECT CLASS 
NAME: 'bug.Object1'
11:29:23,522 INFO  [STDOUT] OBJECT's SUPER: 'class 
java.util.EventObject'

To run the test is simple.  I provided a build script and a 
run script.  You might need to update some paths to 
your jboss deploy directory so the scripts will work.


----------------------------------------------------------------------

Comment By: Chris Klumb (greenfuzz)
Date: 2003-08-18 11:32

Message:
Logged In: YES 
user_id=846089

Your welcome.

The forums is a better place for this discussion.

I think the problem is caused because when you deploy your 
jboss-service.xml, you are telling JBoss to load the jar twice.

It seems that JBoss is smart enough to create the queue for 
the MDB.  However, if you want to configure the queue use: 
deploy/jms/jbossmq-destinations-service.xml or the console.

I don't think the JMX NotificationListener interface is going to 
work on the MDB due to the lifecycle of MDB.  I could be 
wrong though, so ask in the forums.  People there can help.

Buy the server documentation, if you haven't already.  It is 
really great and only $10.

I think this issue should be closed.  Do you agree?


----------------------------------------------------------------------

Comment By: Mike Osganian (osganian)
Date: 2003-08-18 11:02

Message:
Logged In: YES 
user_id=845326

Thanks for your response!  If I don't deploy the jboss-
service.xml file where do I specify my MBeans, Queues, etc?

What is the point of the jboss-service.xml file if it shouldn't be 
deployed?

Still seems like a problem if I deploy that file and JBoss 
doesn't recognize a class correctly and generates warnings 
about duplicate classes found.


----------------------------------------------------------------------

Comment By: Chris Klumb (greenfuzz)
Date: 2003-08-18 08:16

Message:
Logged In: YES 
user_id=846089

Ok, I see.  The first if should catch Object 3.

I ran your test using CVS branch 3.2.2.  Also, I did not deploy 
your jboss-service.xml.  I don't have the same problem.  The 
first if catchs Object3:

11:29:23,552 INFO [STDOUT] Instance of OBJECT 3: 
Object #3
11:29:23,552 INFO [STDOUT] Classes Equal: true

I suspect you have a classloading problem.  You are getting 
the warning:

10:16:28,995 WARN [ClassLoadingTask] Duplicate class 
found: bug.Object3

This seems to be a configuration problem, not a bug. Try 
running without deploying your jboss-service.xml.


----------------------------------------------------------------------

Comment By: Mike Osganian (osganian)
Date: 2003-08-18 06:21

Message:
Logged In: YES 
user_id=845326

Right but if you look at the example code the first IF condition 
check is if its an instance of Object3.  It passes by that 
check as FALSE and then tests TRUE for instance of 
Object2.  Of course its an instance of Object2 BUT it should 
be an instance of Object3 first since that is the first check.  
If I print out the class and class name it says its Object3 but 
if I try to cast it to Object3 or do an instanceof check on it, 
it will either throw a ClassCastException or return FALSE.

Seems to be something wrong with JBoss.  If I change the 
example to have my object not extend any other object just 
implement Serializable then everything works.  But why if I 
have my object extend an object (that implements 
Serializable) it doesn't work?


----------------------------------------------------------------------

Comment By: Chris Klumb (greenfuzz)
Date: 2003-08-17 22:08

Message:
Logged In: YES 
user_id=846089

Object3, being a subclass of Object2, is an instanceof 
Object2.  If you want the exact class use getClass().

Am I missing something here?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=789318&group_id=22866


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to