SolrJ嵌入式服务器Spring配置不再工作
我在测试中使用了这个spring配置:SolrJ嵌入式服务器Spring配置不再工作,spring,spring-data,solrj,Spring,Spring Data,Solrj,我在测试中使用了这个spring配置: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:solr="http://www.springframework.org/schema/data/solr" xs
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:solr="http://www.springframework.org/schema/data/solr"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/data/solr
http://www.springframework.org/schema/data/solr/spring-solr-1.0.xsd">
<solr:embedded-solr-server id="tgySolrServer" solrHome="target/test-classes" />
</beans>
现在抛出此异常
Caused by: java.lang.NoSuchMethodError: org.apache.solr.core.CoreContainer.<init>(Ljava/lang/String;Ljava/io/File;)V
at org.springframework.data.solr.server.support.EmbeddedSolrServerFactory.createPathConfiguredSolrServer(EmbeddedSolrServerFactory.java:101)
at org.springframework.data.solr.server.support.EmbeddedSolrServerFactory.initSolrServer(EmbeddedSolrServerFactory.java:77)
at org.springframework.data.solr.server.support.EmbeddedSolrServerFactoryBean.afterPropertiesSet(EmbeddedSolrServerFactoryBean.java:36)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
... 40 more
原因:java.lang.NoSuchMethodError:org.apache.solr.core.CoreContainer.(Ljava/lang/String;Ljava/io/File;)V
位于org.springframework.data.solr.server.support.EmbeddedSolrServerFactory.createPathConfiguredSolrServer(EmbeddedSolrServerFactory.java:101)
位于org.springframework.data.solr.server.support.EmbeddedSolrServerFactory.initSolrServer(EmbeddedSolrServerFactory.java:77)
位于org.springframework.data.solr.server.support.EmbeddedSolrServerFactoryBean.AfterPropertieSet(EmbeddedSolrServerFactoryBean.java:36)
位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
... 40多
我目前有Solr4.5.0和spring数据Solr1.0.0-RELEASE。我应该怎么做才能在测试中使用嵌入式服务器呢?我现在就可以使用了
我们需要向pom.xml
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-solr</artifactId>
<version>1.1.0.BUILD-SNAPSHOT</version>
</dependency>
<repositories>
<repository>
<id>spring-maven-snapshot</id>
<url>http://repo.springsource.org/libs-snapshot</url>
</repository>
</repositories>
org.springframework.data
弹簧数据解算器
1.1.0.1构建快照
SpringMaven快照
http://repo.springsource.org/libs-snapshot
就这样 你找到解决办法了吗?到目前为止还没有。但我还没有挖得更远