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

Category: JBossMX
Group: v3.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Mike Osganian (osganian)
Assigned to: Scott M Stark (starksm)
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: Scott M Stark (starksm)
Date: 2003-10-13 05:51

Message:
Logged In: YES 
user_id=175228

I don't see this problem in 3.2.2 and there is no duplicate
class warning.

05:44:40,549 INFO  [MainDeployer] Deployed package:
file:/C:/cvs/JBoss3.2/jboss-
3.2/build/output/jboss-3.2.2RC5/server/default/deploy/bug.jar
05:45:00,647 INFO  [MainDeployer] Starting deployment of
package: file:/C:/cvs/J
Boss3.2/jboss-3.2/build/output/jboss-3.2.2RC5/server/default/deploy/jboss-servic
e.xml
05:45:00,718 INFO  [MainDeployer] Deployed package:
file:/C:/cvs/JBoss3.2/jboss-
3.2/build/output/jboss-3.2.2RC5/server/default/deploy/jboss-service.xml
05:48:42,647 ERROR [STDERR] Oct 13, 2003 5:48:42 AM bug.MDB
ejbCreate
INFO: MDB Created.
05:48:42,647 ERROR [STDERR] Oct 13, 2003 5:48:42 AM bug.MDB
ejbCreate
INFO: MDB Created.
05:48:42,647 INFO  [STDOUT] .
05:48:42,667 INFO  [STDOUT] Instance of OBJECT 3: Object #3
05:48:42,667 INFO  [STDOUT] Classes Equal: true
05:48:42,667 INFO  [STDOUT] OBJECT CLASS: 'class bug.Object3'
05:48:42,667 INFO  [STDOUT] OBJECT CLASS NAME: 'bug.Object3'
05:48:42,667 INFO  [STDOUT] OBJECT's SUPER: 'class bug.Object2'
05:48:42,677 INFO  [STDOUT] .
05:48:42,687 INFO  [STDOUT] Instance of OBJECT 1: Object #1
05:48:42,687 INFO  [STDOUT] Classes Equal: true
05:48:42,687 INFO  [STDOUT] OBJECT CLASS: 'class bug.Object1'
05:48:42,687 INFO  [STDOUT] OBJECT CLASS NAME: 'bug.Object1'
05:48:42,687 INFO  [STDOUT] OBJECT's SUPER: 'class
java.util.EventObject'

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

Comment By: Adrian Brock (ejort)
Date: 2003-08-18 16:31

Message:
Logged In: YES 
user_id=9459

This is a bug.

It should either throw an error saying bug.jar is already
deployed
or ignore your request to deploy the jar twice.

To fix your specific problem, just put jboss-service.xml
(without
the classpath element) inside the jar .
Jboss will deploy the queue using the russian doll
deployment rules.

Regards,
Adrian

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

Comment By: Chris Klumb (greenfuzz)
Date: 2003-08-18 09: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 09: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 06: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 04: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 20: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 is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to