首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >spring-data-solr创建错误的url。两次添加核心名称

spring-data-solr创建错误的url。两次添加核心名称
EN

Stack Overflow用户
提问于 2017-02-13 15:03:18
回答 2查看 1K关注 0票数 2

在我的项目中,我得到了

org.springframework.data.solr.UncategorizedSolrException:错误从服务器在http://localhost:8983/solr/preauth:预期mime类型的应用程序/八位流,但得到了文本/html。

当任何操作出错时生成的URL。它两次包含核心名称。

堆叠痕迹:

代码语言:javascript
复制
<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/preauth/preauth/select. Reason:
<pre>    Not Found</pre></p>
</body>
</html>

solr两次包含核心名称"preauth“。

我的依赖性:

代码语言:javascript
复制
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-solr</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>

我的配置:

代码语言:javascript
复制
@Configuration
@EnableSolrRepositories(basePackages = { "com.abi.claimbook" }, multicoreSupport = true)
public class SolrConfig {

    @Value("${solr.claimbook.url}")
    private String host;

    @Bean
    public SolrClient solrClient() throws Exception {
    HttpSolrClientFactoryBean factory = new HttpSolrClientFactoryBean();
    factory.setUrl(host);
    factory.afterPropertiesSet();
    SolrClient client = factory.getSolrClient();
    return client;
    }

    @Bean
    public SolrTemplate solrTemplate(SolrClient solrClient) throws Exception {
    SolrTemplate solrTemplate = new SolrTemplate(solrClient);
    return solrTemplate;
    }

}

我的文件bean:

代码语言:javascript
复制
@SolrDocument(solrCoreName = "preauth")
public class Preauth {

    @Id
    @Indexed
    @Field
    private Integer preauthId;

    @Indexed
    @Field
    private String patientName;

    @Indexed
    @Field
    private String alNumber;
    .....
 Getters and setters...
.....

我的储藏室:

代码语言:javascript
复制
public interface SolrPreauthRepository extends SolrCrudRepository<Preauth, Integer> {

}
EN

回答 2

Stack Overflow用户

发布于 2017-03-21 15:32:44

这是由于当前版本中的一个错误造成的。

一个潜在的解决方法是将构建脚本中的Spring版本更新为以前的版本,而这不是这种情况,即v1.4.3.RELEASE。

例如Gradle:

代码语言:javascript
复制
buildscript {
    ext {
        springBootVersion = '1.4.3.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

更多bug信息:https://jira.spring.io/browse/DATASOLR-364

票数 3
EN

Stack Overflow用户

发布于 2017-04-05 06:35:58

这是一个已知的错误。他们已经修复了它,但它还没有发布。您可以使用快照发行版:

代码语言:javascript
复制
repositories {
    maven { 
        url "https://repo.spring.io/libs-snapshot" 
    }
}


dependencies {
    compile('org.springframework.data:spring-data-solr:2.2.0.DATASOLR-364-SNAPSHOT')
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42207148

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档