ejb@glassfish.java.net

[Fwd: [Issue 193] enum unmarshalling creates new instance of the value]

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Fri, 24 Feb 2006 22:10:16 +0530

Hi Ken,

Would you mind taking a look at this issue? I have attached the actual
test cases (ear as well as war files). I don't understand why there is a
difference in behavior.

Thanks,
Sahoo

attached mail follows:



https://glassfish.dev.java.net/issues/show_bug.cgi?id=193



User ss141213 changed the following:

                What |Old value |New value
================================================================================
                  Status|NEW |STARTED
--------------------------------------------------------------------------------




------- Additional comments from ss141213_at_dev.java.net Fri Feb 24 16:33:49 +0000 2006 -------
I tried two different things:
1. servlet and ejb were part of the same ear file as follows:
app.ear
    web.war (contains TheServlet.class, Bean.class, TheEnum.class)
    ejb.jar (contains Bean.class, TheBean.class, TheEnum.class)

In this case, when I accessed the servlet, response was:

It is a GRAPE.

This is what you expected, right?

2. servlet was deployed as a standalone web module and ejb was deployed as a
standalone ejb module.
Basically, I deployed web.war and ejb.jar separately.
In this case, when I accessed the servlet, response was:

It is not a GRAPE.

This is what you are observing.

Question is, are you doing #1 or #2? I guess, you are doing #2. In this case I
am suspecting something like this is happenning:
Since Servlet and the session bean have been deployed as two stand alone
modules, they will be using two different class loaders. When the servlet is
sending the TheEnum object it is getting the serialized. During serialization in
the ejb end, a new object of type TheEnum is being created. This object has a
different object reference from the enum constants defined in TheEnum class. So
you are seeing == returning false.

I am also surprised to see a different result for case #1 & 2. In case #1 also,
serialization and deserialization has to happen. I will follow it up with folks
that work in this layer and update this issue.

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: issues-help_at_glassfish.dev.java.net