当我通过NetBeans打开测试类时,我在Spring Boot项目中有一个Junit测试类,它测试CRUD的方法->右键->测试文件测试运行正常,但是当我右键单击package和选择Test Package
会运行第一个测试,而第二个测试是我在启动时引用的文件完全失败(mvn clean package
或mvn test
会发生相同的错误)。
在我看来,这与测试中使用的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]
要放弃目录中的权限,请在目标/数据文件夹中运行命令chmod -R 777
。
已编辑
我正在做一些删除测试,我从全局实例中删除了@MockBean表示法,并且错误停止了发生(一定有冲突),但是如果没有@MockBean怎么办模拟呢?
答案 0 :(得分:0)
您需要将此添加到src / test / resources / config / application.yml:
spring:
data:
elasticsearch:
properties:
node:
max_local_storage_nodes: 2
请参阅:https://github.com/jhipster/generator-jhipster/issues/10302