I'm using org.apache.commons:commons-configuration2
to load and merge configuration from different sources:
val root = CompositeConfiguration()
root.addConfiguration(SystemConfiguration())
val configurations = Configurations()
root.addConfiguration(configurations.properties("defaults.properties"))
My problem is that whenever I run this code I get an exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/beanutils/BeanIntrospector at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at com.sun.proxy.$Proxy0.(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:294) at org.apache.commons.configuration2.builder.fluent.Parameters.fileBased(Parameters.java:185) at org.apache.commons.configuration2.builder.fluent.Configurations.fileParams(Configurations.java:602) at org.apache.commons.configuration2.builder.fluent.Configurations.fileParams(Configurations.java:638) at org.apache.commons.configuration2.builder.fluent.Configurations.fileBasedBuilder(Configurations.java:164) at org.apache.commons.configuration2.builder.fluent.Configurations.propertiesBuilder(Configurations.java:264) at org.apache.commons.configuration2.builder.fluent.Configurations.properties(Configurations.java:318) at io.sspinc.datahub.sparkapp.MainKt.main(main.kt:18) Caused by: java.lang.ClassNotFoundException: org.apache.commons.beanutils.BeanIntrospector at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
It says that org.apache.commons.beanutils.BeanIntrospector
is not found. If I add commons-beanutils:commons-beanutils:1.9.3
to the classpath the problem is solved but the main problem is that I'm using Apache Spark 2.3.0 in a managed environment (Databricks) and it comes with commons-beanutils:1.7.0
so I can't do anything about the beanutils version.
How can I solve this problem?
commons-beanutils:commons-beanutils:1.7.0
to the classpath ? – Halayem Anis1.9.3
or later. If I usecommons-configurations:1.10
instead I do not get the exception. – Adam Aroldcommons-beanutils:commons-beanutils:1.7.0
? – Halayem Anis