Apache Solr would not start. Keeps throwing the following error

    java -jar example/start.jar 

    java.lang.ClassNotFoundException: org.mortbay.xml.XmlConfiguration
            at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
            at org.mortbay.start.Main.invokeMain(Main.java:179)
            at org.mortbay.start.Main.start(Main.java:534)
            at org.mortbay.start.Main.start(Main.java:441)
            at org.mortbay.start.Main.main(Main.java:119)

When you're not inside the example dir, you need to specify the path for jetty.home. It may also be a good idea to set the jetty.logs option as well:

java -Djetty.home=example -Djetty.logs=/tmp -Dsolr.solr.home=example/solr -jar example/start.jar 

Specify the classpath to solr files with -cp

java -cp <path> -jar example/start.jar 
  • For me it also worked when I did cd /path/to/example and then invoked solr.
    – Nifle
    May 26 '11 at 6:41
  • This hasn't worked for me. Probably because when the -jar option is used, the -cp option is ignored. Quote from the Java manual for the -jar option: "When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored."
    – chiborg
    Jan 10 '12 at 10:53
  • Yes. This is true, You should add the dependencies on your jar Manifest.
    – Sacx
    Jan 12 '12 at 7:46

Make sure that you've met the requirements: http://wiki.apache.org/solr/SolrInstall

type: cd /opt/apache-solr-1.3.0/example type: java -jar start.jar http://wiki.apache.org/solr/SolrOnAmazonEC2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.