🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ClassCastException

#7579
From: Michael Rachow
Date: Sun, 10 Jun 2001 10:04
33 lines
2081 bytes
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: <3b2345b6$1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3b214690$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-10 03:10:48 PST
From: "Michael Rachow" <michael@famrachow.de>
Newsgroups: borland.public.jbuilder.java.language
References: <3b214690$1_1@dnews>
Subject: Re: ClassCastException
Date: Sun, 10 Jun 2001 12:04:58 +0200
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
NNTP-Posting-Host: 217.227.19.142
Message-ID: <3b2345b6$1_1@dnews>
X-Trace: dnews 992167350 217.227.19.142 (10 Jun 2001 03:02:30 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews