tags:

views:

408

answers:

1

Hi,

Ive followed this tutorial to install (multiple) solr instances on tomcat

http://wiki.apache.org/solr/SolrTomcat

Now i want to set up this demo but its not working

http://www.ibm.com/developerworks/java/library/j-solr1/

Ive built the dw.war as mentioned in the demo and now I get this error.

java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.httpclient.HttpClient
    org.apache.dwexample.servlet.DWServlet.sendGetCommand(DWServlet.java:714)
    org.apache.dwexample.servlet.DWServlet.processSubmitQuery(DWServlet.java:634)
    org.apache.dwexample.servlet.DWServlet.doGet(DWServlet.java:120)
    org.apache.dwexample.servlet.DWServlet.doPost(DWServlet.java:782)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Thinking that it was an error in the /tomcat/lib directory copied the commons-httpclient-3.0.jar into the /tomcat/lib directory and did

chcon -R -h -t httpd_sys_content_t /usr/share/apache-tomcat-6.0.18/lib/

Now I get two errors:

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    org.apache.commons.httpclient.HttpClient.<clinit>(HttpClient.java:65)
    org.apache.dwexample.servlet.DWServlet.sendPostCommand(DWServlet.java:663)
    org.apache.dwexample.servlet.DWServlet.processSubmitCommand(DWServlet.java:596)
    org.apache.dwexample.servlet.DWServlet.processIndexCommand(DWServlet.java:557)
    org.apache.dwexample.servlet.DWServlet.processCommit(DWServlet.java:225)
    org.apache.dwexample.servlet.DWServlet.doGet(DWServlet.java:100)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    org.apache.commons.httpclient.HttpClient.<clinit>(HttpClient.java:65)
    org.apache.dwexample.servlet.DWServlet.sendPostCommand(DWServlet.java:663)
    org.apache.dwexample.servlet.DWServlet.processSubmitCommand(DWServlet.java:596)
    org.apache.dwexample.servlet.DWServlet.processIndexCommand(DWServlet.java:557)
    org.apache.dwexample.servlet.DWServlet.processCommit(DWServlet.java:225)
    org.apache.dwexample.servlet.DWServlet.doGet(DWServlet.java:100)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Would love to find out how to solve these errors. cataling log output doesnt give much to go by.

Cheers

Ke

+1  A: 

Your first fix is right, you just miss another library, which is Jakarta Commons Logging. Also get the JAR and put it with your libs. Note that there may be more dependencies afterwards, it just stops on the first error. Are you sure there is no "lib" folder in the package you downloaded with a bunch of JARs ?

streetpc
yep this helped me a lot. It was httpclient and loggin dependencies. I also had some problems because im using solr on port 8081 also the default folder for solr was /solr-example2/ instead of /solr/ as im running multiple solr instances, so i needed to change /solr/select/ to /solr-example2/select/ in DWServlet.java. The DWServlet.java had to be adapted before i compiled the dw.war to handle these two things. however now it works like a dream :)Thanks v v much for your help.
Ke
You're welcome :)
streetpc