lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben McCarthy <Ben.McCar...@TraderMedia.co.uk>
Subject RE: need help to integrate SolrJ with my web application.
Date Mon, 16 Apr 2012 12:32:22 GMT
Hello,

When I have seen this it usually means the SOLR you are trying to connect to is not available.


Do you have it installed on:

http://localhost:8080/solr

Try opening that address in your browser.  If your running the example solr using the embedded
Jetty you wont be on 8080 :D

Hope that helps

-----Original Message-----
From: Vijaya Kumar Tadavarthy [mailto:Vijaya.Tadavarthy@ness.com] 
Sent: 16 April 2012 12:15
To: 'solr-user@lucene.apache.org'
Subject: need help to integrate SolrJ with my web application.

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.

________________________________________


This e-mail is sent on behalf of Trader Media Group Limited, Registered Office: Auto Trader
House, Cutbush Park Industrial Estate, Danehill, Lower Earley, Reading, Berkshire, RG6 4UT(Registered
in England No. 4768833). This email and any files transmitted with it are confidential and
may be legally privileged, and intended solely for the use of the individual or entity to
whom they are addressed. If you have received this email in error please notify the sender.
This email message has been swept for the presence of computer viruses. 

Mime
View raw message