• Post Reply Bookmark Topic Watch Topic
  • New Topic

P.R.O.narrow throws ClassCastException  RSS feed

Toby Eggitt
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
...snip snip, lots of boring numbers
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow
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,
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!