We're using plugins similar to Eclipse's to decouple functionality. Each 
plugin's classes run in their own class loader.

We've encountered a problem in onNewBrowserWindow(). it uses 
Objects.cloneObject(), which uses the default ObjectInputStream, that uses the 
class loader associated with the execution stack, rather than the object's. so 
trying to get the class of the object when reading it back fails.

This can be solved by changing cloneObject to:
public static Object cloneObject(final Object object)
       if (object == null)
           return null;
               final ByteArrayOutputStream out = new ByteArrayOutputStream(256);
               ObjectOutputStream oos = new ObjectOutputStream(out);
               ObjectInputStream ois = new ObjectInputStream(new 
                       .toByteArray())) {
                                      protected Class 
resolveClass(ObjectStreamClass desc) throws IOException,
                   ClassNotFoundException {
                       String className = desc.getName();
                       return Class.forName(className, true, 
object.getClass().getClassLoader());                     }
               return ois.readObject();
           catch (ClassNotFoundException e)
               throw new WicketRuntimeException("Internal error cloning 
object", e);
           catch (IOException e)
               throw new WicketRuntimeException("Internal error cloning 
object", e);

i think that it should work fine in this context since the object is already 
accessible when writing it. it is working for us. 

btw, a problem that is caused by this failure (and the throwing of 
WicketRuntimeException) is that the PageMap contains null entries (or rather, 
the session contains attributes with null values). i couldn't track why exactly 
this happens.


Ittay Dror, 
Chief architect, openQRM TL, 
R&D, Qlusters Inc.
+972-3-6081994 Fax: +972-3-6081841

- Keeps your Data-Center Up and Running

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Wicket-user mailing list

Reply via email to