title: java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException with eclipse and spring
body: <p>I have a simple XML file that I have parsed to JSON. All is fine and dandy, I have a Java class that is stand alone (i.e. it has a <code>public static void main (String args[])....</code>)</p>
  
  <p>This has a private constructor (because I need to call it with Strings either a filename or the actual data). So I have two methods that return an instance of the object. I know a bit of Java as you can tell.</p>
  
  <p>OK. When I run the code in Eclipse that runs the main method my file is loaded and decoded as required. It also works for a raw String that I run via JUnit. </p>
  
  <p>So I know the following facts -</p>
  
  <ol>
  <li>the parsing of a static String works and decodes perfectly</li>
  <li>if I provide a file it is loaded and decoded correctly.</li>
  </ol>
  
  <p>Now the issue:</p>
  
  <p>As soon as I run it in Spring framework I can write to standard out the entire file content that I have run via the stand alone code.</p>
  
  <p>But before it can run anything at all I get the below error -</p>
  
  <pre>
  org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:920)
  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  </pre>
  
  <p>The stand alone code is run in Eclipse, and the Spring is run pointing to that code using Tomcat 7.</p>
  
  <p>Why is it not finding the ParsException correctly?</p>
  
  <p>The imports in the calling Spring controller are</p>
  
  <pre>
  import java.io.FileNotFoundException;
  import java.io.FileReader;
  import java.io.IOException;
  import java.util.ArrayList;
  import org.apache.commons.lang.StringUtils;
  import org.json.simple.JSONArray;
  import org.json.simple.JSONObject;
  import org.json.simple.parser.JSONParser;
  </pre>
  
  <p>Is their a way of altering the build order, and would that fix it?</p>