Owen, Are you sure that you are binding a HashMap object under the jndi name? It looks as though it is a entirely different object. I looked up the javadoc for javax.naming.Reference (the object you're actually getting) and it reads:
"Reference provides a way of recording address information about objects which themselves are not directly bound to the naming/directory system." so it seems that you didn't bind the object properly. Another thought that springs to mind is that a HashMap is not a remote object, and since you appear to be using RMI-IIOP it cannot be directly bound. SO you should either create a RemoteObject that wraps the hashmap, or try to see whether you can get to the data throught the Reference object. e.g. reference.getRefAddr(0).getObject(); (I haven't tried this but it would be the first thing I would try) Good luck, Joost. -----Original Message----- From: Sitepark [mailto:[EMAIL PROTECTED]] Sent: Friday, September 28, 2001 2:34 PM To: [EMAIL PROTECTED] Subject: Re: [JBoss-user] JNDIMapMBean - ClassCastException Hi, thanks for reply. But now I get this exception: Exception in thread "main" java.lang.ClassCastException at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Portable RemoteObject.java:296) at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137) Holger On Fri, 28 Sep 2001 13:37:43 +0200 "Joost v.d. Wijgerd" <[EMAIL PROTECTED]> wrote: > Hi, > > You always want to narrow your objects: > > Object ref = ctx.lookup("inmemory/maps/MapTest"); > > HashMap map = (HashMap) > PortableRemoteObject.narrow(ref, HashMap.class); > > This is because implementations of corba are not required to give you > the object reference directly. > > Hope this helps, > > Joost. > > -----Original Message----- > From: Sitepark [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 28, 2001 1:02 PM > To: [EMAIL PROTECTED] > Subject: [JBoss-user] JNDIMapMBean - ClassCastException > > > Hi, > > I follow the HOWTO to integrate a Custom Service via MBeans. > It work's > > But my Client dont't work. > > I get this exception: > Exception in thread "main" java.lang.ClassCastException: > javax.naming.Reference > > I use this: > InitialContext ctx = new InitialContext(); > HashMap map = (HashMap) ctx.lookup("inmemory/maps/MapTest"); > > Can anyone help? > > Many thanks > > Holger > > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user