SureshBeanHome is my home interface and the proper way to downcast after EJB1.1 spec is by using the PortableRemoteObject.
Did anyone face this kind of problem before? /Suresh -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 13, 2003 9:11 AM To: Suresh Babu Koya Subject: Re: ClassCastException after narrow I think u should cast ref to Home before a call to javax.rmi.PortableRemoteObject.narrow Suresh Babu Koya <[EMAIL PROTECTED] To: [EMAIL PROTECTED] N> cc: Sent by: A Subject: Re: ClassCastException after narrow mailing list for Enterprise JavaBeans development <[EMAIL PROTECTED] A.SUN.COM> 12/05/2003 06:36 PM Please respond to Suresh Babu Koya I did extend EJBHome. Here is the code of my Home interface: package sessionbean; import javax.ejb.EJBHome; import java.rmi.RemoteException; import javax.ejb.CreateException; public interface SureshBeanHome extends EJBHome { public SureshSession create() throws CreateException,RemoteException; } /Suresh IBM Certified in OOAD with UML Sr. Developer Quark -----Original Message----- From: Suryanarayanan V [mailto:[EMAIL PROTECTED] Sent: Monday, May 12, 2003 4:43 PM To: [EMAIL PROTECTED] Subject: Re: ClassCastException after narrow U check ur Home class. I think u have not extend the EJBHome Interface. Check it. Suriya ____________________________________________ Teradyne IDC HCL Technologies LTD Chennai, India [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> I want to be what I was when I wanted to be what I am now. ____________________________________________ -----Original Message----- From: A mailing list for Enterprise JavaBeans development [mailto:[EMAIL PROTECTED] Behalf Of Suresh Babu Koya Sent: Monday, May 12, 2003 12:16 PM To: [EMAIL PROTECTED] Subject: FW: ClassCastException after narrow My program did not reach till that point. I am getting an error at line no. 4 where I am casting the remote reference to the Home interface. "SureshSession" is the remote interface of a stateless session bean. /Suresh -----Original Message----- From: Rajesh S R [mailto:[EMAIL PROTECTED] Sent: Monday, May 12, 2003 11:53 AM To: 'Suresh Babu Koya' Subject: RE: ClassCastException after narrow The create method returns the remote interface, not the bean class.... >>SureshSession s = (SureshSession)sess.create(); >>and bean class name is SureshSession. Cast the return type of the create method to remote interface. -----Original Message----- From: Suresh Babu Koya [mailto:[EMAIL PROTECTED] Sent: Monday, May 12, 2003 11:44 AM To: [EMAIL PROTECTED] Subject: ClassCastException after narrow Hi friends, I started doing my first exercises on EJB. I am working on Sun One App Server7.0. Till deployment there was no problem but when I executed the client, I get a class cast exception at line 4. I am going by book according to the manuals that Sun has provided. I am running my client from jBuilder with the EJB2.0 jar in the classpath I downloaded from sun site. My home class name is SureshBeanHome and bean class name is SureshSession. Could anyone give a hint of what could be wrong???? 1 InitialContext jndiContext = new javax.naming.InitialContext(env); 2 Object ref = jndiContext.lookup("SayHello"); 3 System.out.println("ref is " + ref); 4 SureshBeanHome sess = (SureshBeanHome)javax.rmi.PortableRemoteObject.narrow(ref,SureshBeanHome.cla ss); 5 SureshSession s = (SureshSession)sess.create(); 6 System.out.println("Server said " + s.sayHello("Suresh")); /Suresh IBM Certified in OOAD with UML Sr. Developer Quark =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". DISCLAIMER: Information contained and transmitted by this E-MAIL is proprietary to Mascot Systems Limited and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If this is a forwarded message, the content of this E-MAIL may not have been sent with the authority of the Company. If you are not the intended recipient, an agent of the intended recipient or a person responsible for delivering the information to the named recipient, you are notified that any use, distribution, transmission, printing, copying or dissemination of this information in any way or in any manner is strictly prohibited. If you have received this communication in error, please delete this mail & notify us immediately at [EMAIL PROTECTED] Before opening attachments, please scan for viruses. =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
