commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fabien Renaud (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CONFIGURATION-685) Implicit external dependency on DynaBean while loading a config
Date Fri, 22 Dec 2017 09:15:00 GMT
Fabien Renaud created CONFIGURATION-685:
-------------------------------------------

             Summary: Implicit external dependency on DynaBean while loading a config
                 Key: CONFIGURATION-685
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-685
             Project: Commons Configuration
          Issue Type: Bug
            Reporter: Fabien Renaud


100% repro.

Getting an exception: DynaBean not found when trying to load an apache config file.
Exception:
{code}
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/beanutils/DynaBean
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at com.sun.proxy.$Proxy0.<clinit>(Unknown Source)
        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:307)
        at org.apache.commons.configuration2.builder.fluent.Parameters.fileBased(Parameters.java:186)
        at com.example.App.main(App.java:13)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.beanutils.DynaBean
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 11 more
{code}
when running:
{code}
package com.example;

import org.apache.commons.configuration2.YAMLConfiguration;
import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
import org.apache.commons.configuration2.builder.fluent.Parameters;
import org.apache.commons.configuration2.ex.ConfigurationException;

class App {

  public static void main(String[] args) throws ConfigurationException {
    Parameters params = new Parameters();
    FileBasedConfigurationBuilder<YAMLConfiguration> builder1 = new FileBasedConfigurationBuilder<>(YAMLConfiguration.class)
      .configure(params.fileBased().setFileName("file.yml"));

    YAMLConfiguration conf = builder1.getConfiguration();
  }

}
{code}
with build.gradle:
{code}
apply plugin: 'java'
apply plugin: 'application'

mainClassName = "com.example.App"

repositories {
    jcenter()
}

dependencies {
  compile group: 'org.apache.commons', name: 'commons-configuration2', version: '2.2'
}
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message