• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Himai Minh

P.R.O.narrow throws ClassCastException

Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic