Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

NotSerializableException

2 views
Skip to first unread message

Gregg McMullin

unread,
Jan 21, 2002, 1:31:09 PM1/21/02
to
I am running WL 6.1 and get the following error when running my servlet. Note: The same servlet runs fine on WebSphere and SilverStream. Thanks in advance for any suggestions.

-Gregg-

java.io.NotSerializableException: com.sssw.fw.core.EboWhiteboardEraser
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at java.util.Hashtable.writeObject(Hashtable.java:757)
at java.lang.reflect.Method.invoke(Native Method)
at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java
:1864)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1210)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper
.java:70)
at weblogic.servlet.internal.session.SessionData.getAttribute(SessionDat
a.java:318)

Dimitri Rakitine

unread,
Jan 21, 2002, 5:33:11 PM1/21/02
to
Did you check if the object you put into the session has
any non-serializable fields in it (It sounds like the hashtable in your
session object contains com.sssw.fw.core.EboWhiteboardEraser, which is not
serializable) ?

I had a similar exception, and, it appears, that even without clustering,
WebLogic serializes/deserializes objects in session (probably in attempt to
solve ClassCastException's when classes/servlets are changed. In my case
exception looked like this (and only happened after I recompiled the servlet
class, and WebLogic reloaded changed servlet) :

java.io.NotSerializableException: test.MyCounter


at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)

at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1827)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:92)
at weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:64)
at weblogic.servlet.internal.session.SessionData.getAttribute(SessionData.java:384)
at weblogic.servlet.internal.session.SessionData.setAttribute(SessionData.java:449)
at test.CounterServlet.service(FooServlet.java:16)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

> -Gregg-

--
Dimitri

Cameron Purdy

unread,
Jan 21, 2002, 5:37:24 PM1/21/02
to
Hi Gregg,

If you look at com.sssw.fw.core.EboWhiteboardEraser, is it Serializable?

It appears that you have placed an instance of this into the HttpSession
object, so it is subject to replication. I don't know if you ran this a
clustered (or if you did so with WebSphere or SilverStream) but items placed
into HttpSession should be Serializable. From the spec:

SRV.7.7.2 Distributed Environments
...
The servlet container may throw an IllegalArgumentException if an object is
placed into the session that is not Serializable or for which specific
support has
not been made available. The IllegalArgumentException must be thrown for
objects where the container cannot support the mechanism necessary for
migration of a session storing them.

Note that Weblogic is allowing the raw exception to get back to you, instead
of throwing the exception specified in the standard. That's what we call a
"feature" ;-)

Peace,

--
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/

"Gregg McMullin" <gmcm...@silverstream.com> wrote in message
news:3c4c5e6d$2...@newsgroups.bea.com...

Gregg McMullin

unread,
Jan 22, 2002, 10:30:05 AM1/22/02
to
Thanks... The object does in fact have a non-serializable field in it. I
did not realize that it was a requirement that only serializable fields
could be put into the session. Is this True or is it a constrait on
WebLogic? Thanks Gregg
"Dimitri Rakitine" <d...@dima.dhs.org> wrote in message
news:3c4c...@newsgroups.bea.com...

Gregg McMullin

unread,
Jan 22, 2002, 10:36:19 AM1/22/02
to
Thanks... no the object does have a non-serializable field. I was not
running in a clustered environment. Will investigate further... Thanks
again
"Cameron Purdy" <cpu...@tangosol.com> wrote in message
news:3c4c...@newsgroups.bea.com...

Cameron Purdy

unread,
Jan 22, 2002, 10:58:47 AM1/22/02
to
Dimitri did some investigation and it appears that WL always serializes to
avoid / solve some other potential problems.

Peace,

--
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/

"Gregg McMullin" <gmcm...@silverstream.com> wrote in message

news:3c4d884e$1...@newsgroups.bea.com...

Gregg McMullin

unread,
Jan 22, 2002, 11:05:51 AM1/22/02
to
Thanks... forgive me but I'm still a bit confused about this issue. Is
this an issue/concern that WL always serializes? Is it specific to WL that
all objects on the session must be serializable? This seems odd. Is the
specification you sited the Servlet spec? Thanks again for your
responses.

-Gregg-

"Cameron Purdy" <cpu...@tangosol.com> wrote in message

news:3c4d8b81$2...@newsgroups.bea.com...

Cameron Purdy

unread,
Jan 22, 2002, 1:18:12 PM1/22/02
to
> Thanks... forgive me but I'm still a bit confused about this issue. Is
> this an issue/concern that WL always serializes? Is it specific to WL
that
> all objects on the session must be serializable? This seems odd. Is the
> specification you sited the Servlet spec? Thanks again for your
> responses.

Yes, that was the servlet spec.

No, it isn't a concern. Just make your objects that go into the session
serializable.

--
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/

"Gregg McMullin" <gmcm...@silverstream.com> wrote in message

news:3c4d8f3b$1...@newsgroups.bea.com...
> ...


Dimitri Rakitine

unread,
Jan 22, 2002, 1:28:40 PM1/22/02
to
Not always (that will be nasty), but when classes are changed/reloaded.

> Peace,

--
Dimitri

0 new messages