代码之家  ›  专栏  ›  技术社区  ›  a.k

java.lang.abstractMethodError和Spring数据ElasticSearch

  •  0
  • a.k  · 技术社区  · 6 年前

    我正在使用:

    • 这些版本:
      1. 弹簧芯4.3.7
      2. Spring数据ElasticSearch 3.0.9版本
      3. ES:“版本”:“6.3.0”
      4. org.elasticsearch.client:rest:5.5.0和transport:5.5.0
      5. Spring Data Commons 1.12.8.发布

    使用空接口创建了iauditelastecreaository.java:

    public interface IAuditElasticRepository extends ElasticsearchRepository<AuditDocument, String> {
    }
    

    创建了CH-Elastic.xml配置:

    <?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:elasticsearch="http://www.springframework.org/schema/data/elasticsearch"
           xmlns:context="http://www.springframework.org/schema/context"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/data/elasticsearch
    http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch-1.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
        <context:spring-configured />
        <context:annotation-config />
        <elasticsearch:repositories base-package="com.**.ch.db.elasticsearch" />
    </beans>
    

    在我的经理类中自动连接:

    @Autowired
    private IAuditElasticRepository elasticRepository;
    

    还有一个名为ch-db.xml的父XML,它将这个ch-relastic.xml导入它。

    我读过AbstractMethodError的最新文章,但找不到任何有用的东西。它与我的弹簧核心版本有关吗?

    堆栈跟踪:

    2018-07-30 07:02:25,472 INFO [org.springframework.data.repository.config.RepositoryConfigurationDelegate] - Multiple Spring Data modules found, entering strict repository configuration mode!
    2018-07-30 07:02:25,633 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/ch-db.xml]
    Offending resource: class path resource [META-INF/ch-ws.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/META-INF/ch-elasticsearch.xml]
    Offending resource: class path resource [META-INF/ch-db.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/ch-elasticsearch.xml]; nested exception is java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
        at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
    
    Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/META-INF/ch-elasticsearch.xml]
    Offending resource: class path resource [META-INF/ch-db.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/ch-elasticsearch.xml]; nested exception is java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
        at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/ch-elasticsearch.xml]; nested exception is java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
    Caused by: java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/ch-db.xml]
    Offending resource: class path resource [META-INF/ch-ws.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/META-INF/ch-elasticsearch.xml]
    Offending resource: class path resource [META-INF/ch-db.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/ch-elasticsearch.xml]; nested exception is java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
        at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
    Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/META-INF/ch-elasticsearch.xml]
    Offending resource: class path resource [META-INF/ch-db.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/ch-elasticsearch.xml]; nested exception is java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
        at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/ch-elasticsearch.xml]; nested exception is java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
    Caused by: java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
    2018-07-30 07:02:25,650 WARN [org.eclipse.jetty.util.component.AbstractLifeCycle] - FAILED o.e.j.w.WebAppContext{/ws,file:/C:/workspaces/ConnectedHome/Foundation/CH/main/ws/src/main/resources/webapp/}: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/ch-db.xml]
    Offending resource: class path resource [META-INF/ch-ws.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/META-INF/ch-elasticsearch.xml]
    Offending resource: class path resource [META-INF/ch-db.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/ch-elasticsearch.xml]; nested exception is java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/ch-db.xml]
    Offending resource: class path resource [META-INF/ch-ws.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/META-INF/ch-elasticsearch.xml]
    Offending resource: class path resource [META-INF/ch-db.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/ch-elasticsearch.xml]; nested exception is java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
        at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
    Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/META-INF/ch-elasticsearch.xml]
    Offending resource: class path resource [META-INF/ch-db.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/ch-elasticsearch.xml]; nested exception is java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
        at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/ch-elasticsearch.xml]; nested exception is java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
    Caused by: java.lang.AbstractMethodError: org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension.getRepositoryFactoryClassName()Ljava/lang/String;
        at org.springframework.data.repository.config.RepositoryBeanDefinitionBuilder.build(RepositoryBeanDefinitionBuilder.java:87)
    
    1 回复  |  直到 6 年前
        1
  •  3
  •   Maelig Joseph watson    6 年前

    spring version ==> 5.1.0.RC1

    spring data elastic search ==> 3.1.0.BUILD-SNAPSHOT

    <repositories>
        <repository>
            <id>spring-libs-snapshot</id>
            <name>Spring Snapshot Repository</name>
            <url>http://repo.spring.io/libs-snapshot</url>
        </repository>
    </repositories>