lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rafał Kuć <r....@solr.pl>
Subject Re: need help to integrate SolrJ with my web application.
Date Mon, 16 Apr 2012 11:20:26 GMT
Hello!

What is the context your web application is available at ? Because I
see you try to connect to:

String url = "http://localhost:8080/solr";

Which may be different in your case.

-- 
Regards,
 Rafał Kuć
 Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch

> Hi All,

> I am trying to integrate solr with my Spring application.

> I have performed following steps:

> 1) Added below list of jars to my webapp lib folder.
> apache-solr-cell-3.5.0.jar
> apache-solr-core-3.5.0.jar
> apache-solr-solrj-3.5.0.jar
> commons-codec-1.5.jar
> commons-httpclient-3.1.jar
> lucene-analyzers-3.5.0.jar
> lucene-core-3.5.0.jar
> 2) I have added Tika jar files for processing binary files.
> tika-core-0.10.jar
> tika-parsers-0.10.jar
> pdfbox-1.6.0.jar
> poi-3.8-beta4.jar
> poi-ooxml-3.8-beta4.jar
> poi-ooxml-schemas-3.8-beta4.jar
> poi-scratchpad-3.8-beta4.jar
> 3) I have modified web.xml added below setup.
> <filter>
>                 <filter-name>SolrRequestFilter</filter-name>
>                
> <filter-class>org.apache.solr.servlet.SolrDispatchFilter</filter-class>
>         </filter>

>         <filter-mapping>
>                 <filter-name>SolrRequestFilter</filter-name>
>                 <url-pattern>/dataimport</url-pattern>
>         </filter-mapping>
>         <servlet>
>                 <servlet-name>SolrServer</servlet-name>
>                
> <servlet-class>org.apache.solr.servlet.SolrServlet</servlet-class>
>                 <load-on-startup>1</load-on-startup>
>         </servlet>
>         <servlet>
>                 <servlet-name>SolrUpdate</servlet-name>
>                
> <servlet-class>org.apache.solr.servlet.SolrUpdateServlet</servlet-class>
>                 <load-on-startup>2</load-on-startup>
>         </servlet>
>         <servlet>
>                 <servlet-name>Logging</servlet-name>
>                
> <servlet-class>org.apache.solr.servlet.LogLevelSelection</servlet-class>
>         </servlet>
>         <servlet-mapping>
>                 <servlet-name>SolrUpdate</servlet-name>
>                 <url-pattern>/update/*</url-pattern>
>         </servlet-mapping>
>         <servlet-mapping>
>                 <servlet-name>Logging</servlet-name>
>                 <url-pattern>/admin/logging</url-pattern>
>         </servlet-mapping>

> I am trying to test this setup by running a simple java program
> with extract content of MS Excel file as below

> public SolrServer createNewSolrServer()
>         {
>           try {
>             // setup the server...
>             String url = "http://localhost:8080/solr";
>             CommonsHttpSolrServer s = new CommonsHttpSolrServer( url );
>             s.setConnectionTimeout(100); // 1/10th sec
>             s.setDefaultMaxConnectionsPerHost(100);
>             s.setMaxTotalConnections(100);

>             // where the magic happens
>             s.setParser(new BinaryResponseParser());
>             s.setRequestWriter(new BinaryRequestWriter());

>             return s;
>           }
>           catch( Exception ex ) {
>             throw new RuntimeException( ex );
>           }
>         }
>         public static void main(String[] args) throws IOException, SolrServerException
{
>                 IndexFilesSolrCell infil = new IndexFilesSolrCell();
>                 System.setProperty("solr.solr.home",
> "/WebApp/PCS-DMI/WebContent/resources/solr");
>                 SolrServer serverone = infil.createNewSolrServer();
>             ContentStreamUpdateRequest reqext = new
> ContentStreamUpdateRequest("/update/extract");
>             reqext.addFile(new File("Open Search Approach.xlsx"));
>             reqext.setParam(ExtractingParams.EXTRACT_ONLY, "true");
>             System.out.println("Content Stream Data path: "+serverone.toString());
>             NamedList<Object> result = serverone.request(reqext);
>             System.out.println("Result: " + result);
>         }
> I am getting below exception....
> Exception in thread "main" org.apache.solr.common.SolrException: Not Found

> Not Found
> request:
> http://localhost:8080/solr/update/extract?extractOnly=true&wt=javabin&version=2
>         at
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:432)
>         at
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:246)

> Please direct me how to extract content...
> I  have tried to work with example with solr distribution to extract a MS Excel file.
>  The file extraction was successful and I could check the metadata using admin of example
app.

> Thanks,
> Vijaya Kumar T
> PACIFIC COAST STEEL (Pinnacle) Project
> Ness Technologies India Pvt. Ltd
> 1st & 2nd Floor, 2A Maximus Builing, Raheja Mindspace IT Park,
> Madhapur, Hyderabad, 500081, India. | Tel: +91 40 41962079 | Mobile: +91 9963001551
> vijaya.tadavarthy@ness.com | www.ness.com

> The information contained in this communication is intended solely
> for the use of the individual or entity to whom it is addressed and
> others authorized to receive it. It may contain confidential or
> legally privileged information. If you are not the intended
> recipient you are hereby notified that any disclosure, copying,
> distribution or taking any action in reliance on the contents of
> this information is strictly prohibited and may be unlawful. If you
> have received this communication in error, please notify us
> immediately by forwarding this email to MailAdmin@ness.com and then
> delete it from your system. Ness technologies is neither liable for
> the proper and complete transmission of the information contained in
> this communication nor for any delay in its receipt.





Mime
View raw message