简体   繁体   中英

Exception during integration test in new jhipster app with mongodb

When i create new jhipster app and run integration tests i have such exception:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mongodb.Mongo]: Factory method 'mongo' threw exception; nested exception is de.flapdoodle.embed.process.exceptions.DistributionException: java.io.EOFException: Unexpected end of ZLIB input stream
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    ... 147 common frames omitted
Caused by: de.flapdoodle.embed.process.exceptions.DistributionException: java.io.EOFException: Unexpected end of ZLIB input stream
    at de.flapdoodle.embed.process.runtime.Starter.prepare(Starter.java:65) ~[de.flapdoodle.embed.process-1.40.0.jar:na]
    at cz.jirutka.spring.embedmongo.EmbeddedMongoBuilder.build(EmbeddedMongoBuilder.java:99) ~[embedmongo-spring-1.3.0.jar:1.3.0]
    at pl.myapp.config.MongoConfiguration.mongo(MongoConfiguration.java:23) ~[test-classes/:na]
    at pl.myapp.config.MongoConfiguration$$EnhancerBySpringCGLIB$$c24baf13.CGLIB$mongo$0(<generated>) ~[spring-core-4.1.6.RELEASE.jar:na]
    at pl.myapp.config.MongoConfiguration$$EnhancerBySpringCGLIB$$c24baf13$$FastClassBySpringCGLIB$$fb7c7abc.invoke(<generated>) ~[spring-core-4.1.6.RELEASE.jar:na]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at pl.myapp.config.MongoConfiguration$$EnhancerBySpringCGLIB$$c24baf13.mongo(<generated>) ~[spring-core-4.1.6.RELEASE.jar:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25]
    at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    ... 148 common frames omitted

The solution is to change version in EmbeddedMongoBuilder which is used by mongo spring bean:

    @Bean
public Mongo mongo() throws IOException {
    System.setProperty("DB.TRACE","true");
    return new EmbeddedMongoBuilder()
            .version("2.6.10")
            .bindIp("127.0.0.1")
            .port(allocateRandomPort())
            .build();
}

看来您的JAR文件已损坏,是否尝试删除Maven存储库并重新安装库?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM