You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2021/01/11 16:23:00 UTC

[jira] [Commented] (CONFIGURATION-798) "Cannot locate configuration source" When server reboot

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

Gary D. Gregory commented on CONFIGURATION-798:
-----------------------------------------------

Curious: why are you using such an old version?

> "Cannot locate configuration source" When server reboot
> -------------------------------------------------------
>
>                 Key: CONFIGURATION-798
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-798
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.9
>            Reporter: zhoudinghua
>            Priority: Major
>
> I have a Jetty proxy server. When the process is started, the plug-ins in the /service directory are loaded. Each plug-in directory contains a spring context.xml file and a configuration file. After the Linux host is restarted, the following exception occurs when the proxy server is started to load the configuration file:
>  org.apache.commons.configuration.ConfigurationException: Cannot locate configuration source /opt/oss/proxy/service/ram/ram.properties
>  at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:259)
> My code is as follows. Another point of confusion is that I define the configuration file in the context.xml file of spring, and the file can be loaded properly. Could you help me with that? Thank you very much.
> public void onAddNew(File dir, String pluginName, ProxyServletContext context) {
>  try
> { String location = "file:" + dir.getPath() + File.separator + pluginName + CONTEXT_SUFFIX; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(location); PropertiesConfiguration config = new PropertiesConfiguration(directory.getCanonicalPath() + File.separator + pluginName + File.separator + pluginName+ ".properties"); contextHandler.addServlet(context.createServlet(), context.getPathSpec()); }
> catch (Exception e) {
>  LOGGER.warn("unexpected exception while adding new servlet: {} ", context.getName(), e);
>  }
>  }
> The configuration in the ram-context.xml file is as follows:
>  <context:property-placeholder
>  location="file:#{systemProperties['rootDir']}/service/ram/ram.properties"/>



--
This message was sent by Atlassian Jira
(v8.3.4#803005)