I'm trying to work the example in HeadFirst EJB, the Advisor one... I'm using the Referece Implementation (1.4). I compile, package, and deploy happily enough (after a couple of hours searching these archives to discover the need for "Context.INITIAL_CONTEXT_FACTORY" and stuff), but when I try to run the client, I get a class cast exception. This exception is being created by the narrow method itself. I separated out the narrow from the Java-level cast so I could distinguish. The error looks like this:
looking for a Advisor got something back, it's a com.sun.corba.se.internal.iiop.CDRInputStream_1_0 $1:IOR:000000000000002a524d493a6865616466697273742e416476696365486f6d653a303 ...snip snip, lots of boring numbers 01010000000f java.lang.ClassCastException at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow (PortableRemoteObject.java:293) at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134) at AdviceClient.go(AdviceClient.java:26) at AdviceClient.main(AdviceClient.java:10)
The stuff about "Looking for an Advisor" and "got something back, it's a blah blah" are debug messages I added so I could see confidently what the lookup was looking for, and what was returned. I just do a S.o.p on the returned object from the lookup.
As you see, the narrow then explodes, apparently claiming that what the lookup returned can't be turned into an AdviceHome.
Any suggestions? I have undeployed and redeployed till I'm blue in the face, and I'm currently reinstalling the RI from scrach in case there was anything stupid left behind (I tried to use JBoss earlier, but that was awful! [or maybe I just don't understand it])
I see from the archives that this has been asked several times in the past, but there don't seem to be any definitive statements on what fixed it. I've tried the ideas that were hinted at in those discussions, but to no avail. Did those folks just give up, run away, and join the circus instead?
Thanks for any help you can offer, Toby
His brain is the size of a cherry pit! About the size of this ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop