🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ClassCastException

#7584
From: ct
Date: Mon, 11 Jun 2001 13:09
55 lines
2519 bytes

It is kind of hard to draw diagram.
I hope these statements below will help,

public class SigninHandler extends StateHandlerSupport;

public class StateHandlerSupport implements java.io.Serializable, StateHandler;

public interface StateHandler;

These three classes are all in the same package.
Actually they are similar to sun's j2ee blue print
petstore demo application.

thanks!

ct

"Michael Rachow" <michael@famrachow.de> wrote:
>Could you please show us the class hierachy
>of SigninHandler and StateHandler
>(how they are related in class tree)?!
>Michael
>Object o = c1.newInstance();
>    System.out.println("StateMachine: o = " + (SigninHandler)o);
>    handler = (StateHandler)o;  // exception throws
>
>ct <cctang@yahoo.com> schrieb in im Newsbeitrag: 3b214690$1_1@dnews...
>>
>> I had a problem with the following codes, which are called
>> in ejb component in app server.
>> StateHandler is interface and SigninHandler implements it.
>> If I include the line with System.out.println(), it will run OK.
>> But if I comment out System.out.println(), a
>> ClassCastException error will be throwed in the next line
>> (handler = (StateHandler)o),
>>
>>     Class c1 = Class.forName(handlerName);
>>     Object o = c1.newInstance();
>>     System.out.println("StateMachine: o = " + (SigninHandler)o);
>>     handler = (StateHandler)o;  // exception throws
>>
>> I am running jbuild4.0 Enterprise version.  My OS is NT4.0
>> I had created an small test program to test these pieces of
>> codes and used the same classpath used by appserver.  It works
>> regardless the println statement.
>>
>> Any help is welcomed.
>>
>> thanks!
>>
>> ct
>
>
Technical Details
Message-ID: <3b24c313$1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3b214690$1_1@dnews> <3b2345b6$1_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,8a0377b4254bc1e1
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-11 06:14:51 PST
From: "ct" <cctang@yahoo.com>
Sender: "ct" <cctang@yahoo.com>
Reply-To: "ct" <cctang@yahoo.com>
Subject: Re: ClassCastException
Newsgroups: borland.public.jbuilder.java.language
X-User-Info: 206.30.165.9 206.30.165.9    
References: <3b214690$1_1@dnews>  <3b2345b6$1_1@dnews> 
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3b24c313$1_1@dnews>
Date: 11 Jun 2001 06:09:39 -0700
X-Trace: dnews 992264979 207.105.83.65 (11 Jun 2001 06:09:39 -0700)
Lines: 56
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews