Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot Junit测试因Elasticsearch而失败_Spring Boot_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Junit_Tdd_Jhipster - Fatal编程技术网 elasticsearch,junit,tdd,jhipster,Spring Boot,elasticsearch,Junit,Tdd,Jhipster" /> elasticsearch,junit,tdd,jhipster,Spring Boot,elasticsearch,Junit,Tdd,Jhipster" />

Spring boot Junit测试因Elasticsearch而失败

Spring boot Junit测试因Elasticsearch而失败,spring-boot,elasticsearch,junit,tdd,jhipster,Spring Boot,elasticsearch,Junit,Tdd,Jhipster,我在一个Spring Boot项目中有一个Junit测试类,它测试CRUD的方法,当我通过NetBeans->right button->test File打开测试类时,测试运行得很好,但当我右键单击包并选择test package时,第一个测试运行,第二个测试(我在启动时引用的文件)完全失败(同样的错误发生在mvn清洁包或mvn测试)上 在我看来,这似乎与测试中使用的elasticsearch目录有关 这是测试环境的application.yml: eureka: client:

我在一个Spring Boot项目中有一个Junit测试类,它测试CRUD的方法,当我通过NetBeans->right button->test File打开测试类时,测试运行得很好,但当我右键单击包并选择
test package
时,第一个测试运行,第二个测试(我在启动时引用的文件)完全失败(同样的错误发生在
mvn清洁包
mvn测试
)上

在我看来,这似乎与测试中使用的elasticsearch目录有关

这是测试环境的application.yml:

eureka:
    client:
        enabled: false
    instance:
        appname: account
        instanceId: account:${spring.application.instance-id:${random.value}}

spring:
    application:
        name: account
    cache:
        type: simple
    datasource:
        type: com.zaxxer.hikari.HikariDataSource
        url: jdbc:h2:mem:account;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
        name:
        username:
        password:
        hikari:
            auto-commit: false
    jpa:
        database-platform: io.github.jhipster.domain.util.FixedH2Dialect
        database: H2
        open-in-view: false
        show-sql: false
        hibernate:
            ddl-auto: none
            naming:
                physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
                implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
        properties:
            hibernate.id.new_generator_mappings: true
            hibernate.connection.provider_disables_autocommit: true
            hibernate.cache.use_second_level_cache: false
            hibernate.cache.use_query_cache: false
            hibernate.generate_statistics: false
            hibernate.hbm2ddl.auto: create-drop
            hibernate.jdbc.time_zone: UTC
    data:
        elasticsearch:
            properties:
                path:
                    home: target/elasticsearch
    liquibase:
        contexts: test
    mail:
        host: localhost
    messages:
        basename: i18n/messages
    mvc:
        favicon:
            enabled: false
    thymeleaf:
        mode: HTML


server:
    port: 10344
    address: localhost

# ===================================================================
# JHipster specific properties
#
# Full reference is available at: https://www.jhipster.tech/common-application-properties/
# ===================================================================

jhipster:
    async:
        core-pool-size: 1
        max-pool-size: 50
        queue-capacity: 10000
    # To test logstash appender
    logging:
        logstash:
            enabled: true
            host: localhost
            port: 5000
            queue-size: 512
    security:
        authentication:
            jwt:
                # This token must be encoded using Base64 (you can type `echo 'secret-key'|base64` on your command line)
                base64-secret: 783h78fh374h78h78dh278hd78dh3782dh3h278d3hd78h78dh378dh3h3782hd8h28dh8hd2782hd8h=
                # Token is valid 24 hours
                token-validity-in-seconds: 86400
        client-authorization:
            access-token-uri: http://uaa/oauth/token
            token-service-id: uaa
            client-id: internal
            client-secret: internal
    metrics:
        logs: # Reports metrics in the logs
            enabled: true
            report-frequency: 60 # in seconds
错误:

2019-07-11 18:37:44.649  WARN 11610 --- [           main] c.f.account.config.CacheConfiguration    : No discovery service is set up, Hazelcast cannot create a cluster.
2019-07-11 18:37:44.715  WARN 11610 --- [           main] com.hazelcast.instance.Node              : [172.31.0.1]:5701 [dev] [3.9.4] No join method is enabled! Starting standalone.
2019-07-11 18:37:45.608  WARN 11610 --- [           main] c.f.a.s.o.UaaSignatureVerifierClient     : could not contact UAA to get public key
2019-07-11 18:37:45.708  INFO 11610 --- [           main] c.f.account.config.CacheConfiguration    : Closing Cache Manager
18:37:45.734 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'elasticsearchTemplate' defined in class path resource [com/mycompany/account/config/ElasticsearchConfiguration.class]: Unsatisfied dependency expressed through method 'elasticsearchTemplate' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testClient' defined in class path resource [com/github/vanroy/springboot/autoconfigure/data/jest/ElasticsearchJestAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.searchbox.client.JestClient]: Factory method 'testClient' threw exception; nested exception is java.lang.IllegalStateException: failed to obtain node locks, tried [[target/elasticsearch/data/internal-test-cluster-name6ab7716d-f145-41dd-927f-b83333089285]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:733) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:475) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:548) ~[spring-context-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.0.8.RELEASE.jar:2.0.8.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.8.RELEASE.jar:2.0.8.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.0.8.RELEASE.jar:2.0.8.RELEASE]
    at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127) [spring-boot-test-2.0.8.RELEASE.jar:2.0.8.RELEASE]
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) [spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) [spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]

    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) [surefire-booter-2.22.1.jar:2.22.1]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testClient' defined in class path resource [com/github/vanroy/springboot/autoconfigure/data/jest/ElasticsearchJestAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.searchbox.client.JestClient]: Factory method 'testClient' threw exception; nested exception is java.lang.IllegalStateException: failed to obtain node locks, tried [[target/elasticsearch/data/internal-test-cluster-name6ab7716d-f145-41dd-927f-b83333089285]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:591) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.searchbox.client.JestClient]: Factory method 'testClient' threw exception; nested exception is java.lang.IllegalStateException: failed to obtain node locks, tried [[target/elasticsearch/data/internal-test-cluster-name6ab7716d-f145-41dd-927f-b83333089285]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:583) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]

Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[target/elasticsearch/data/internal-test-cluster-name6ab7716d-f145-41dd-927f-b83333089285]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
    at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:265) ~[elasticsearch-5.6.14.jar:5.6.14]
    at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-5.6.14.jar:5.6.14]
    at com.github.vanroy.springboot.autoconfigure.data.jest.ElasticsearchJestAutoConfiguration$InternalNode.<init>(ElasticsearchJestAutoConfiguration.java:199) ~[spring-boot-starter-data-jest-3.1.5.RELEASE.jar:?]
    at com.github.vanroy.springboot.autoconfigure.data.jest.ElasticsearchJestAutoConfiguration.createInternalNode(ElasticsearchJestAutoConfiguration.java:167) ~[spring-boot-starter-data-jest-3.1.5.RELEASE.jar:?]
    at com.github.vanroy.springboot.autoconfigure.data.jest.ElasticsearchJestAutoConfiguration.testClient(ElasticsearchJestAutoConfiguration.java:81) ~[spring-boot-starter-data-jest-3.1.5.RELEASE.jar:?]
    at com.github.vanroy.springboot.autoconfigure.data.jest.ElasticsearchJestAutoConfiguration$$EnhancerBySpringCGLIB$$8f46f0b2.CGLIB$testClient$1(<generated>) ~[spring-boot-starter-data-jest-3.1.5.RELEASE.jar:?]
    at com.github.vanroy.springboot.autoconfigure.data.jest.ElasticsearchJestAutoConfiguration$$EnhancerBySpringCGLIB$$8f46f0b2$$FastClassBySpringCGLIB$$e4311738.invoke(<generated>) ~[spring-boot-starter-data-jest-3.1.5.RELEASE.jar:?]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    mework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:725) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    ... 45 more
