title: Why is my SalesForce.com-GoogleApp unable to initialize class com.sforce.ws.ConnectorConfig?
body: <p>I'm currently working on a SalesForce.com tutorial entitled <a href="http://wiki.developerforce.com/index.php/Force.com_for_Google_App_Engine_Setup_Guide_Java" rel="nofollow">Force.com for Google App Engine for Java: Getting Started</a></p>
  
  <p>I've installed the Google Eclipse Plugin, downloaded the libraries and installed them to the build path, and entered the "Hello World App" (as seen on the tutorial page):</p>
  
  <pre><code>package com.force;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  import javax.servlet.http.*;
  import java.util.logging.*;
  
  import com.sforce.ws.*;
  import com.sforce.soap.partner.*;
  import com.sforce.soap.partner.sobject.SObject;
  
  
  @SuppressWarnings("serial")
  public class HelloWorldServlet extends HttpServlet {
      private static final Logger log = Logger.getLogger(HelloWorldServlet.class.getName());
  
      private String username = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
      private String password = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
      private PartnerConnection connection;
  
      public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
          resp.setContentType("text/html");
          resp.getWriter().println("Hello, world. this is a test2");
  
          PrintWriter t = resp.getWriter();
          getConnection( t, req);
          if ( connection == null ) { return; }
  
          QueryResult result = null;
  
          try {
  
              result = connection.query(  "select id, name, phone from Account order by LastModifiedDate desc limit 10 ");
  
          } catch (ConnectionException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          for (SObject account : result.getRecords()) {
               t.println("&lt;li&gt;"+ (String)account.getField("Name") + "&lt;/li&gt;");
          }
      }
  
      void getConnection(PrintWriter out, HttpServletRequest req)  { 
  
          try { 
              // build up a ConnectorConfig from a sid
              String sessionid = req.getParameter("sid");
              String serverurl = req.getParameter("srv");
  
              if ( connection == null ) { 
  
                 out.println("&lt;p&gt;new connection needed&lt;/p&gt;");
                 // login to the Force.com Platform
                 ConnectorConfig config = new ConnectorConfig();
                 if ( sessionid != null &amp;&amp; serverurl != null) {
                     config.setServiceEndpoint(serverurl);
                     config.setSessionId(sessionid);
                     config.setManualLogin(false);
                     out.println("using session from query string");
                 }   else { 
                     config.setUsername(username);
                     config.setPassword(password);
                 }
                 connection = Connector.newConnection(config);
                 out.println( connection.getConfig().getSessionId() );
                 out.println( connection.getConfig().getServiceEndpoint() );
             } else { 
                 out.println("&lt;p&gt; reuse existing connection"); 
                 out.println( connection.getConfig().getSessionId() );
             }
             log.warning("Connection SID " +connection.getConfig().getSessionId());
  
          } catch ( ConnectionException ce) {
              log.warning("ConnectionException " +ce.getMessage());
  
              out.println( ce.getMessage() + " s " + ce.getClass() );
  
          }
  
      }
  }
  </code></pre>
  
  <p>When I run the application as a "Web Application" I get the following in the my web browser:</p>
  
  <pre><code>    HTTP ERROR 500
  
  Problem accessing /sfdc_gae_tutorials/hello2. Reason:
  
      Could not initialize class com.sforce.ws.ConnectorConfig
  Caused by:
  
  java.lang.NoClassDefFoundError: Could not initialize class com.sforce.ws.ConnectorConfig
      at hu.flux.salesforce.hello.HelloWorld2Servlet.getConnection(HelloWorld2Servlet.java:57)
      at hu.flux.salesforce.hello.HelloWorld2Servlet.doGet(HelloWorld2Servlet.java:28)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
      at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
      at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:349)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:326)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
  Powered by Jetty://
  </code></pre>
  
  <p>Any idea why initialization isn't taking place, what is going wrong, and/or how to fix it?</p>