Ok ok thanks a lot Otis. This was bothering me since a long while. Thanks a ton. On Sat, Oct 6, 2012 at 1:05 AM, Otis Gospodnetic <otis.gospodne...@gmail.com > wrote:
> Looks like HttpClient jar is not in your CLASSPATH or in -cp. > > Otis > -- > Search Analytics - http://sematext.com/search-analytics/index.html > Performance Monitoring - http://sematext.com/spm/index.html > > > On Fri, Oct 5, 2012 at 3:33 PM, Prithu Banerjee <prid...@gmail.com> wrote: > > I have been using solrJ since last two months. It was working well so > far. > > But now I am getting some strange error message while using it. my code > is > > a simple adding documents: > > > > package firstsolr; > > > > import java.io.IOException; > > > > import org.apache.solr.client.solrj. > > SolrServerException; > > import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer; > > import org.apache.solr.common.SolrInputDocument; > > > > public class SolrjPopulator { > > public static void main(String[] args) throws IOException, > > SolrServerException { > > CommonsHttpSolrServer server1 = new CommonsHttpSolrServer( > > "http://localhost:8983/solr"); > > for (int i = 0; i < 1000; ++i) { > > SolrInputDocument doc = new SolrInputDocument(); > > doc.addField("cat", "book"); > > doc.addField("id", "book-" + i); > > doc.addField("name", "The Legend of Po part " + i); > > server1.add(doc); > > if (i % 100 == 0) > > server1.commit(); // periodically flush > > } > > server1.commit(); > > } > > } > > > > > > Eclipse prints this as error message: > > Exception in thread "main" java.lang.NoClassDefFoundError: > > org/apache/commons/httpclient/HttpException > > at firstsolr.SolrjPopulator.main(SolrjPopulator.java:12) > > Caused by: java.lang.ClassNotFoundException: > > org.apache.commons.httpclient.HttpException > > at java.net.URLClassLoader$1.run(Unknown Source) > > at java.net.URLClassLoader$1.run(Unknown Source) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(Unknown Source) > > at java.lang.ClassLoader.loadClass(Unknown Source) > > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) > > at java.lang.ClassLoader.loadClass(Unknown Source) > > ... 1 more > > > > > > I have double checked that my server is running on proper port.. pls help > > urgently... >