I'm trying to work the example in HeadFirst Java, the advisor one... I'm using the Referece Implementation. 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:000000000000002a524d493a6865616466697273742e416476696365486f6d653a30303030303030303030303030303030000000000000010000000000000188000102000000000c3139322e3136382e322e33000e74000000000056afabcb00000000260000003f00000009533141532d4f5242000000000000000200000008526f6f74504f41000000001237323235353736343933383432343332300000000000000d0100b43c4221000000000001ff0a0000000000070000000100000020000000000001000100000002050100010001002000010109000000010001 01000000002600000002000200000000000300000016000000000000000c3139322e3136382e322e33000eec00000000000300000016000000000000000c3139322e3136382e322e33000f5000000000001f0000000400000003000000200000000400000001000000210000007c000000000000000100000000000000240000001e0000006600000000000000010000000c3139322e3136382e322e33000eec004000000000000000080606678102010101000000170401000806066781020101010000000764656661756c74000400000000000000000000010000000806066781020101010000000f 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])