1 Reply Latest reply on Jul 8, 2007 7:03 PM by Katherine Youngblood

    ClassCastException with iiop

    Katherine Youngblood Newbie

      When I use jnp - everything is fine, no ClassCastException when accessing the eJB I deployed on Jboss 4.01. However, when I set up the bean to use iiop (updating the jboss.xml and deploying on the server config all), I get a ClassCastException on the PortableRemoteObject.narrow method.

      I have my EJB deployed on JBoss 4.01.

      I can a WEB Application running inside Jdeveloper on OC4J application server. I don't think that my remote EJB is deployed on the OC4J. I have read the wiki on ClassCastException. Here is my dump from the JMX console

      com.infomanager.ejb.userindex.UserIndexBean Information
      Repository cache version:
      com.infomanager.ejb.userindex.UserIndexBean(1e84ff1).ClassLoader=org.jboss.mx.loading.UnifiedClassLoader3@945d2d{ url=file:/C:/Development/jboss-4.0.2/server/all/tmp/deploy/tmp43145UserIndexEAR.ear ,addedOrder=39}
      ..org.jboss.mx.loading.UnifiedClassLoader3@945d2d{ url=file:/C:/Development/jboss-4.0.2/server/all/tmp/deploy/tmp43145UserIndexEAR.ear ,addedOrder=39}
      ....file:/C:/Development/jboss-4.0.2/server/all/tmp/deploy/tmp43145UserIndexEAR.ear
      ....file:/C:/Development/jboss-4.0.2/server/all/tmp/deploy/tmp43145UserIndexEAR.ear-contents/UserIndexEJB.jar
      ....file:/C:/Development/jboss-4.0.2/server/all/tmp/deploy/tmp43145UserIndexEAR.ear-contents/RazorSourceCommon.jar
      ....file:/C:/Development/jboss-4.0.2/server/all/tmp/deploy/tmp43145UserIndexEAR.ear-contents/WebAdviser.jar
      ....file:/C:/Development/jboss-4.0.2/server/all/tmp/deploy/tmp43145UserIndexEAR.ear-contents/jt400.jar
      ..org.jboss.system.server.NoAnnotationURLClassLoader@1f6f296
      ..sun.misc.Launcher$AppClassLoader@a39137
      ....file:/C:/Development/jboss-4.0.2/bin/run.jar
      ..sun.misc.Launcher$ExtClassLoader@92e78c
      ....file:/C:/Program%20Files/Java/jre1.5.0_10/lib/ext/dnsns.jar
      ....file:/C:/Program%20Files/Java/jre1.5.0_10/lib/ext/sunjce_provider.jar
      ....file:/C:/Program%20Files/Java/jre1.5.0_10/lib/ext/sunpkcs11.jar
      ++++CodeSource: (file:/C:/Development/jboss-4.0.2/server/all/tmp/deploy/tmp43145UserIndexEAR.ear-contents/UserIndexEJB.jar )
      Implemented Interfaces:
      ++interface javax.ejb.SessionBean(1464fee)
      ++++ClassLoader: org.jboss.mx.loading.UnifiedClassLoader3@125d61e{ url=file:/C:/Development/jboss-4.0.2/server/all/tmp/deploy/tmp43073jboss-service.xml ,addedOrder=2}
      ++++CodeSource: (file:/C:/Development/jboss-4.0.2/server/all/lib/jboss-j2ee.jar )

      ### Instance0 found in UCL: org.jboss.mx.loading.UnifiedClassLoader3@945d2d{ url=file:/C:/Development/jboss-4.0.2/server/all/tmp/deploy/tmp43145UserIndexEAR.ear ,addedOrder=39}


      Please advise

        • 1. Re: ClassCastException with iiop
          Katherine Youngblood Newbie

          I have fixed my problem, here's the solution in case others are having problems.

          I had to use rmic.exe in the java runtime to generate the stub classes.

          I did this in eclipse by selecting Run > External Tools > External Tools from the File Menu

          I right clicked Program in the external tools dialog and selected New
          I put
          -Location: C:\j2sdk1.4.2_11\bin\rmic.exe
          -Working Dir: ${workspace_loc:/UserIndexEJB/build/classes} (my classes dir of my EJB Project.

          Arguments:
          -iiop -classpath .;C:\InfoManager\JavaLibraries\RazorSource\RazorSourceCommon.jar;C:\Development\jboss-4.0.2\server\all\lib\jboss-j2ee.jar;C:\InfoManager\Source\WebAdviser\deploy\WebAdviser.jar;C:\InfoManager\JavaLibraries\Log4j\log4j-1.2.13.jar com.infomanager.ejb.userindex.UserIndex com.infomanager.ejb.userindex.UserIndexHome

          I clicked Apply and then Run and my stubs were generated.

          I then right clicked by project and selected Export and exported my bean to an EJB jar file. I then referenced that EJB jar file from my JDeveloper project and violla!!! everything worked.

          So, I figured this out all by myself.