18:37:45.745 [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@4a801c2a] to prepare test instance [com.mycompany.account.web.rest.UserSystemResourceIntTest@3f5b4923]
java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) [spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) [spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) [spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) [spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) [spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) [spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'elasticsearchTemplate' defined in class path resource [com/mycompany/account/config/ElasticsearchConfiguration.class]: Unsatisfied dependency expressed through method 'elasticsearchTemplate' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testClient' defined in class path resource [com/github/vanroy/springboot/autoconfigure/data/jest/ElasticsearchJestAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.searchbox.client.JestClient]: Factory method 'testClient' threw exception; nested exception is java.lang.IllegalStateException: failed to obtain node locks, tried [[target/elasticsearch/data/internal-test-cluster-name6ab7716d-f145-41dd-927f-b83333089285]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:733) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:475) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testClient' defined in class path resource [com/github/vanroy/springboot/autoconfigure/data/jest/ElasticsearchJestAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.searchbox.client.JestClient]: Factory method 'testClient' threw exception; nested exception is java.lang.IllegalStateException: failed to obtain node locks, tried [[target/elasticsearch/data/internal-test-cluster-name6ab7716d-f145-41dd-927f-b83333089285]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:591) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.searchbox.client.JestClient]: Factory method 'testClient' threw exception; nested exception is java.lang.IllegalStateException: failed to obtain node locks, tried [[target/elasticsearch/data/internal-test-cluster-name6ab7716d-f145-41dd-927f-b83333089285]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:583) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]

Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[target/elasticsearch/data/internal-test-cluster-name6ab7716d-f145-41dd-927f-b83333089285]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
    at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:265) ~[elasticsearch-5.6.14.jar:5.6.14]
    at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-5.6.14.jar:5.6.14]
    at com.github.vanroy.springboot.autoconfigure.data.jest.ElasticsearchJestAutoConfiguration$InternalNode.<init>(ElasticsearchJestAutoConfiguration.java:199) ~[spring-boot-starter-data-jest-3.1.5.RELEASE.jar:?]
    at com.github.vanroy.springboot.autoconfigure.data.jest.ElasticsearchJestAutoConfiguration.createInternalNode(ElasticsearchJestAutoConfiguration.java:167) ~[spring-boot-starter-data-jest-3.1.5.RELEASE.jar:?]
    at com.github.vanroy.springboot.autoconfigure.data.jest.ElasticsearchJestAutoConfiguration.testClient(ElasticsearchJestAutoConfiguration.java:81) ~[spring-boot-starter-data-jest-3.1.5.RELEASE.jar:?]
    at com.github.vanroy.springboot.autoconfigure.data.jest.ElasticsearchJestAutoConfiguration$$EnhancerBySpringCGLIB$$8f46f0b2.CGLIB$testClient$1(<generated>) ~[spring-boot-starter-data-jest-3.1.5.RELEASE.jar:?]
    at com.github.vanroy.springboot.autoconfigure.data.jest.ElasticsearchJestAutoConfiguration$$EnhancerBySpringCGLIB$$8f46f0b2$$FastClassBySpringCGLIB$$e4311738.invoke(<generated>) ~[spring-boot-starter-data-jest-3.1.5.RELEASE.jar:?]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:365) ~[spring-context-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    at com.github.vanroy.springboot.autoconfigure.data.jest.ElasticsearchJestAutoConfiguration$$EnhancerBySpringCGLIB$$8f46f0b2.testClient(<generated>) ~[spring-boot-starter-data-jest-3.1.5.RELEASE.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_211]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_211]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
2019-07-11 18:37:44.649警告11610---[main]c.f.account.config.CacheConfiguration:未设置发现服务,Hazelcast无法创建群集。
2019-07-11 18:37:44.715警告11610---[main]com.hazelcast.instance.Node:[172.31.0.1]:5701[dev][3.9.4]未启用连接方法!正在独立启动。
2019-07-11 18:37:45.608警告11610---[main]c.f.a.s.o.UaaSignatureVerifierClient:无法联系UAA获取公钥
2019-07-11 18:37:45.708信息11610---[main]c.f.account.config.CacheConfiguration:关闭缓存管理器
18:37:45.734[main]错误org.springframework.boot.SpringApplication-应用程序运行失败
org.springframework.beans.factory.unsatifiedDependencyException:创建名为“elasticsearchTemplate”的bean时出错,该bean在类路径资源[com/mycompany/account/config/ElasticsearchConfiguration.class]中定义:通过方法“elasticsearchTemplate”参数0表示的未满足的依赖关系;嵌套异常为org.springframework.beans.factory.BeanCreationException:创建名为“testClient”的bean时出错,该bean在类路径资源[com/github/vanroy/springboot/autoconfigure/data/jest/elasticSearchJestutoconfiguration.class]中定义:通过工厂方法实例化Bean失败;嵌套异常为org.springframework.beans.BeanInstantiationException:未能实例化[io.searchbox.client.JestClient]:工厂方法“testClient”引发异常;嵌套异常为java.lang.IllegalStateException:未能获取节点锁,已尝试[[target/elasticsearch/data/internal-test-cluster-name6ab7716d-f145-41dd-927f-b83333089285]]具有锁id[0];可能这些位置不可写,或者在未增加[node.max_local_storage_nodes](was[1])的情况下启动了多个节点?
在org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:733)~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.beans.factory.support.ConstructorResolver.InstanceUsingFactoryMethod(ConstructorResolver.java:475)~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.InstanceUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1246)~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.beans.factory.support.DefaultListableBeanFactory.PreInstanceSingleton(DefaultListableBeanFactory.java:759)~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)~[spring-context-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:548)~[spring-context-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)[spring-boot-2.0.8.RELEASE.jar:2.0.8.RELEASE]
位于org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)[spring-boot-2.0.8.RELEASE.jar:2.0.8.RELEASE]
在org.springframework.boot.SpringApplication.run(SpringApplication.java:307)[spring-boot-2.0.8.RELEASE.jar:2.0.8.RELEASE]
在org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127)[spring-boot-test-2.0.8.RELEASE.jar:2.0.8.RELEASE]
在org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
在org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
位于org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)[surefire-booter-2.22.1.jar:2.22.1]
原因:org.springframework.beans.factory.BeanCreationException:创建名为“testClient”的bean时出错
spring:
  data:
    elasticsearch:
      properties:
        node:
          max_local_storage_nodes: 2