2015-08-28 64 views
0

我有一個Spring批處理作業,它從csv文件讀取數據並將其插入到Solr中。作業運行正常約30k記錄,但之後給出Solr連接拒絕錯誤。有人可以提出這裏有什麼問題嗎?我正在使用Solr的5.2.1版本。使用Spring批處理索引30K記錄後Solr連接拒絕錯誤

org.springframework.dao.DataAccessResourceFailureException: Connection to http://localhost:8983 refused; nested exception is org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:8983 refused 
    at org.springframework.data.solr.core.SolrExceptionTranslator.translateExceptionIfPossible(SolrExceptionTranslator.java:72) 
    at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:143) 
    at org.springframework.data.solr.core.SolrTemplate.saveBean(SolrTemplate.java:184) 
    at org.springframework.data.solr.core.SolrTemplate.saveBean(SolrTemplate.java:178) 
    at com.turvo.batch.carrier.writer.SolrWriter.write(SolrWriter.java:38) 
    at org.springframework.batch.item.support.CompositeItemWriter.write(CompositeItemWriter.java:51) 
    at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:175) 
    at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:151) 
    at org.springframework.batch.core.step.item.SimpleChunkProcessor.write(SimpleChunkProcessor.java:274) 
    at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:199) 
    at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75) 
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406) 
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330) 
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) 
    at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271) 
    at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81) 
    at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:262) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:8983 refused 
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190) 
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294) 
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640) 
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479) 
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) 
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) 
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784) 
    at org.apache.solr.client.solrj.impl.HttpSolrServer.executeMethod(HttpSolrServer.java:448) 
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:210) 
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:206) 
    at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:124) 
    at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116) 
    at org.springframework.data.solr.core.SolrTemplate$4.doInSolr(SolrTemplate.java:187) 
    at org.springframework.data.solr.core.SolrTemplate$4.doInSolr(SolrTemplate.java:184) 
    at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:141) 
    ... 16 more 
Caused by: java.net.ConnectException: Cannot assign requested address 
    at java.net.PlainSocketImpl.socketConnect(Native Method) 
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) 
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) 
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) 
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 
    at java.net.Socket.connect(Socket.java:589) 
    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127) 
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) 
    ... 30 more 

Solr的配置 -

<solr:repositories base-package="com.batch.repository" multicore-support="true"/> 
<solr:solr-server id="solrServer" url="${solr.hosts}"/> 

<bean id="solrTemplate" class="org.springframework.data.solr.core.SolrTemplate"> 
    <constructor-arg ref="solrServer" /> 
    <constructor-arg name="core" value="${solr.core}" /> 
</bean> 

回答

相關問題