2

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)
bob
  • 63
  • 2
  • 5

3 Answers3

2

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 
chiborg
  • 1,043
  • 2
  • 13
  • 26
1

Specify the classpath to solr files with -cp

java -cp <path> -jar example/start.jar 
Sacx
  • 2,541
  • 15
  • 13
  • For me it also worked when I did `cd /path/to/example` and then invoked solr. – Nifle May 26 '11 at 06: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 07:46
-1

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

kiko
  • 1