Hi Darya,
I suspect you get a ClassCastException because you probably use the non-
standard (RMI) way of downcasting your remote bean references. The correct
way is to use the 'RMI-over-IIOP' way. This is not related to the discussion
on the (primitive/object) primary key types.
Instead of downcasting the references RMI style:
MyBeanHome home = (MyBeanHome) obj;
MyBean rref = (MyBean) home.create();
you should use the narrow method of a javax.rmi.PortableRemoteObject class:
MyBeanHome home = (MyBeanHome) PortableRemoteObject.
narrow(obj,MyBeanHome.class);
MyBean rref = (MyBean) PortableRemoteObject.
narrow(home.create(),MyBean.class);
Also I suggest you to take a look at the public newsgroups offered by Borland
as they tend to contain invaluable technical information.
rgds,
Petteri
On Tue, 10 Jul 2001 07:41:09 -0700, Darya Said-Akbari <[EMAIL PROTECTED]> wrote:
>Hello Mr. Monson-Haefel,
>
>I did what you said. Trying it with Integer leads
>interestingly to the same result.
>
>So, if someone can give me a hint to get around this
>exception, that I get when running Client_1, please
>let me know. Here is the output from Client_1:
>
>-- Initializing bean access.
>-- Failed initializing bean access.
>java.rmi.ServerException: ; nested exception is:
> java.rmi.RemoteException:
>java.lang.ClassCastException:
>com.inprise.vbroker.rmi.CORBA.ObjectImpl
>java.rmi.RemoteException:
>java.lang.ClassCastException:
>com.inprise.vbroker.rmi.CORBA.ObjectImpl
> at
>com.inprise.vbroker.orb.DelegateImpl.handleReply(DelegateImpl.java:640)
> at
>com.inprise.vbroker.orb.DelegateImpl.invoke(DelegateImpl.java:552)
> at
>org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:294)
> at
>com.titan.cruisecabin._CabinHome_Stub.create(_CabinHome_Stub.java:87)
> at
>com.titan.cruisecabin.Client_1.<init>(Client_1.java:34)
> at
>com.titan.cruisecabin.Client_1.main(Client_1.java:385)
>
>
>
>
>
>--- Richard Monson-Haefel <[EMAIL PROTECTED]>
>wrote:
>> Hi,
>>
>> Literally tens of thousands of people have run the
>> examples in the book with
>> out a problem. It must be a limitation of your tools
>> and or server. You can
>> change your examples to use Integer if that works
>> better with your tool.
>>
>> Note: In the 3rd Edition of the book
>> (http://oreilly.techrev.org/) I also use
>> single-field primary keys a lot since that seems to
>> be easier for people new to
>> EJB. However, compound primary keys are still
>> valuable in many cases.
>>
>> Thanks!
>>
>> Richard
>> --
>> Richard Monson-Haefel
>> Author of Enterprise JavaBeans, 2nd Edition
>> (O'Reilly 2000)
>> Co-Author of Java Message Service (O'Reilly 2000)
>> http://www.jMiddleware.com
>>
>> Darya Said-Akbari wrote:
>>
>> > Hi,
>> >
>> > I wonder that anybody could run the Cabin example
>> from
>> > chapter 4 of Richard Monson-Haefel EJB book.
>> >
>> > In the CabinPK class he use 'int' instead of
>> 'Integer'
>> > for declaration. Shouldn't it be 'Integer' since
>> > CabinPK implements the Serializable interface?
>> >
>> > When you try it opposite, to model your Cabin EJB
>> > begining with your Database table CABIN, then the
>> > JBuilder4 wizard only use Integer instead of int.
>> >
>> > If anyone could run the example like given in the
>> > book,
>> > please let me know.
>> >
>> > Best regards,
>> > Darya
>> >
>> > __________________________________________________
>> > Do You Yahoo!?
>> > Get personalized email addresses from Yahoo! Mail
>> > http://personal.mail.yahoo.com/
>> >
>> >
>>
> ==========================================================================
>> > 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".
>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Get personalized email addresses from Yahoo! Mail
>http://personal.mail.yahoo.com/
>
> ==========================================================================
>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".