You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Lorenz Schumann (JIRA)" <ji...@apache.org> on 2012/10/19 11:50:15 UTC

[jira] [Created] (CONFIGURATION-511) ConfigurationUtils cannot locate classpath file when current Thread is RMI

Lorenz Schumann created CONFIGURATION-511:
---------------------------------------------

             Summary: ConfigurationUtils cannot locate classpath file when current Thread is RMI
                 Key: CONFIGURATION-511
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-511
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.9, 1.8, 1.6
            Reporter: Lorenz Schumann


I noticed the problem when a registered MBean method is invoked over JMX (=RMI) and it calls ConfigurationUtils.locate("some.properties").
The classloader is not able to find the resource then.

A possible fix would be to change
ClassLoader loader = Thread.currentThread().getContextClassLoader();
to
ClassLoader loader = ConfigurationUtils.class.getClassLoader();
in method locateFromClasspath. But i am not sure what other Effects that would have since I have no insight into commons-configuration.

Tested with 1.6, 1.8, 1.9.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CONFIGURATION-511) ConfigurationUtils cannot locate classpath file when current Thread is RMI

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13480312#comment-13480312 ] 

Oliver Heger commented on CONFIGURATION-511:
--------------------------------------------

I will have to look into the code. Maybe the class loader of {{ConfigurationUtils}} can be used as fallback if the TCCL fails.
                
> ConfigurationUtils cannot locate classpath file when current Thread is RMI
> --------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-511
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-511
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6, 1.8, 1.9
>            Reporter: Lorenz Schumann
>
> I noticed the problem when a registered MBean method is invoked over JMX (=RMI) and it calls ConfigurationUtils.locate("some.properties").
> The classloader is not able to find the resource then.
> A possible fix would be to change
> ClassLoader loader = Thread.currentThread().getContextClassLoader();
> to
> ClassLoader loader = ConfigurationUtils.class.getClassLoader();
> in method locateFromClasspath. But i am not sure what other Effects that would have since I have no insight into commons-configuration.
> Tested with 1.6, 1.8, 1.9.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CONFIGURATION-511) ConfigurationUtils cannot locate classpath file when current Thread is RMI

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13502277#comment-13502277 ] 

Oliver Heger commented on CONFIGURATION-511:
--------------------------------------------

The whole location mechanism is currently pretty static. I would like to go for an approach where users can plug in their own specific search strategy. Actually, this is already possible using the FileSystem API. However, there is surely room for improvements to make this easier and more transparent.
                
> ConfigurationUtils cannot locate classpath file when current Thread is RMI
> --------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-511
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-511
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6, 1.8, 1.9
>            Reporter: Lorenz Schumann
>
> I noticed the problem when a registered MBean method is invoked over JMX (=RMI) and it calls ConfigurationUtils.locate("some.properties").
> The classloader is not able to find the resource then.
> A possible fix would be to change
> ClassLoader loader = Thread.currentThread().getContextClassLoader();
> to
> ClassLoader loader = ConfigurationUtils.class.getClassLoader();
> in method locateFromClasspath. But i am not sure what other Effects that would have since I have no insight into commons-configuration.
> Tested with 1.6, 1.8, 1.9.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CONFIGURATION-511) ConfigurationUtils cannot locate classpath file when current Thread is RMI

Posted by "Lorenz Schumann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13502701#comment-13502701 ] 

Lorenz Schumann commented on CONFIGURATION-511:
-----------------------------------------------

Although the project in which i noticed that behavior and where i wanted to improve something got cancelled in the meantime, an improvement for resource locating would be a nice thing to have :)
Thanks in advance!
                
> ConfigurationUtils cannot locate classpath file when current Thread is RMI
> --------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-511
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-511
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6, 1.8, 1.9
>            Reporter: Lorenz Schumann
>
> I noticed the problem when a registered MBean method is invoked over JMX (=RMI) and it calls ConfigurationUtils.locate("some.properties").
> The classloader is not able to find the resource then.
> A possible fix would be to change
> ClassLoader loader = Thread.currentThread().getContextClassLoader();
> to
> ClassLoader loader = ConfigurationUtils.class.getClassLoader();
> in method locateFromClasspath. But i am not sure what other Effects that would have since I have no insight into commons-configuration.
> Tested with 1.6, 1.8, 1.9.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira