Title: BeanSerializer with JDK 1.4

I came across a problem with the other day that I haven't seen documented anywhere. It's not really an Apache SOAP bug, but I can't reproduce it any other way.

I'm using Apache SOAP 2.2, Tomcat 3.2.3, and JDK 1.4.0-beta3.

BeanSerializer fails to deserialize a bean with the error:
Unable to set 'myprop' property: object is not an instance of declaring class

The reason is that the Class that the BeanSerializer is invoking the method on has a different ClassLoader than the Class the Method retrieved from the Introspector is associated with.

propWriteMethod.getDeclaringClass() != bean.getClass()

The workaround is to get the Method from the right Class:
propWriteMethod = bean.getClass().getMethod(propWriteMethod.getName(), propWriteMethod.getParameterTypes());

This only seems to happen with Tomcat's AdaptiveClassLoader. I would report it to BugParade, but I can only reproduce it in the context of SOAP.

Dave Dunkin
Software Engineer
Attachmate Corp.
http://www.attachmate.com

Reply via email to