4 Replies Latest reply on Aug 3, 2005 2:08 AM by bmhardy

    ClassCastException when trying to cast naming reference to s

    bmhardy Newbie

      Hello. I'm trying to access an session bean written with ejb3.0 from an applet. Can any one tell me why I get a ClassCastException when trying to cast the naming reference to my session bean?

      Here's the exception thrown:

      java.lang.ClassCastException: javax.naming.Reference
      at sample.applet.AsyncEngine.init(AsyncEngine.java:43)
      at sun.applet.AppletPanel.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

      Here is the code I'm using to get a handle to the session bean:

      jndiProps.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      jndiProps.setProperty("java.naming.provider.url", myServer);
      jndiProps.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      InitialContext ctx = new InitialContext(jndiProps);
      autoMgr = (AutomobileMgr)ctx.lookup(AutomobileMgr.class.getName());

      Any idea on how to fix this problem?
      Thank you very much.

      Brian