zhoudinghua created CONFIGURATION-798:
-----------------------------------------

             Summary: "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


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 proxy server is started. The following exception occurs when the 
configuration file is loaded:
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)

Reply via email to