🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7207

ClassCastException that doesn't make sense

#7207
From: Lifeng
Date: Tue, 03 Jul 2001 04:13
21 lines
1805 bytes
I was trying to cast an Object into an sub-class when I got this
ClassCastException. The doc says that you get this exception if you "try
to cast the object into an sub-class of which it is not an instance".
But this is not true in my case. I even "watched" the object in my
JBuilder 4 before it get casted, and it has the right sub-class type. I
am doing the casting from within an EJB, and I get the object from a
serializable List passed to the EJB. Does this has to do with the
Exception I am getting? Below is the code I am using. Could someone
please point out to me what I am doing wrong? Some people said that this
is because

Thank you very much!

Lifeng

***********************************************************
//first get a NewEnrolleeOTW object from a List using a key
Object obj = covotw.get(KEY_REF_MEMBER_OTW);
//Then cast the object into sub-class NewEnrolleeOTW. This is where I
get the ClassCastException
NewEnrolleeOTW neotw = (NewEnrolleeOTW)obj;
Technical Details
Message-ID: <3B414660.789CD256@telocity.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,9bba90999259f167,start
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-07-02 19:15:20 PST
Message-ID: <3B414660.789CD256@telocity.com>
Date: Mon, 02 Jul 2001 21:13:20 -0700
From: Lifeng <lifeng@telocity.com>
X-Mailer: Mozilla 4.5 [en] (Win98; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language
Subject: ClassCastException that doesn't make sense
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 64.195.87.25
X-Trace: dnews 994126174 64.195.87.25 (2 Jul 2001 19:09:34 -0700)
Lines: 27
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews