ClassCastException in stateless session bean using j2sdkee1.3.1

Jitesh Sinha <[email protected]> Wed, 3 Jul 2002 14:53:52 +0530
Newsgroups gmane.comp.windows.devel.java.general
Message-ID <006c01c22273$597c7fb0$6e3c4c0a@37P5N728HPV>
Hello folks,

I have written a simple stateless session bean supposed to display 'Hello
World' at the console when called by client .I am using jdk1.3.1_03 and
j2sdkee1.3.1.
I can deploy the bean using J2EE RI successfully .When I write a client and
call the bean I get following exception :

Exception in thread "main" java.lang.ClassCastException
        at
com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Unknown
Source)
        at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
        at examples.HelloClient.main(HelloClient.java:25)

The source code which is causing this error is :

        Context ctx = new InitialContext(props) ;

        Object obj = ctx.lookup("ejb/Hello") ;

        HelloHome home = null ;

        HelloHome home  =
(HelloHome)javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class) ;

The error points to the last line . I have included '.' in my classpath and
running the client from the command prompt from the root directory of the
bean package .
I have started the j2ee server and deploytool from the same directory by
opening different DOS windows .

Please help me .


Thanks,
Jitesh

You can read messages from the JAVA archive, unsubscribe from JAVA,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.