Hi,

would it be possible to make the usage of the descriptorCache in PropertyUtils optional, e.g. having something like

PropertyUtils.java

   ....
    private static boolean useCache = true;

    public static void setUseCache(boolean cacheFlag) {
        useCache = cacheFlag;
    }
   ....

public static PropertyDescriptor[] getPropertyDescriptors(Object bean) {

.....    
        if (useCache) {
            descriptors =
                (PropertyDescriptor[]) descriptorsCache.get(beanClassName);
            if (descriptors != null && false)
                return (descriptors);
        }
....

      if (useCache)
            descriptorsCache.put(beanClassName, descriptors);

The reason for that request is that I have several entity EJBs with the same type (= same classes) but with different deployment descriptors pointing the beans to different database schemes. This is possible because Weblogic uses a separate classloaders for each jar. The first time copyProperties is invoked with a entity ejb as the source object it works well, the second time copyProperties is invoked with a ejb from the same type and with the same name but from a different classloader it fails with a IllegalArgumentException:

2001-08-30 11:27:37,038 DEBUG com.medvantis.mecapp.ejb.login.LoginMecEJB  - Insu
ranceNumber sdk000010
java.lang.IllegalArgumentException: object is not an instance of declaring class

        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(Property
Utils.java:715)
        at org.apache.commons.beanutils.PropertyUtils.copyProperties(PropertyUti
ls.java:219)
        at com.medvantis.mecapp.ejb.login.LoginMecEJB.findMixed(LoginMecEJB.java
:68)

I'm not sure anybody understands this since I'm not sure that I understood it really but disabling the cache works for me and should not hurt elsewhere.

Regards -- Tobias

Reply via email to