Question

I am working with solr to index pdf and doc files. I am working with the bitnami stack (http://bitnami.com/stack/solr)

now I add the following code to my c# app:

    string filecontent = null;

    using (var file = File.OpenRead(@"C:\\cookbook.pdf"))
    {
        var response = solr.Extract(new ExtractParameters(file, "abcd1")
        {
            ExtractOnly = true,
            ExtractFormat = ExtractFormat.Text,
        });

        filecontent = response.Content;
    }
    solr.Commit();

thats what I did so far, see Index pdf documents in Solr from C# client

unfortunately I always get the following exception:

SolrNet.Exceptions.SolrConnectionException was unhandled
  HResult=-2146232832
  Message=<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="error"><str name="msg">lazy loading error</str><str name="trace">org.apache.solr.common.SolrException: lazy loading error
    at org.apache.solr.core.RequestHandlers$LazyRequestHandlerWrapper.getWrappedHandler(RequestHandlers.java:258)
    at org.apache.solr.core.RequestHandlers$LazyRequestHandlerWrapper.handleRequest(RequestHandlers.java:240)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1797)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:637)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:343)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:141)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:365)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
    at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:642)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
    at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
    at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.solr.common.SolrException: Error loading class 'solr.extraction.ExtractingRequestHandler'
    at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:440)
    at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:519)
    at org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:593)
    at org.apache.solr.core.RequestHandlers$LazyRequestHandlerWrapper.getWrappedHandler(RequestHandlers.java:249)
    ... 30 more
Caused by: java.lang.ClassNotFoundException: solr.extraction.ExtractingRequestHandler
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:789)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:266)
    at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:424)
    ... 33 more
</str><int name="code">500</int></lst>
</response>

  Source=SolrNet
  Url=http://berserkerpc:444/solr/update/extract?literal.id=abcd1&resource.name=C:%5ccookbook.pdf&extractOnly=true&extractFormat=text&version=2.2
  StackTrace:
       bei SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters) in c:\Users\troth\Desktop\SolrNet-master\SolrNet\Impl\SolrConnection.cs:Zeile 119.
       bei SolrNet.Commands.ExtractCommand.Execute(ISolrConnection connection) in c:\Users\troth\Desktop\SolrNet-master\SolrNet\Commands\ExtractCommand.cs:Zeile 36.
       bei SolrNet.Impl.SolrBasicServer`1.Send(ISolrCommand cmd) in c:\Users\troth\Desktop\SolrNet-master\SolrNet\Impl\SolrBasicServer.cs:Zeile 102.
       bei SolrNet.Impl.SolrBasicServer`1.SendAndParseExtract(ISolrCommand cmd) in c:\Users\troth\Desktop\SolrNet-master\SolrNet\Impl\SolrBasicServer.cs:Zeile 106.
       bei SolrNet.Impl.SolrBasicServer`1.Extract(ExtractParameters parameters) in c:\Users\troth\Desktop\SolrNet-master\SolrNet\Impl\SolrBasicServer.cs:Zeile 83.
       bei SolrNet.Impl.SolrServer`1.Extract(ExtractParameters parameters) in c:\Users\troth\Desktop\SolrNet-master\SolrNet\Impl\SolrServer.cs:Zeile 133.
       bei SolrTest.Program.IndexPDFFile(ISolrOperations`1 solr) in c:\Users\troth\Desktop\SolrTest\SolrTest\Program.cs:Zeile 35.
       bei SolrTest.Program.Main(String[] args) in c:\Users\troth\Desktop\SolrTest\SolrTest\Program.cs:Zeile 21.
       bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       bei System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Net.WebException
       HResult=-2146233079
       Message=Der Remoteserver hat einen Fehler zurückgegeben: (500) Interner Serverfehler.
       Source=System
       StackTrace:
            bei System.Net.HttpWebRequest.GetResponse()
            bei HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse() in c:\Users\troth\Desktop\SolrNet-master\HttpWebAdapters\Impl\HttpWebRequestAdapter.cs:Zeile 36.
            bei SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request) in c:\Users\troth\Desktop\SolrNet-master\SolrNet\Impl\SolrConnection.cs:Zeile 193.
            bei SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters) in c:\Users\troth\Desktop\SolrNet-master\SolrNet\Impl\SolrConnection.cs:Zeile 111.
       InnerException:

any hints what I can do to solve this issue?

thanks, tro

Was it helpful?

Solution 2

got it! the problem was in the solrconfig.xml file. I had to paste the following code:

<lib dir="../../extract" regex=".*\.jar" />

  <requestHandler name="/update/extract" 
                  startup="lazy"
                  class="solr.extraction.ExtractingRequestHandler" >
    <lst name="defaults">
      <str name="lowernames">true</str>
      <str name="uprefix">ignored_</str>

      <!-- capture link hrefs but ignore div attributes -->
      <str name="captureAttr">true</str>
      <str name="fmap.a">links</str>
      <str name="fmap.div">ignored_</str>
    </lst>
  </requestHandler>

thank you for the help!

tro

OTHER TIPS

In examining the error log, this looks to be the main issue here:

Caused by: org.apache.solr.common.SolrException: Error loading class 'solr.extraction.ExtractingRequestHandler'

It does not appear that Solr can load the solr.extraction.ExtractingRequestHandler class.

Did you follow the steps from the link you provided to put add the Solr Cell and extraction jar files into a library folder that your Solr install can load them from?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top