Я пытаюсь создать общую библиотеку для Oracle проектов ADF. Я создал утилиту для чтения внешнего файла свойств и загрузки в службы ADF. Итак, я создал проект Maven для этого общего проекта, который создает JAR. При добавлении этой библиотеки у меня нет проблем во время компиляции. Я могу импортировать новый класс в проект службы ADF потребления. Когда я развернул новое ухо. При тестировании строки, где мой ConfigService используется для чтения внешнего файла свойств, я получаю следующее исключение:
java.lang.NoClassDefFoundError: Could not initialize class com.sun.proxy.$Proxy322
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:739)
at org.apache.commons.configuration2.builder.fluent.Parameters.createParametersProxy(Parameters.java:306)
at org.apache.commons.configuration2.builder.fluent.Parameters.properties(Parameters.java:245)
at com.aar.webservices.common.config.ConfigService.getConfigService(ConfigService.java:37)
ConfigService :
public class ConfigService {
private static ADFLogger logger = ADFLogger.createADFLogger(ConfigService.class);
private FileBasedConfiguration configService;
private static String DEFAULT_CONFIG_FILE_PATH="C:\\com.aar.webservices.common.config\\application.properties";
private String filePath;
public ConfigService(){
super();
}
/**
* A public interface to get access to the Configuration service
* @return
*/
public FileBasedConfiguration getConfigService() {
Parameters params = new Parameters();
if(this.configService == null) {// Check if the singleton instance of config service is initialized ; If not initialize.
try {
File propertyFile = new File(DEFAULT_CONFIG_FILE_PATH);
FileBasedConfigurationBuilder<FileBasedConfiguration> builder =
new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)
.configure(params.properties().setFile(propertyFile));
this.configService = builder.getConfiguration();
logger.info("Successfully initialized property bean.");
} catch (ConfigurationException cex) {
logger.severe("Loading of Config service failed!");
logger.severe(cex);
}
}
return this.configService;
pom зависимости:
<dependencies>
<!--Apache Common Configuration related depdendencies -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- 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/commons-beanutils/commons-beanutils -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.13</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-jxpath/commons-jxpath -->
<dependency>
<groupId>commons-jxpath</groupId>
<artifactId>commons-jxpath</artifactId>
<version>1.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-text -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.8</version>
</dependency>
<!-- <!– https://mvnrepository.com/artifact/org.apache.commons/commons-jexl –>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.commons</groupId>-->
<!-- <artifactId>commons-jexl</artifactId>-->
<!-- <version>2.1.1</version>-->
<!-- </dependency>-->
<!-- <!– https://mvnrepository.com/artifact/org.apache.commons/commons-jexl –>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.commons</groupId>-->
<!-- <artifactId>commons-jexl</artifactId>-->
<!-- <version>2.1.1</version>-->
<!-- </dependency>-->
<!-- <!– https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2 –>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.commons</groupId>-->
<!-- <artifactId>commons-vfs2</artifactId>-->
<!-- <version>2.4.1</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.6</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>BC4J-Runtime</artifactId>
<version>12.2.1-1-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>ADF-Model-Runtime</artifactId>
<version>12.2.1-1-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>MDS-Runtime</artifactId>
<version>12.2.1-1-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>MDS-Runtime-Dependencies</artifactId>
<version>12.2.1-1-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>BC4J-Security</artifactId>
<version>12.2.1-1-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>Oracle-JDBC</artifactId>
<version>12.2.1-1-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>BC4J-Oracle-Domains</artifactId>
<version>12.2.1-1-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>