title: java.lang.NoClassDefFoundError: Could not initialize class com.hp.hpl.jena.query.Query
body: <p>I am playing a little bit around with Jena and I set up a Java Google Web Application project in Eclipse. I downloaded the Jena 2.0 Libraries and added them to the Build path of the project and also to the <code>/war/WEB-INFO/lib/</code>folder.</p>
  
  <p>My Simple servlet tries to instantiate a Query using the following line of code</p>
  
  <pre><code>...
  Query query = QueryFactory.create(queryString);
  ...
  </code></pre>
  
  <p>So there are no compilation errors and as I said the Libarries are both in the Build Path and in the lib folder under WEB-INF (in the war dir.)</p>
  
  <p>When I Run the webapp and execute the servlet I get the following Exception:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: Could not initialize class com.hp.hpl.jena.query.Query
      at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:78)
      at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:52)
      at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:40)
      at nyx.servlets.PeripheralServlet.extractPlace(PeripheralServlet.java:102)
      at nyx.servlets.PeripheralServlet.doCreate(PeripheralServlet.java:83)
  </code></pre>
  
  <p>The servlet class is PeripheralServlet.java and the line 102 in the method <strong>extractPlace</strong> is the one above where I try to instantiate the Query object.</p>
  
  <p>Could anyone give me a clue on what my problem might be? To me it looks like a missing jar inclusion or something on that line but as I said I included all the jar Jena files to both the Build Path of the project and the lib folder under WEB-INF.</p>
  
  <p>Thank you very much.</p>
  
  <p><strong>EDIT:</strong> The weird thing is that the <code>QueryFactory</code> it actually gives no error and both <code>Query</code> and <code>QueryFactory</code> are in the same Jena package right? </p>
  
  <p><strong>EDIT2:</strong> After repeating the process from scratch and making sure ONLY the needed jars are included once now I get the following exception:</p>
  
  <pre><code>java.lang.StackOverflowError
    at java.util.regex.Pattern$Curly.match(Pattern.java:3744)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4112)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4227)
    at java.util.regex.Pattern$Curly.match0(Pattern.java:3782)
    at java.util.regex.Pattern$Curly.match(Pattern.java:3744)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168)
    at java.util.regex.Pattern$Start.match(Pattern.java:3055)
    at java.util.regex.Matcher.search(Matcher.java:1105)
    at java.util.regex.Matcher.find(Matcher.java:535)
    at com.google.appengine.tools.development.LocalEnvironment.getServerName(LocalEnvironment.java:302)
    at com.google.appengine.tools.development.DevAppServerImpl.getCurrentAppContext(DevAppServerImpl.java:372)
    ...
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:82)
    at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:704)
    at org.slf4j.impl.JCLLoggerFactory.getLogger(JCLLoggerFactory.java:64)
    ...
  </code></pre>
  
  <p>If I reload the page after this I get again the original exception. I have been doing some research and I found some related problems dating back to 2009 and so Jena versions 2.6. Assuming we are in 2013 and Jena has evolved to its 2.10 versions I guess they are not so relevant</p>