[ https://issues.apache.org/jira/browse/CONFIGURATION-685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16301600#comment-16301600 ]
Fabien Renaud commented on CONFIGURATION-685: --------------------------------------------- Thanks. It's a little annoying to have to deal with runtime dependencies but I guess it makes sense for such project here. > 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)