3 Replies Latest reply on Oct 16, 2002 10:14 AM by Mark Bellehumeur

    ClassCastException RMI/IIOP

    Mark Bellehumeur Newbie

      Does anyone have any idea what is the cause of a ClassCastException when using a PortableRemoteObject.narrow()?

      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 helloiiop.test.HelloTimingStressTestCase.testHello(HelloTimingStressTestCase.java:31)
      at helloiiop.test.HelloTimingStressTestCase.main(HelloTimingStressTestCase.java:16)


      ------Code Snipet--------
      InitialContext ctx = new InitialContext();
      HelloHome home =
      (HelloHome)PortableRemoteObject.narrow(
      ctx.lookup
      HelloHome.JNDI_NAME),
      HelloHome.class);
      Hello hello = home.create();
      System.out.println( hello.hello("World") );
      hello.remove();
      ------Code Snipet--------

      This is the example helloiiop provided minus the junit stuff (the example does not work either)

      Is there a configuration on the machine or a jvm arg I'm missing?
      I'm using Windows NT with jdk1.4.

      Does anyone know the minimum number of client jars required to run a IIOP client?

      -Mark

        • 1. Re: ClassCastException RMI/IIOP
          Mark Bellehumeur Newbie

          Well after a few hours of poking and experimenting the answer seems to be in the jvm args passed. Of course this is quite undocumented.
          Hopefully this response will help someone else who has run up against a similiar problem. In addition to these jvms args

          java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory java.naming.provider.url=IOR:...some_long_string_of_hex_digits...

          I also was *required* to have these:
          set JAVA_OPTS=%JAVA_OPTS% -Djava.security.manager
          set JAVA_OPTS=%JAVA_OPTS% -Djava.security.policy=%CLIENT_LIBS_DIR%/client.policy

          Also, I was able to run a remote IIOP client with only the necessary interfaces for my bean and the jboss-j2ee.jar (for a stateless bean passing primitive types)



          • 2. Re: ClassCastException RMI/IIOP
            Mark Bellehumeur Newbie

            Well after a few hours of poking and experimenting the answer seems to be in the jvm args passed. Of course this is quite undocumented.
            Hopefully this response will help someone else who has run up against a similiar problem. In addition to these jvms args

            java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory java.naming.provider.url=IOR:...some_long_string_of_hex_digits...

            I also was *required* to have these:
            set JAVA_OPTS=%JAVA_OPTS% -Djava.security.manager
            set JAVA_OPTS=%JAVA_OPTS% -Djava.security.policy=%CLIENT_LIBS_DIR%/client.policy

            Also, I was able to run a remote IIOP client with only the necessary interfaces for my bean and the jboss-j2ee.jar (for a stateless bean passing primitive types)

            • 3. Re: ClassCastException RMI/IIOP
              Mark Bellehumeur Newbie

              Hopefully this response will help someone else who has run up against a similiar problem. In addition to these jvms args

              java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory java.naming.provider.url=IOR:...some_long_string_of_hex_digits...

              I also was *required* to have these:
              set JAVA_OPTS=%JAVA_OPTS% -Djava.security.manager
              set JAVA_OPTS=%JAVA_OPTS% -Djava.security.policy=%CLIENT_LIBS_DIR%/client.policy

              Also, I was able to run a remote IIOP client with only the necessary interfaces for my bean and the jboss-j2ee.jar (for a stateless bean passing primitive types)