2 Replies Latest reply on Sep 10, 2002 1:21 PM by Adrian Brock

    java.lang.ClassCastException problem

    Camus Newbie

      Hi all,

      I've suffered from the captioned question for a while and have tried to search the forum but without any possible solutions. I am using JBoss 3.0 with tomcat 4.0.3, apache web server running on Solaris 2.7 server, JDK 1.3.1.

      The situation is that I created a Stateless session bean to call another BMP bean through the home interface. The call returns a collection of value object (in my case, it is PSProperty). The session bean can call it without any problem. However, when it attempts to class cast the return object (e.g. (PSProperty) al.get(0) where al is the ArrayList), the ClassCastException occurs.

      Below is the full log:
      2002-09-09 16:25:10,165 INFO [STDOUT] BMP close : PS.EJB.PROPERTY.PSPropertyBMPEntityBean@558d83
      2002-09-09 16:25:10,167 INFO [STDOUT] Session: before get
      2002-09-09 16:25:10,168 INFO [STDOUT] Session : AL 0=PS/PSPropertyBMPEntityJndi:PS.EJB.PROPERTY.PSProperty@4473c
      2002-09-09 16:25:10,168 INFO [STDOUT] Session : AL 1=PS/PSPropertyBMPEntityJndi:PS.EJB.PROPERTY.PSProperty@60c389
      2002-09-09 16:25:10,169 INFO [STDOUT] Session : AL 2=PS/PSPropertyBMPEntityJndi:PS.EJB.PROPERTY.PSProperty@456d5d
      2002-09-09 16:25:10,169 ERROR [STDERR] java.lang.ClassCastException: $Proxy201
      2002-09-09 16:25:10,170 ERROR [STDERR] at PS.EJB.PROPERTY.PSPropertySessionBean.findPropertyList(PSPropertySessionBean.java:219)
      2002-09-09 16:25:10,171 ERROR [STDERR] at java.lang.reflect.Method.invoke(Native Method)
      2002-09-09 16:25:10,171 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:664)
      2002-09-09 16:25:10,172 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      2002-09-09 16:25:10,172 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      2002-09-09 16:25:10,173 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      2002-09-09 16:25:10,173 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      2002-09-09 16:25:10,174 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      2002-09-09 16:25:10,174 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      2002-09-09 16:25:10,175 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      2002-09-09 16:25:10,176 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      2002-09-09 16:25:10,176 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:705)
      2002-09-09 16:25:10,177 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      2002-09-09 16:25:10,177 ERROR [STDERR] at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
      2002-09-09 16:25:10,178 ERROR [STDERR] at java.lang.reflect.Method.invoke(Native Method)
      2002-09-09 16:25:10,178 ERROR [STDERR] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      2002-09-09 16:25:10,179 ERROR [STDERR] at sun.rmi.transport.Transport$1.run(Transport.java:152)
      2002-09-09 16:25:10,179 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
      2002-09-09 16:25:10,180 ERROR [STDERR] at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
      2002-09-09 16:25:10,180 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
      2002-09-09 16:25:10,181 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
      2002-09-09 16:25:10,181 ERROR [STDERR] at java.lang.Thread.run(Thread.java:484)
      2002-09-09 16:25:10,182 INFO [STDOUT] PSPropertySessionBean - findPropertyList() Exception Found :java.lang.ClassCastException: $Proxy201

      Any hints or solutions ?

      Thanks,
      Camus