commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Albu (JIRA)" <j...@apache.org>
Subject [jira] Commented: (BEANUTILS-263) Improve ClassConverter robustness
Date Fri, 24 Nov 2006 14:22:03 GMT
    [ http://issues.apache.org/jira/browse/BEANUTILS-263?page=comments#action_12452465 ] 
            
Alex Albu commented on BEANUTILS-263:
-------------------------------------

Yes, Weblogic throws a ClassNotFoundException.  And the fix I posted does fix the problem.
 Writing a custom ClassConverter is easy, but if the problem occurs in a third party library,
registering the converter may not always be possible.

As far as this being a Weblogic bug, I think you can qualify it as that, given that Sun's
javadocs say: "the context ClassLoader is provided by the creator of the thread for use by
code running in this thread when loading classes and resources".  I suspect that Weblogic
is simply not setting the classloader causing it to be inherited from the parent thread. 
But this is not the first application server where the context classloader doesn't work as
expected.

What I am suggesting is that the class converter try harder and use all class loaders available
to load the class.  The change should not affect existing code.

> Improve ClassConverter robustness
> ---------------------------------
>
>                 Key: BEANUTILS-263
>                 URL: http://issues.apache.org/jira/browse/BEANUTILS-263
>             Project: Commons BeanUtils
>          Issue Type: Improvement
>          Components: ConvertUtils & Converters
>    Affects Versions: 1.7.0
>            Reporter: Alex Albu
>            Priority: Minor
>             Fix For: 1.8.0
>
>         Attachments: ClassConverter.java.patch.txt
>
>
> To load a class by name, ClassConverter attempts to use (in order) the current thread's
context class loader and the class loader that loaded the class itself.  But in my opinion
it is a little inconsistent in the way it does it.  Basically, it will use the second class
loader as a fallback *only* if the first one (context class loader) is not set (null).  That
causes the converter to fail in environments where the context class loader is set but does
not have access to the class it's trying to load (Weblogic 9.2 is an example).
> I think a more robust behavior would be to try the second class loader *any* time using
the context one fails (be it because it's not set, or it cannot load the class for some reason).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message