title: Very simple Apache-commons configuration example throws NoClassDefFoundError
body: <p>I'm trying to test <a href="http://commons.apache.org/proper/commons-configuration/userguide/howto_beans.html#An_Example" rel="noreferrer">a very simple example</a> given in the Apache-commons configuration library user's guide regarding declaring and creating beans. I copied the code in the example almost word by word, and yet I'm getting a NoClassDefFoundError exception.</p>
  
  <p>Here is the xml file I'm using - <code>windowcongif.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
  &lt;config&gt;
    &lt;gui&gt;
      &lt;windowManager config-class="test.DefaultWindowManager"
        closable="false" resizable="true" defaultWidth="400"
        defaultHeight="250"&gt;      
      &lt;/windowManager&gt;
    &lt;/gui&gt;
  &lt;/config&gt;
  </code></pre>
  
  <p>Here is the code in the file <code>WindowManager.java</code>:</p>
  
  <pre><code>package test;
  public interface WindowManager {}
  </code></pre>
  
  <p>Here is the code in the file <code>DefaultWindowManager.java</code>:</p>
  
  <pre><code>package test;
  public class DefaultWindowManager  implements WindowManager {
      private boolean resizable;
      private boolean closable;
      private int defaultWidth;
      private int defaultHeight;
  }
  </code></pre>
  
  <p>Here is the code in the file <code>Main.java</code>:</p>
  
  <pre><code>package test;
  import org.apache.commons.configuration.ConfigurationException;
  import org.apache.commons.configuration.XMLConfiguration;
  import org.apache.commons.configuration.beanutils.BeanDeclaration;
  import org.apache.commons.configuration.beanutils.BeanHelper;
  import org.apache.commons.configuration.beanutils.XMLBeanDeclaration;
  
  public class Main {
      public static void main(String[] args) throws ConfigurationException {
          XMLConfiguration config = new XMLConfiguration("windowconfig.xml");
          BeanDeclaration decl = new XMLBeanDeclaration(config, "gui.windowManager");
          WindowManager wm = (WindowManager) BeanHelper.createBean(decl);
      }
  }
  </code></pre>
  
  <p>Here is the output during runtime:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/beanutils/PropertyUtils
      at org.apache.commons.configuration.beanutils.BeanHelper.initProperty(BeanHelper.java:269)
      at org.apache.commons.configuration.beanutils.BeanHelper.initBeanProperties(BeanHelper.java:229)
      at org.apache.commons.configuration.beanutils.BeanHelper.initBean(BeanHelper.java:166)
      at org.apache.commons.configuration.beanutils.DefaultBeanFactory.initBeanInstance(DefaultBeanFactory.java:108)
      at org.apache.commons.configuration.beanutils.DefaultBeanFactory.createBean(DefaultBeanFactory.java:64)
      at org.apache.commons.configuration.beanutils.BeanHelper.createBean(BeanHelper.java:336)
      at org.apache.commons.configuration.beanutils.BeanHelper.createBean(BeanHelper.java:358)
      at org.apache.commons.configuration.beanutils.BeanHelper.createBean(BeanHelper.java:372)
      at test.Main.main(Main.java:23)
  Caused by: java.lang.ClassNotFoundException: org.apache.commons.beanutils.PropertyUtils
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
      ... 9 more
  </code></pre>
  
  <p><strong>How do I make this simple example work?</strong></p>
  
  <p>I'm using version 1.9 of the commons-configuration package, auto-imported by IntelliJ IDEA after putting the dependency in the <code>pom.xml</code> file, and version 1.7.0_17 of java running on Windows 8 64bit.</p>