jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felix Meschberger (Issue Comment Edited) (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Edited] (JCR-3288) ConnectionFactory.getDriverClass() should use Thread.currentThread().getContextClassLoader(); instead of Class.forName()
Date Wed, 11 Apr 2012 08:14:32 GMT

    [ https://issues.apache.org/jira/browse/JCR-3288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13251408#comment-13251408
] 

Felix Meschberger edited comment on JCR-3288 at 4/11/12 8:13 AM:
-----------------------------------------------------------------

Whatever the final solution, using Class.forName(String) is *really* problematic in OSGi scenarios
since there is some hard reference kept in the system preventing the class from being (garbage)
collected.

So this call should be replaced in any case.

See http://blog.bjhargrave.com/2007/07/why-do-classforname-and.html and http://blog.bjhargrave.com/2007/09/classforname-caches-defined-class-in.html
                
      was (Author: fmeschbe):
    Whatever the final solution, using Class.forName(String) is *really* problematic in OSGi
scenarios since there is some hard reference kept in the system preventing the class from
being (garbage) collected.

See http://blog.bjhargrave.com/2007/07/why-do-classforname-and.html and http://blog.bjhargrave.com/2007/09/classforname-caches-defined-class-in.html
                  
> ConnectionFactory.getDriverClass() should use Thread.currentThread().getContextClassLoader();
instead of Class.forName()
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-3288
>                 URL: https://issues.apache.org/jira/browse/JCR-3288
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.3
>         Environment: WXP Sun JDK 1.6.0_30 Derby database
>            Reporter: Francis ANDRE
>            Priority: Critical
>
> Hi
> The ConnectionFactory.getDriverClass() should use Thread.currentThread().getContextClassLoader();
instead of Class.forName() otherwise dynamically added jdbc drivers to the classpath are not
found;
>             	ClassLoader cl = Thread.currentThread().getContextClassLoader();
>             	return cl.loadClass(driver);
> //                return Class.forName(driver);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message