Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

SOLR error with URL

Highlighted

SOLR error with URL

Explorer

Hi,

 

I am trying to run mapreduce with SOLR but I am getting 404 error when trying to run it. Here is the error. Can anyone help with this.

 

Exception in thread "main" org.apache.solr.common.SolrException: Server at http://localhost:8983/solr/search returned non ok status:404, message:Not Found
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:373)
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:182)
    at org.apache.solr.client.solrj.request.SolrPing.process(SolrPing.java:60)
    at org.apache.solr.client.solrj.SolrServer.ping(SolrServer.java:315)
    at jp.projects.miya.hadoop_solr_indexer.SolrIndexer.run(SolrIndexer.java:52)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)

 

Code:

HttpSolrServer server = new HttpSolrServer(conf.get(Constants.SOLR_URL));

            SolrIndexer.LOG.info(conf.get(Constants.SOLR_URL) + " ping ...");
            server.ping();
            
            Job job = new Job(conf);
            //hadoop jar hadoop-solr-indexer-0.0.1-SNAPSHOT.jar jp.projects.miya.hadoop_solr_indexer.SolrIndexer -libjars /usr/lib/solr/ -D csv.headers=id,name,comment -D request.solr.url=http://http://localhost:8983/solr -D request.bufsize=100 -D request.threads=5 input

            
            job.setJarByClass(SolrIndexer.class);
            // job.setSomeProperty(...);

            job.setInputFormatClass(TextInputFormat.class);
            job.setOutputFormatClass(NullOutputFormat.class);
            FileInputFormat.setInputPaths(job, new Path(args[0]));

            job.setMapperClass(IndexMapper.class);

            job.setNumReduceTasks(0);

            job.setMapOutputKeyClass(NullWritable.class);
            job.setMapOutputValueClass(NullWritable.class);
            job.setOutputKeyClass(NullWritable.class);
            job.setOutputValueClass(NullWritable.class);

            SolrIndexer.LOG.info(conf.get(Constants.SOLR_URL) + " start indexer");
            
            if (job.waitForCompletion(true)) {
                SolrIndexer.LOG.info(conf.get(Constants.SOLR_URL) + " indexes optimize ...");
                
                server.optimize();
                
                SolrIndexer.LOG.info(conf.get(Constants.SOLR_URL) + " indexes build done.");
                return 0;
            } else {
                return 1;

 

Thanks,

Azzu

1 REPLY 1

Re: SOLR error with URL

Explorer

Hi,

 

I was able to resolve the error by adding jars but when trying to png the server, I get the below error. can anyone help me in resolving this.

14/10/09 07:36:22 INFO hadoop_solr_indexer.SolrIndexer: Before Pinging
Exception in thread "main" org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Expected mime type application/octet-stream but got text/html. <html><head><title>Apache Tomcat/6.0.37 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /solr/admin/ping</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/solr/admin/ping</u></p><p><b>description</b> <u>The requested resource is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.37</h3></body></html>
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:482)
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:207)
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:202)
    at org.apache.solr.client.solrj.request.SolrPing.process(SolrPing.java:69)
    at org.apache.solr.client.solrj.SolrServer.ping(SolrServer.java:293)
    at jp.projects.miya.hadoop_solr_indexer.SolrIndexer.run(SolrIndexer.java:53)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
    at jp.projects.miya.hadoop_solr_indexer.SolrIndexer.main(SolrIndexer.java:107)

 

 

Thanks,

Azzu.

Don't have an account?
Coming from Hortonworks? Activate your account here