2 Replies Latest reply on Mar 11, 2006 1:59 AM by mandersen94

    java.lang.ClassCastException while using RMI-IIOP in test cl

    joeriklekamp

      G'day,

      I'm trying to run a EJB test client via RMI-IIOP, i followed the instructions found on this site to override the standard invoker in the Jboss.xml file of the session bean I want to approach.

      The lookup of the home reference is fine, e.g.
      Object o = ctx.lookup("ejb/EmployeeManagerSession");

      but when I try to 'narrow '
      the object to the home interface I get a ClassCastException.

      EmployeeManagerSessionHome intf = (EmployeeManagerSessionHome) PortableRemoteObject.narrow( o, EmployeeManagerSessionHome.class);


      I looked a bit further and noticed that the
      result = Utility.loadStub(narrowObj,narrowTo); function is returning 'null', apparently there is no stub available for my home interface. I was under the impresion that the server is taking care of the stub generation at deploytime, do I have to configure something on the server first to enable this?

      I aslo ran the iiop-test from the 'testsuite', they are working fine. i tried to figure out what is being done differently here (comparing classpath, propertie files etc. ), but since this test configuration is quite complex I didnt manage yet, does anybody have a clue what I am missing?

      Btw, I get the foolwing excpetion each time I run my test client

      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 nl.technolution.tpts.testapp.TestEmployeeManager.getHome(TestEmployeeManager.java:82)
      at nl.technolution.tpts.testapp.TestEmployeeManager.setUp(TestEmployeeManager.java:92)
      at junit.framework.TestCase.runBare(TestCase.java:125)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)

      thx in advance, Joeri Klekamp

        • 1. java.lang.ClassCastException while using RMI-IIOP in test cl
          ivanneto

          G'day,

          I'm trying to run a EJB test client via RMI-IIOP, i followed the instructions found on this site to override the standard invoker in the Jboss.xml file of the session bean I want to approach.

          The lookup of the home reference is fine, e.g.
          Object o = ctx.lookup("ejb/EmployeeManagerSession");

          but when I try to 'narrow '
          the object to the home interface I get a ClassCastException.

          EmployeeManagerSessionHome intf = (EmployeeManagerSessionHome) PortableRemoteObject.narrow( o, EmployeeManagerSessionHome.class);


          I looked a bit further and noticed that the
          result = Utility.loadStub(narrowObj,narrowTo); function is returning 'null', apparently there is no stub available for my home interface. I was under the impresion that the server is taking care of the stub generation at deploytime, do I have to configure something on the server first to enable this?

          I aslo ran the iiop-test from the 'testsuite', they are working fine. i tried to figure out what is being done differently here (comparing classpath, propertie files etc. ), but since this test configuration is quite complex I didnt manage yet, does anybody have a clue what I am missing?

          Btw, I get the foolwing excpetion each time I run my test client

          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 nl.technolution.tpts.testapp.TestEmployeeManager.getHome(TestEmployeeManager.java:82)
          at nl.technolution.tpts.testapp.TestEmployeeManager.setUp(TestEmployeeManager.java:92)
          at junit.framework.TestCase.runBare(TestCase.java:125)
          at junit.framework.TestResult$1.protect(TestResult.java:106)
          at junit.framework.TestResult.runProtected(TestResult.java:124)
          at junit.framework.TestResult.run(TestResult.java:109)
          at junit.framework.TestCase.run(TestCase.java:118)
          at junit.framework.TestSuite.runTest(TestSuite.java:208)
          at junit.framework.TestSuite.run(TestSuite.java:203)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)

          thx in advance, Joeri Klekamp

          • 2. Re: java.lang.ClassCastException while using RMI-IIOP in tes
            mandersen94

            I'm getting this same error. Was there any resolution to this?