2 Replies Latest reply on Dec 3, 2002 6:19 PM by Norton

    ClassCastException and JDK 1.4.1

    Norton Newbie

      Hi,

      I'm running into a problem that I think may be a compatibility issue
      with JBoss and JDK 1.4.1.

      First I ran my EJBs on JBoss 3.0.4 on RedHat 7.3 using JDK 1.3.1_06.
      That all worked fine.

      When I switched to JDK 1.4.1, I got the following error from my test case:

      [java] ..F
      [java] Time: 0.956
      [java] There was 1 failure:
      [java] 1) testTokenReplace(com.acme.test.ejb.rules.RulesEJBTest)junit.framework.AssertionFailedError: testTokenReplace(): RemoteException: RemoteException occurred in server thread; nested exception is:
      [java] java.rmi.ServerException: RuntimeException; nested exception is:
      [java] java.lang.ClassCastException
      [java] at com.acme.test.ejb.rules.RulesEJBTest.testTokenReplace(Unknown Source)
      [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      [java] FAILURES!!!
      [java] Tests run: 2, Failures: 1, Errors: 0

      [java] Java Result: 1



      and the following error from the JBoss logging console:

      8:03:06,425 ERROR [LogInterceptor] RuntimeException:
      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 com.acme.ejb.EJBUtil.getHome(Unknown Source)
      at com.acme.ejb.rules.RulesEJB.tokenReplace(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.Container.invoke(Container.java:712)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:382)
      at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)


      I have a bunch of EJBs and get a bunch of ClassCastExceptions like this.
      The interesting thing is that the Exceptions don't occur on the same
      objects in each run. It's not consistent.

      Is there something special that needs to be done with JBoss 3.0.4 to
      work well with JDK 1.4.x? I did a search about JDK 1.4 and JBoss 3
      compatibility, but didn't find a definitive answer as to whether
      they work well together all the time.


      Thanx for your time.

        • 1. Re: ClassCastException and JDK 1.4.1
          Alvaro Newbie

          Hi
          I have in 3.0.4, Linux, JVM 1.3.1 - Blackdown
          A session Bean packaged in a jar file (Session01) is calling
          one entity bean packaged in another jar file Entity01 .
          Works great.
          I have one client in Tomcat in another machine.

          If I hot-deploy Session01.jar, it's work. But hot-deploy
          Entity01
          get
          20:34:59,449 ERROR [LogInterceptor] RuntimeException:
          java.lang.ClassCastException: $Proxy156
          at
          com.da.motion.testeAlvaro.model.statelessEJB.SManterTesteEJB.find
          All(SManterTes
          teEJB.java:75)

          The solution is to hot-deploy Entity01 and Session01 works fine.
          is it ok with 1.3.1?

          What do you doing?


          Alvaro

          • 2. Re: ClassCastException and JDK 1.4.1
            Norton Newbie

            I'm not exactly sure what your point is.

            I only have one ear with one war and one jar. All my beans are in the one jar. After deploying my ear, I run my tests via JUnit with some EJB client code and get the error above.