Re: [Wicket-user] working with plugins

2006-07-22 Thread Johan Compagner
Yes that was the idea.. That you have to delegate there through all your classloaders.I implemented your change by first using the objects classloader.. then fall back to what we did now.So that should help your case. When a page (by total) comes from one plugin/package
The only problem is when a page or component that is cloned is a mix of plugins.. Then it won't work and you will need toimplement the IClassResolver so that you iterate over it.But i think i can fix that also.. so that nobody has to worry anymore for classloaders when cloning (model or object)
I just record all the classloaders that are used for all the objects that are cloned for one request in the outputstream (use the replaceObject method)Then i use those classloaders myself for t he resolving in the inputstream.. (resolveClass method)
That should always work i believe or am i missing something??johanOn 7/17/06, Ittay Dror [EMAIL PROTECTED]
 wrote:if the deserialization uses it, then maybe (i'm not sure how it is used). but in our case, every Page subclass may be in its own class loader, separate from others, so using a singleton IClassResolver instance will not help (unless it delegates to all class loaders, which may cause havoc). i think that my proposed solution is straight forward.
Igor Vaynberg wrote: we do have IClassResolver woudnt that help? it helped with osgi -Igor On 7/17/06, *Ittay Dror* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote: done. the request id is 1524019. i've added more description of the problem and the solution. i think
 this may happen also with osgi integration, or any other case where an object is used that is found through a classloader different than the one wicket / tomcat is in. Eelco Hillenius wrote:
 I'm afraid I don't get the request. Could you please create a feature request with a patch, clearly explaining what is wrong today and what your patch fixes?
 Thanks, Eelco On 7/17/06, Ittay Dror [EMAIL PROTECTED] mailto:
[EMAIL PROTECTED] wrote: Hi, 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;}else
{try{final ByteArrayOutputStream out = new ByteArrayOutputStream(256);ObjectOutputStream oos = new
 ObjectOutputStream(out);oos.writeObject(object);ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(out
.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. regards, ittay --
 === Ittay Dror, Chief architect, openQRM TL, RD, Qlusters Inc. 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] +972-3-6081994 Fax: +972-3-6081841 
http://www.openQRM.org - 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 
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net
 mailto:Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
 - 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
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___
 Wicket-user 

Re: [Wicket-user] working with plugins

2006-07-22 Thread Igor Vaynberg
yeah i think that should do it. you think it will have a noticable
impact on the size of our cloned objects? maybe output null if the
object's classloader is the same as our default one to save on space.

-Igor
On 7/22/06, Johan Compagner [EMAIL PROTECTED] wrote:
Yes that was the idea.. That you have to delegate there through all your classloaders.I implemented your change by first using the objects classloader.. then fall back to what we did now.So that should help your case. When a page (by total) comes from one plugin/package
The only problem is when a page or component that is cloned is a mix of plugins.. Then it won't work and you will need toimplement the IClassResolver so that you iterate over it.But i think i can fix that also.. so that nobody has to worry anymore for classloaders when cloning (model or object)
I just record all the classloaders that are used for all the
objects that are cloned for one request in the outputstream (use the
replaceObject method)Then i use those classloaders myself for t he resolving in the inputstream.. (resolveClass method)
That should always work i believe or am i missing something??johanOn 7/17/06, 
Ittay Dror [EMAIL PROTECTED]
 wrote:if
the deserialization uses it, then maybe (i'm not sure how it is used).
but in our case, every Page subclass may be in its own class loader,
separate from others, so using a singleton IClassResolver instance will
not help (unless it delegates to all class loaders, which may cause
havoc). i think that my proposed solution is straight forward.
Igor Vaynberg wrote: we do have IClassResolver woudnt that help? it helped with osgi -Igor On 7/17/06, *Ittay Dror* 
[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote: done. the request id is 1524019.
 i've added more description of the problem and the solution. i think
 this may happen also with osgi integration, or any other case where an object is used that is found through a classloader different than the one wicket / tomcat is in. Eelco Hillenius wrote:
 I'm afraid I don't get the request. Could you please create a feature request with a patch, clearly explaining what is wrong today and what your patch fixes?
 Thanks, Eelco On 7/17/06, Ittay Dror 
[EMAIL PROTECTED] mailto:
[EMAIL PROTECTED] wrote: Hi,
 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;}else
{try{final
ByteArrayOutputStream out = new ByteArrayOutputStream(256);ObjectOutputStream oos = new
 ObjectOutputStream(out);oos.writeObject(object);ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(out
.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. regards, ittay --
 === Ittay Dror, Chief architect, openQRM TL, RD, Qlusters Inc. 

[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] +972-3-6081994 Fax: +972-3-6081841
 
http://www.openQRM.org - 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 

http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___ Wicket-user mailing list 
Wicket-user@lists.sourceforge.net
 mailto:Wicket-user@lists.sourceforge.net
 
https://lists.sourceforge.net/lists/listinfo/wicket-user
 - 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 

Re: [Wicket-user] working with plugins

2006-07-22 Thread Johan Compagner
it won't impact the size of the cloned objects at allIt is just a list (or better set) of classloaders thats is registered and hold on to for only that cloneXXX methodnothing more. So the only thing that will be generated and discarded quickly is a List or Set holding the Classloaders.
johanOn 7/22/06, Igor Vaynberg [EMAIL PROTECTED] wrote:
yeah i think that should do it. you think it will have a noticable
impact on the size of our cloned objects? maybe output null if the
object's classloader is the same as our default one to save on space.

-Igor
On 7/22/06, Johan Compagner 
[EMAIL PROTECTED] wrote:
Yes that was the idea.. That you have to delegate there through all your classloaders.I implemented your change by first using the objects classloader.. then fall back to what we did now.So that should help your case. When a page (by total) comes from one plugin/package
The only problem is when a page or component that is cloned is a mix of plugins.. Then it won't work and you will need toimplement the IClassResolver so that you iterate over it.But i think i can fix that also.. so that nobody has to worry anymore for classloaders when cloning (model or object)
I just record all the classloaders that are used for all the
objects that are cloned for one request in the outputstream (use the
replaceObject method)Then i use those classloaders myself for t he resolving in the inputstream.. (resolveClass method)
That should always work i believe or am i missing something??johanOn 7/17/06, 
Ittay Dror [EMAIL PROTECTED]
 wrote:if
the deserialization uses it, then maybe (i'm not sure how it is used).
but in our case, every Page subclass may be in its own class loader,
separate from others, so using a singleton IClassResolver instance will
not help (unless it delegates to all class loaders, which may cause
havoc). i think that my proposed solution is straight forward.
Igor Vaynberg wrote: we do have IClassResolver woudnt that help? it helped with osgi -Igor On 7/17/06, *Ittay Dror* 

[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
 done. the request id is 1524019.
 i've added more description of the problem and the solution. i think
 this may happen also with osgi integration, or any other case where an object is used that is found through a classloader different than the one wicket / tomcat is in. Eelco Hillenius wrote:
 I'm afraid I don't get the request. Could you please create a feature request with a patch, clearly explaining what is wrong today and what your patch fixes?
 Thanks, Eelco On 7/17/06, Ittay Dror 

[EMAIL PROTECTED] mailto:
[EMAIL PROTECTED] wrote: Hi,

 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;}else
{try{final
ByteArrayOutputStream out = new ByteArrayOutputStream(256);ObjectOutputStream oos = new
 ObjectOutputStream(out);oos.writeObject(object);ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(out
.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. regards, ittay --
 === Ittay Dror, Chief architect, openQRM TL, RD, Qlusters Inc. 


[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 +972-3-6081994 Fax: +972-3-6081841
 
http://www.openQRM.org - 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 


http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 

http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___ Wicket-user mailing list 


Re: [Wicket-user] working with plugins

2006-07-22 Thread Igor Vaynberg
ah, i see. you are just registering them. i thought you were going to
include it into the cloed object itself. i think we still need to keep
the record of what the object's classloader was in case there are
objects with the same name in more then one classloader. so maybe as
you build up this list of classloaders you save the index with the
cloned object.

-Igor
On 7/22/06, Johan Compagner [EMAIL PROTECTED] wrote:
it won't impact the size of the cloned objects at allIt is just a list (or better set) of classloaders thats is registered and hold on to for only that cloneXXX methodnothing more. So the only thing that will be generated and discarded quickly is a List or Set holding the Classloaders.
johanOn 7/22/06, Igor Vaynberg 
[EMAIL PROTECTED] wrote:
yeah i think that should do it. you think it will have a noticable
impact on the size of our cloned objects? maybe output null if the
object's classloader is the same as our default one to save on space.

-Igor
On 7/22/06, Johan Compagner 

[EMAIL PROTECTED] wrote:
Yes that was the idea.. That you have to delegate there through all your classloaders.I implemented your change by first using the objects classloader.. then fall back to what we did now.So that should help your case. When a page (by total) comes from one plugin/package
The only problem is when a page or component that is cloned is a mix of plugins.. Then it won't work and you will need toimplement the IClassResolver so that you iterate over it.But i think i can fix that also.. so that nobody has to worry anymore for classloaders when cloning (model or object)
I just record all the classloaders that are used for all the
objects that are cloned for one request in the outputstream (use the
replaceObject method)Then i use those classloaders myself for t he resolving in the inputstream.. (resolveClass method)
That should always work i believe or am i missing something??johanOn 7/17/06, 
Ittay Dror 
[EMAIL PROTECTED]
 wrote:if
the deserialization uses it, then maybe (i'm not sure how it is used).
but in our case, every Page subclass may be in its own class loader,
separate from others, so using a singleton IClassResolver instance will
not help (unless it delegates to all class loaders, which may cause
havoc). i think that my proposed solution is straight forward.
Igor Vaynberg wrote: we do have IClassResolver woudnt that help? it helped with osgi -Igor On 7/17/06, *Ittay Dror* 


[EMAIL PROTECTED]
 mailto:
[EMAIL PROTECTED] wrote:
 done. the request id is 1524019.
 i've added more description of the problem and the solution. i think
 this may happen also with osgi integration, or any other case where an object is used that is found through a classloader different than the one wicket / tomcat is in. Eelco Hillenius wrote:
 I'm afraid I don't get the request. Could you please create a feature request with a patch, clearly explaining what is wrong today and what your patch fixes?
 Thanks, Eelco On 7/17/06, Ittay Dror 


[EMAIL PROTECTED] mailto:
[EMAIL PROTECTED]
 wrote: Hi,

 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;}else
{try{final
ByteArrayOutputStream out = new ByteArrayOutputStream(256);ObjectOutputStream oos = new
 ObjectOutputStream(out);oos.writeObject(object);ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(out
.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. regards, ittay --
 === Ittay Dror, Chief architect, openQRM TL, RD, Qlusters Inc. 



[EMAIL PROTECTED] mailto:
[EMAIL PROTECTED]
 +972-3-6081994 Fax: +972-3-6081841
 

http://www.openQRM.org - Keeps your Data-Center Up and Running -
 Using Tomcat but need to do more? 

Re: [Wicket-user] working with plugins

2006-07-22 Thread Johan Compagner
hmm same name??So igor.i.am.the.one.MyGreatObjectdoes have 2 instances in somewhere in the cloned object hierachy but they are comming from different classloaders??That would really suck. I wouldn't know how to handle that currently.
Because at register time i just get a replaceObject(Object o){ uniqueSet.add(o.getClass().getClassLoader())}and then at resolveClass(){ iterate(uniqueSet) { Class cls = 
Class.forName(className,true,classLoaderFromSet) }}Ofcourse if there is only one instance that we need. But the class can come from a different onethen this would help a bit:replaceObject(Object o)

{
 map.put(o.getClass().getName(),o.getClass().getClassLoader())
}
resolveClass(){ map.get(className)}That last part is maybe better after all, We will generate a (much) bigger map thenjohanOn 7/22/06, 
Igor Vaynberg [EMAIL PROTECTED] wrote:
ah, i see. you are just registering them. i thought you were going to
include it into the cloed object itself. i think we still need to keep
the record of what the object's classloader was in case there are
objects with the same name in more then one classloader. so maybe as
you build up this list of classloaders you save the index with the
cloned object.

-Igor
On 7/22/06, Johan Compagner 
[EMAIL PROTECTED] wrote:
it won't impact the size of the cloned objects at allIt is just a list (or better set) of classloaders thats is registered and hold on to for only that cloneXXX methodnothing more. So the only thing that will be generated and discarded quickly is a List or Set holding the Classloaders.
johanOn 7/22/06, Igor Vaynberg 

[EMAIL PROTECTED] wrote:
yeah i think that should do it. you think it will have a noticable
impact on the size of our cloned objects? maybe output null if the
object's classloader is the same as our default one to save on space.

-Igor
On 7/22/06, Johan Compagner 


[EMAIL PROTECTED] wrote:
Yes that was the idea.. That you have to delegate there through all your classloaders.I implemented your change by first using the objects classloader.. then fall back to what we did now.So that should help your case. When a page (by total) comes from one plugin/package
The only problem is when a page or component that is cloned is a mix of plugins.. Then it won't work and you will need toimplement the IClassResolver so that you iterate over it.But i think i can fix that also.. so that nobody has to worry anymore for classloaders when cloning (model or object)
I just record all the classloaders that are used for all the
objects that are cloned for one request in the outputstream (use the
replaceObject method)Then i use those classloaders myself for t he resolving in the inputstream.. (resolveClass method)
That should always work i believe or am i missing something??johanOn 7/17/06, 
Ittay Dror 

[EMAIL PROTECTED]
 wrote:if
the deserialization uses it, then maybe (i'm not sure how it is used).
but in our case, every Page subclass may be in its own class loader,
separate from others, so using a singleton IClassResolver instance will
not help (unless it delegates to all class loaders, which may cause
havoc). i think that my proposed solution is straight forward.
Igor Vaynberg wrote: we do have IClassResolver woudnt that help? it helped with osgi -Igor On 7/17/06, *Ittay Dror* 



[EMAIL PROTECTED]
 mailto:

[EMAIL PROTECTED] wrote:
 done. the request id is 1524019.
 i've added more description of the problem and the solution. i think
 this may happen also with osgi integration, or any other case where an object is used that is found through a classloader different than the one wicket / tomcat is in. Eelco Hillenius wrote:
 I'm afraid I don't get the request. Could you please create a feature request with a patch, clearly explaining what is wrong today and what your patch fixes?
 Thanks, Eelco On 7/17/06, Ittay Dror 



[EMAIL PROTECTED] mailto:

[EMAIL PROTECTED]
 wrote: Hi,

 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;}else
{try{final
ByteArrayOutputStream out = new ByteArrayOutputStream(256);ObjectOutputStream oos = new
 ObjectOutputStream(out);oos.writeObject(object);ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(out
.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 

[Wicket-user] working with plugins

2006-07-17 Thread Ittay Dror
Hi,

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;
   }
   else
   {
   try
   {
   final ByteArrayOutputStream out = new ByteArrayOutputStream(256);
   ObjectOutputStream oos = new ObjectOutputStream(out);
   oos.writeObject(object);
   ObjectInputStream ois = new ObjectInputStream(new 
ByteArrayInputStream(out
   .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.

regards,
ittay



-- 
===
Ittay Dror, 
Chief architect, openQRM TL, 
RD, Qlusters Inc.
[EMAIL PROTECTED]
+972-3-6081994 Fax: +972-3-6081841

http://www.openQRM.org
- 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
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] working with plugins

2006-07-17 Thread Eelco Hillenius
I'm afraid I don't get the request. Could you please create a feature
request with a patch, clearly explaining what is wrong today and what
your patch fixes?

Thanks,

Eelco


On 7/17/06, Ittay Dror [EMAIL PROTECTED] wrote:
 Hi,

 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;
}
else
{
try
{
final ByteArrayOutputStream out = new 
 ByteArrayOutputStream(256);
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(object);
ObjectInputStream ois = new ObjectInputStream(new 
 ByteArrayInputStream(out
.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.

 regards,
 ittay



 --
 ===
 Ittay Dror,
 Chief architect, openQRM TL,
 RD, Qlusters Inc.
 [EMAIL PROTECTED]
 +972-3-6081994 Fax: +972-3-6081841

 http://www.openQRM.org
 - 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
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



-
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
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] working with plugins

2006-07-17 Thread Ittay Dror
done. the request id is 1524019. 

i've added more description of the problem and the solution. i think this may 
happen also with osgi integration, or any other case where an object is used 
that is found through a classloader different than the one wicket / tomcat is 
in.

Eelco Hillenius wrote:
 I'm afraid I don't get the request. Could you please create a feature
 request with a patch, clearly explaining what is wrong today and what
 your patch fixes?
 
 Thanks,
 
 Eelco
 
 
 On 7/17/06, Ittay Dror [EMAIL PROTECTED] wrote:
 Hi,

 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;
}
else
{
try
{
final ByteArrayOutputStream out = new 
 ByteArrayOutputStream(256);
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(object);
ObjectInputStream ois = new ObjectInputStream(new 
 ByteArrayInputStream(out
.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.

 regards,
 ittay



 --
 ===
 Ittay Dror,
 Chief architect, openQRM TL,
 RD, Qlusters Inc.
 [EMAIL PROTECTED]
 +972-3-6081994 Fax: +972-3-6081841

 http://www.openQRM.org
 - 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
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user

 
 
 -
 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
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user
 


-- 
===
Ittay Dror, 
Chief architect, openQRM TL, 
RD, Qlusters Inc.
[EMAIL PROTECTED]
+972-3-6081994 Fax: +972-3-6081841

http://www.openQRM.org
- 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
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] working with plugins

2006-07-17 Thread Igor Vaynberg
we do have IClassResolver woudnt that help? it helped with osgi-IgorOn 7/17/06, Ittay Dror [EMAIL PROTECTED]
 wrote:done. the request id is 1524019.i've added more description of the problem and the solution. i think this may happen also with osgi integration, or any other case where an object is used that is found through a classloader different than the one wicket / tomcat is in.
Eelco Hillenius wrote: I'm afraid I don't get the request. Could you please create a feature request with a patch, clearly explaining what is wrong today and what your patch fixes?
 Thanks, Eelco On 7/17/06, Ittay Dror [EMAIL PROTECTED] wrote: Hi, 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;
}else{try{final ByteArrayOutputStream out = new ByteArrayOutputStream(256);ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(object);ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(out.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.
 regards, ittay -- === Ittay Dror, Chief architect, openQRM TL, RD, Qlusters Inc.
 [EMAIL PROTECTED] +972-3-6081994 Fax: +972-3-6081841 http://www.openQRM.org - 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 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/wicket-user - 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 
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list 
Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user--===
Ittay Dror,Chief architect, openQRM TL,RD, Qlusters Inc.[EMAIL PROTECTED]+972-3-6081994 Fax: +972-3-6081841http://www.openQRM.org
- 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 Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-
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
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] working with plugins

2006-07-17 Thread Ittay Dror
if the deserialization uses it, then maybe (i'm not sure how it is used). but 
in our case, every Page subclass may be in its own class loader, separate from 
others, so using a singleton IClassResolver instance will not help (unless it 
delegates to all class loaders, which may cause havoc). i think that my 
proposed solution is straight forward.

Igor Vaynberg wrote:
 we do have IClassResolver woudnt that help? it helped with osgi
 
 -Igor
 
 
 On 7/17/06, *Ittay Dror* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:
 
 done. the request id is 1524019.
 
 i've added more description of the problem and the solution. i think
 this may happen also with osgi integration, or any other case where
 an object is used that is found through a classloader different than
 the one wicket / tomcat is in.
 
 Eelco Hillenius wrote:
   I'm afraid I don't get the request. Could you please create a feature
   request with a patch, clearly explaining what is wrong today and what
   your patch fixes?
  
   Thanks,
  
   Eelco
  
  
   On 7/17/06, Ittay Dror [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
   Hi,
  
   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;
  }
  else
  {
  try
  {
  final ByteArrayOutputStream out = new
 ByteArrayOutputStream(256);
  ObjectOutputStream oos = new
 ObjectOutputStream(out);
  oos.writeObject(object);
  ObjectInputStream ois = new ObjectInputStream(new
 ByteArrayInputStream(out
  .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.
  
   regards,
   ittay
  
  
  
   --
   ===
   Ittay Dror,
   Chief architect, openQRM TL,
   RD, Qlusters Inc.
   [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
   +972-3-6081994 Fax: +972-3-6081841
  
   http://www.openQRM.org
   - 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
  
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
   ___
   Wicket-user mailing list
   Wicket-user@lists.sourceforge.net
 mailto:Wicket-user@lists.sourceforge.net
   https://lists.sourceforge.net/lists/listinfo/wicket-user
  
  
  
  
 -
   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