Solr Spring引导在访问Solr服务器时在URL中插入一个额外的核心名称。 从以下错误可以看出这一点。 初始错误正确地指出了URL,但是从Solr返回的http错误表明访问的URL与核心(工作空间)重复。
错误
Caused by: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://x.x.x.x:8983/solr/workspaces: Expected mime type application/octet-stream but got text/html. <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error 404 Not Found</title> </head> <body><h2>HTTP ERROR 404</h2> <p>Problem accessing /solr/workspaces/workspaces/select. Reason: <pre> Not Found</pre></p> </body> </html>Document.java
@SolrDocument(solrCoreName="workspaces") public class Workspace { }在SolrContext.java中定义另外,“multicoreSupport = true”在顶部
@Bean public SolrClient solrClient() { SolrClient retval = new HttpSolrClient.Builder(environment.getRequiredProperty(PROPERTY_NAME_SOLR_SERVER_URL)).build(); return retval; } @Bean public SolrTemplate solrTemplate() { return new SolrTemplate(solrClient()); }我曾尝试在一个点上添加额外的@Beans和SolrTemplate,每个核心一个。 然后,该URL最终将每个核心附加到URL。 很奇怪。 我访问的存储库非常标准。
public interface WorkspaceRepository extends SolrCrudRepository<Workspace, String> { List<Workspace> findByUserId(String userId); }这是使用:
弹簧引导起动数据的Solr,1.5.1.RELEASE Solr的-solrj-6.3.0 弹簧数据的solr-2.1.0.RELEASE注意,我从使用spring-data-solr-2.1.0定义的默认solr-solrj开始,但是遇到了同样的问题,所以我把它增加到了6.3.0。
无论如何,我希望有人之前见过这个,并且可以添加一些关于我做错的指导。
谢谢
Solr Spring boot is inserting an additional core name in the url when accessing the Solr server. This can be seen from the following error. The initial error correctly states the URL, but the http error returned from Solr states that the URL accessed duplicated the core (workspaces).
Error
Caused by: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://x.x.x.x:8983/solr/workspaces: Expected mime type application/octet-stream but got text/html. <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error 404 Not Found</title> </head> <body><h2>HTTP ERROR 404</h2> <p>Problem accessing /solr/workspaces/workspaces/select. Reason: <pre> Not Found</pre></p> </body> </html>Document.java
@SolrDocument(solrCoreName="workspaces") public class Workspace { }Defined in SolrContext.java Also, "multicoreSupport = true" at top
@Bean public SolrClient solrClient() { SolrClient retval = new HttpSolrClient.Builder(environment.getRequiredProperty(PROPERTY_NAME_SOLR_SERVER_URL)).build(); return retval; } @Bean public SolrTemplate solrTemplate() { return new SolrTemplate(solrClient()); }I attempted at one point adding additional @Beans with SolrTemplate, one for each core. The url then ended up appending each of the cores to the url. Very odd. The repository I am accessing is pretty standard.
public interface WorkspaceRepository extends SolrCrudRepository<Workspace, String> { List<Workspace> findByUserId(String userId); }This is using:
spring-boot-starter-data-solr-1.5.1.RELEASE solr-solrj-6.3.0 spring-data-solr-2.1.0.RELEASENote, I started with the default solr-solrj that was defined with spring-data-solr-2.1.0, but got the same issue so I upped it to 6.3.0.
Anyway, I hope someone has seen this before and can add a little guidance as to what I am doing wrong.
Thanks
最满意答案
我有完全相同的问题,并通过使用Spring Boot版本1.4.3.RELEASE而不是1.5.1.RELEASE来解决它...
I had the exact same problem and solved it by using Spring Boot version 1.4.3.RELEASE, instead of 1.5.1.RELEASE...
更多推荐
发布评论