在我的项目中,我得到了
org.springframework.data.solr.UncategorizedSolrException:错误从服务器在http://localhost:8983/solr/preauth:预期mime类型的应用程序/八位流,但得到了文本/html。
当任何操作出错时生成的URL。它两次包含核心名称。
堆叠痕迹:
<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“。
我的依赖性:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-solr</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>我的配置:
@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:
@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...
.....我的储藏室:
public interface SolrPreauthRepository extends SolrCrudRepository<Preauth, Integer> {
}发布于 2017-03-21 15:32:44
这是由于当前版本中的一个错误造成的。
一个潜在的解决方法是将构建脚本中的Spring版本更新为以前的版本,而这不是这种情况,即v1.4.3.RELEASE。
例如Gradle:
buildscript {
ext {
springBootVersion = '1.4.3.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}发布于 2017-04-05 06:35:58
这是一个已知的错误。他们已经修复了它,但它还没有发布。您可以使用快照发行版:
repositories {
maven {
url "https://repo.spring.io/libs-snapshot"
}
}
dependencies {
compile('org.springframework.data:spring-data-solr:2.2.0.DATASOLR-364-SNAPSHOT')
}https://stackoverflow.com/questions/42207148
复制相似问题