3 Replies Latest reply on Jan 5, 2007 7:29 AM by Alex Grönholm

    ClassCastException EJB3 wrapped local object.

    Bernhard Hurzeler Novice

      Hello there,

      I have the following issue. I have a Stateless session bean called SiteDAOBean. This bean has a method:

      public void update(Site site) throws PersistenceException

      Which works nicely if I call it remotely with a Site argument. However due to some extra functionallity that I need locally I have to wrap the Site class by extending it to SelectableSite. It then has a couple more methods that are only used locally and a field that is transient but it is still fundamentally a Site class.

      SiteDAO siteDAO = (SiteDAO) context.lookup(SiteDAOBean.class
       + "/remote");

      I get the following exception:

      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: mhl.edm.util.SelectableSite (no security manager: RMI class loader disabled)
       at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:371)
       at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
       at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
       at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
       at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
       at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)
       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
       at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1634)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
       at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
       at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:267)
       ... 102 more

      Obviously I need to cast the SelectableSite back to Site so that RMI does not complain not finding the class remotely.

      I tried:

      but that does not work. Can anyone tell me how to overcome this issue short from creating a new Site object?

      Thanks for your help.