title: ClassNotFoundException: org.springframework.context.support.AbstractApplicationContext
body: <p>I am trying to follow this <a href="http://www.javacodegeeks.com/2013/05/apache-cxf-jax-ws-simple-tutorial.html" rel="nofollow noreferrer">Apache CXF – JAX-WS – Simple Tutorial</a> but  building the <strong>downloaded</strong> sample (out of the box!) creates a client that upon invocation refuses to run, issuing this error:</p>
  
  <blockquote>
    <p>Failed to load Main-Class manifest attribute from
    SampleWSCxfClient-0.0.1-SNAPSHOT.jar</p>
  </blockquote>
  
  <p>I searched to find out more about this problem and found out <a href="https://stackoverflow.com/a/2591548/3154666">this SO answer</a> which prompted me to hack SampleWSCxfClient-0.0.1-SNAPSHOT.jar by opening it using <code>7-zip</code> and adding into a file name <code>META-INF/MANIFEST.MF</code> the following line:</p>
  
  <pre><code>Main-Class: com.areyes.sample.client.SampleWSClient
  </code></pre>
  
  <p>I figured out that main class by simply looking at the only Java file in the project:</p>
  
  <pre><code>package com.areyes.sample.client;
  
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  import com.sample.service.SampleWebService;
  
  public class SampleWSClient {
  
  
      public SampleWSClient() {
  
          ClassPathXmlApplicationContext classPathXmlAppContext = new ClassPathXmlApplicationContext("classpath:META-INF/beans.xml");
          classPathXmlAppContext.start();
  
          SampleWebService sampleWebService = (SampleWebService)classPathXmlAppContext.getBean("client");
  
          System.out.println(sampleWebService.getDataFromWebService().getName());
          System.out.println(sampleWebService.getDataFromWebService().getDescription());
          System.out.println(sampleWebService.getDataFromWebService().getAge());
  
      }
  
      public static void main(String[] args){
          new SampleWSClient();
      }
  }
  </code></pre>
  
  <p>I then tried to invoke SampleWSCxfClient-0.0.1-SNAPSHOT.jar again, but this time it fails with:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/support/AbstractApplicationContext
  Caused by: java.lang.ClassNotFoundException: org.springframework.context.support.AbstractApplicationContext
          at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  Could not find the main class: com.areyes.sample.client.SampleWSClient. Program will exit.
  </code></pre>
  
  <p>How do I make this sample work?</p>
  
  <hr>
  
  <p>For your convenience, the entire sample package ZIP can be downloaded from <a href="https://dl.dropboxusercontent.com/u/1737239/SampleWSCxf.zip" rel="nofollow noreferrer">here</a>.</p>