[jboss-user] [EJB 3.0] - ClassCastException EJB3 wrapped local object.

hurzeler do-not-reply at jboss.com
Sun Dec 31 00:06:48 EST 2006


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
  |     {
  | 	em.merge(site);
  |     }
  | 

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.

Calling:

  | SiteDAO siteDAO = (SiteDAO) context.lookup(SiteDAOBean.class
  | 		    .getSimpleName()
  | 		    + "/remote");
  | siteDAO.update(site);
  | 

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:
siteDAO.update((Site)site);
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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997022#3997022

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997022



More information about the jboss-user mailing list