Я получаю сообщение об ошибке при запуске Properties. java.
Exception in thread "main" org.apache.commons.configuration2.ex.ConfigurationException: Could not locate: org.apache.commons.configuration2.io.FileLocator@629f0666[fileName=configuration.properties,basePath=<null>,sourceURL=,encoding=ISO-8859-1,fileSystem=<null>,locationStrategy=<null>]
at org.apache.commons.configuration2.io.FileLocatorUtils.locateOrThrow(FileLocatorUtils.java:345)
at org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:971)
at org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:701)
at org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder.initFileHandler(FileBasedConfigurationBuilder.java:311)
at org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder.initResultInstance(FileBasedConfigurationBuilder.java:290)
at org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder.initResultInstance(FileBasedConfigurationBuilder.java:59)
at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResult(BasicConfigurationBuilder.java:420)
at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getConfiguration(BasicConfigurationBuilder.java:284)
at org.apache.commons.configuration2.builder.fluent.Configurations.properties(Configurations.java:342)
at properties.Properties.main(Properties.java:11)
Properties. java
package properties;
import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.builder.fluent.Configurations;
public class Properties
{
static void log(Object o){System.out.println(o);}
public static void main(String[] args) throws Exception
{
Configurations configs = new Configurations();
PropertiesConfiguration properties = configs.properties("configuration.properties");
Object name= properties.getProperty("NAME");
log(name);
}
}
My pom. xml зависимости приведены ниже. Я считаю, что добавил все правильные зависимости.
<dependencies>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-configuration2 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
</dependency>
</dependencies>
Есть предложения, как это исправить? Спасибо.