You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by ph...@free.fr on 2015/03/19 14:18:20 UTC

Connection pool shutdown error

Hello,

I am trying to use the 4.9.1 SOLR Core API and the 1.3.2.RELEASE version of the Spring Data SOLR API, to connect to a SOLR server, but to no avail.

When I run Java application, I get the following errors:

---------------------------

Exception in thread "main" org.springframework.data.solr.UncategorizedSolrException: Error executing query; nested exception is org.apache.solr.client.solrj.SolrServerException: Error executing query
...
Caused by: java.lang.IllegalStateException: Connection pool shut down

---------------------

I have tried changing Core API version (4.3.0, 4.4.0, ...) but to no avail.

Any help would be much appreciated.

Cheers,

Philippe




Here's my Solr Context:

----------------------------

package com.myco.archives.SolrGuiMain;

....

@Configuration
@EnableSolrRepositories(basePackages = { "com.myco.archives" }, multicoreSupport = false)
@ComponentScan
public class SolrContext {

	private final String	HTTP_SEARCHARCHIVES	= "http://mysolr.com:8990/solr/collection3";

	@Bean
	public SolrServer solrServer() {
		SolrServer server = new HttpSolrServer(HTTP_SEARCHARCHIVES);
		return server;
	}

	@Bean
	public SolrOperations solrTemplate() {
		return new SolrTemplate(solrServer());
	}

}

-------------------------------------

Here's my Repository Class:

import org.springframework.data.repository.CrudRepository;

public interface ArchiveDocumentRepository extends CrudRepository<Document, Long> {

	List<Document> findByText(String text);

	List<Document> findByYmd(Date ymd);

}


----------------------------------------

And here's my App:

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class App
{

	private ArchiveDocumentRepository	archiveDocumentRepository;

	public App() {

		setContext();
		processDocs();


	}
	public static void main(String[] args) {

		new App();

	}

	public void setContext() throws RuntimeException {

		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SolrContext.class);

		if (context != null) {
			setArchiveDocumentRepository(context.getBean(ArchiveDocumentRepository.class));
		}
		context.close();
	}

	public final ArchiveDocumentRepository getArchiveDocumentRepository() {
		return archiveDocumentRepository;
	}

	public final void setArchiveDocumentRepository(ArchiveDocumentRepository archiveDocumentRepository) {
		this.archiveDocumentRepository = archiveDocumentRepository;
	}

	public void processDocs() {


		Iterable<Document> docs = getArchiveDocumentRepository().findAll();

		for (Document doc : docs) {
			System.out.println("doc count = " + doc.getYmd());
		}

	}

}


-------------------------------------------









Re: Connection pool shutdown error

Posted by Andrea Gazzarini <a....@gmail.com>.
I bet the problem is how the SolrServer instance is used within Spring 
Repository. I think somewhere you should alternatively

- explicitly close the client each time.
- reuse the same instance (and finally close that)

But being a Spring newbie I cannot give you further information.

Best,
Andrea

On 03/19/2015 02:18 PM, phiroc@free.fr wrote:
> Hello,
>
> I am trying to use the 4.9.1 SOLR Core API and the 1.3.2.RELEASE version of the Spring Data SOLR API, to connect to a SOLR server, but to no avail.
>
> When I run Java application, I get the following errors:
>
> ---------------------------
>
> Exception in thread "main" org.springframework.data.solr.UncategorizedSolrException: Error executing query; nested exception is org.apache.solr.client.solrj.SolrServerException: Error executing query
> ...
> Caused by: java.lang.IllegalStateException: Connection pool shut down
>
> ---------------------
>
> I have tried changing Core API version (4.3.0, 4.4.0, ...) but to no avail.
>
> Any help would be much appreciated.
>
> Cheers,
>
> Philippe
>
>
>
>
> Here's my Solr Context:
>
> ----------------------------
>
> package com.myco.archives.SolrGuiMain;
>
> ....
>
> @Configuration
> @EnableSolrRepositories(basePackages = { "com.myco.archives" }, multicoreSupport = false)
> @ComponentScan
> public class SolrContext {
>
> 	private final String	HTTP_SEARCHARCHIVES	= "http://mysolr.com:8990/solr/collection3";
>
> 	@Bean
> 	public SolrServer solrServer() {
> 		SolrServer server = new HttpSolrServer(HTTP_SEARCHARCHIVES);
> 		return server;
> 	}
>
> 	@Bean
> 	public SolrOperations solrTemplate() {
> 		return new SolrTemplate(solrServer());
> 	}
>
> }
>
> -------------------------------------
>
> Here's my Repository Class:
>
> import org.springframework.data.repository.CrudRepository;
>
> public interface ArchiveDocumentRepository extends CrudRepository<Document, Long> {
>
> 	List<Document> findByText(String text);
>
> 	List<Document> findByYmd(Date ymd);
>
> }
>
>
> ----------------------------------------
>
> And here's my App:
>
> import org.springframework.context.annotation.AnnotationConfigApplicationContext;
>
> public class App
> {
>
> 	private ArchiveDocumentRepository	archiveDocumentRepository;
>
> 	public App() {
>
> 		setContext();
> 		processDocs();
>
>
> 	}
> 	public static void main(String[] args) {
>
> 		new App();
>
> 	}
>
> 	public void setContext() throws RuntimeException {
>
> 		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SolrContext.class);
>
> 		if (context != null) {
> 			setArchiveDocumentRepository(context.getBean(ArchiveDocumentRepository.class));
> 		}
> 		context.close();
> 	}
>
> 	public final ArchiveDocumentRepository getArchiveDocumentRepository() {
> 		return archiveDocumentRepository;
> 	}
>
> 	public final void setArchiveDocumentRepository(ArchiveDocumentRepository archiveDocumentRepository) {
> 		this.archiveDocumentRepository = archiveDocumentRepository;
> 	}
>
> 	public void processDocs() {
>
>
> 		Iterable<Document> docs = getArchiveDocumentRepository().findAll();
>
> 		for (Document doc : docs) {
> 			System.out.println("doc count = " + doc.getYmd());
> 		}
>
> 	}
>
> }
>
>
> -------------------------------------------
>
>
>
>
>
>
>
>