我正在尝试设置Solandra(Solr + Cassandra),并使用SolrJ库来使用它。我设法使用SolrJ设置所有内容并添加一些文档,但是当我尝试进行查询时,它失败了。我试图通过url执行查询但它也失败了。 我用过:
http://localhost:8983/solandra/my_core/select?q=*:*&wt=xml
在我的应用中,我使用了以下代码:
CommonsHttpSolrServer server = new CommonsHttpSolrServer(url);
server.setParser(new XMLResponseParser());
SolrQuery query = new SolrQuery();
query.setQuery("some");
query.setStart(0);
query.setRows(10);
QueryResponse response = server.query(query);
这是我得到的堆栈跟踪:
org.apache.solr.common.SolrException:java.lang.StackOverflowError at at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:281) 在 org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129) 在org.apache.solr.core.SolrCore.execute(SolrCore.java:1368)at at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356) 在 solandra.SolandraDispatchFilter.execute(SolandraDispatchFilter.java:171) 在 org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252) 在 solandra.SolandraDispatchFilter.doFilter(SolandraDispatchFilter.java:137) 在 org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1212) 在 org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) 在 org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) 在 org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) 在 org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 在org.mortbay.jetty.Server.handle(Server.java:326)处 org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) 在 org.mortbay.jetty.HttpConnection $ RequestHandler.headerComplete(HttpConnection.java:928) 在org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)at at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)at at org.mortbay.jetty.bio.SocketConnector $ Connection.run(SocketConnector.java:228) 在 org.mortbay.thread.QueuedThreadPool $ PoolThread.run(QueuedThreadPool.java:582) 引起:java.lang.StackOverflowError at java.net.SocketInputStream.socketRead0(Native Method)at java.net.SocketInputStream.read(SocketInputStream.java:150)at java.net.SocketInputStream.read(SocketInputStream.java:121)at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)at java.io.BufferedInputStream.read(BufferedInputStream.java:254)at org.apache.commons.httpclient.HttpConnection.isStale(HttpConnection.java:506) 在 org.apache.commons.httpclient.HttpConnection.closeIfStale(HttpConnection.java:431) 在 org.apache.commons.httpclient.MultiThreadedHttpConnectionManager $ HttpConnectionAdapter.closeIfStale(MultiThreadedHttpConnectionManager.java:1313) 在 org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:382) 在 org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) 在 org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) 在 org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) 在 org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:422) 在 org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:244) 在 org.apache.solr.handler.component.HttpCommComponent $ 1.call(SearchHandler.java:421) 在 org.apache.solr.handler.component.HttpCommComponent $ 1.call(SearchHandler.java:393) at java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:334) 在java.util.concurrent.FutureTask.run(FutureTask.java:166)at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:334) 在java.util.concurrent.FutureTask.run(FutureTask.java:166)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 在 java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:615) 在java.lang.Thread.run(Thread.java:722)
可能是因为我错过了schema.xml中的内容吗?这就是它的样子:
<schema name="my_core" version="1.1">
<types>
<fieldType name="string" class="solr.StrField"/>
<fieldType name="text_general_rev" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ReversedWildcardFilterFactory" withOriginal="true" maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
</types>
<fields>
<field name="url" type="string" indexed="true" stored="true"/>
<field name="content" type="text_general_rev" indexed="true" stored="true"/>
<field name="media" type="string" indexed="true" stored="true"/>
<field name="country" type="string" indexed="true" stored="true"/>
<field name="date" type="string" indexed="true" stored="true"/>
</fields>
<defaultSearchField>content</defaultSearchField>
<uniqueKey>url</uniqueKey>
</schema>
答案 0 :(得分:1)
我解决了。我在solandra.in.env文件中增加了堆栈大小。所以如果有人遇到同样的问题,我会设置-Xss512k参数。