title: Servlet throws Exception
body: <p>This is my Servlet code which i am using to query a solr index</p>
  
  <pre><code>import java.io.*;
  import java.net.*;
  import java.text.*;
  import java.util.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  //Solr Imports
  import org.apache.solr.client.solrj.SolrServer;
  import org.apache.solr.client.solrj.SolrServerException;
  import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
  import org.apache.solr.client.solrj.response.QueryResponse;
  import org.apache.solr.client.solrj.SolrQuery;
  import org.apache.solr.common.params.ModifiableSolrParams;
  import org.apache.solr.client.solrj.request.ContentStreamUpdateRequest;
  import org.apache.solr.common.SolrInputDocument;
  import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
  
  /*
  import org.jdom.Document;
  import org.jdom.Element;
  import org.jdom.JDOMException;
  import org.jdom.input.SAXBuilder;
  */
  
  public class HelloWorldExample extends HttpServlet {
  
      public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException
      {
          PrintWriter out = response.getWriter();
          String inputStr=request.getParameter("input");
          out.println("&lt;html&gt;&lt;h1&gt;" + inputStr + "&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;");
          //try {
          SolrServer server = new CommonsHttpSolrServer("http://localhost:8080/solr/");
          SolrQuery solrQuery = new SolrQuery(); 
          //solrQuery.setQuery("fileName:"+input);
          solrQuery.setQuery("Latitude:"+32.55668);
          QueryResponse rsp = server.query(solrQuery);
          //SolrDocumentList x = rsp.getResults();
          System.out.println(rsp);
          }
          catch (SolrServerException e) {
              e.printStackTrace();
          }       
      }
  }
  </code></pre>
  
  <p>I am compiling this code using </p>
  
  <p><strong>D:\xampp\tomcat\webapps\examples\WEB-INF\classes>javac -classpath .;D:\JAR\servl
  et-api.jar;D:\JAR\1solr-core-1.3.0.jar;D:\JAR\1solr-solrj-1.3.0.jar;D:\JAR\1solr
  -common-1.3.0.jar;D:\JAR\apache-solr-solrj-1.4.0.jar HelloWorldExample.java</strong></p>
  
  <p>This code compiles without problem. However when i run this servlwt it gives me an error: </p>
  
  <blockquote>
    <p>type Exception report
    message</p>
    
    <p>description The server encountered an internal error () that prevented
    it from fulfilling this request.</p>
    
    <p>exception</p>
    
    <p>javax.servlet.ServletException: Servlet execution threw an exception
    root cause</p>
    
    <p>java.lang.NoClassDefFoundError:
    org/apache/solr/client/solrj/impl/CommonsHttpSolrServer
      HelloWorldExample.doGet(HelloWorldExample.java:35)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)</p>
  </blockquote>