首页 > 解决方案 > Java 项目因“hazelcastInstance”错误和“undertowEmbeddedServletContainerFactory”错误而失败

问题描述

我有一个带有 Jhipster (5.5.0) 和 Spring 的 Java 程序。当我使用它运行该站点时,./mvnw它工作正常。在过去的几个月里,当我用它编译它mvn install -Pprod -DskipTests=true然后用它运行它时java -jar mysite.jar,它工作得很好。然而。. . 今天java -jar mysite.jar一直失败,给出以下错误。

这首先是在另一个人的机器上报告的,因为他们在过去 2 天里运行 JAR 很好,然后今天它失败了。所以有0个代码更改。然后我在我的机器上尝试了它,它也失败了,即使在重新编译之后也是如此。我对这种“hazelcast”的东西一无所知,所以我什至没有使用它——Jhipster 或 Spring 一定在使用它。但我不确定为什么这会随机失败。

2019-01-23 11:58:57.953  INFO 51656 --- [           main] c.h.i.cluster.impl.MulticastJoiner       : [10.3.2.121]:5701 [dev] [3.7.8] Trying to join to discovered node: [10.3.2.160]:5701
2019-01-23 11:59:28.117  INFO 51656 --- [           main] c.h.i.cluster.impl.MulticastJoiner       : [10.3.2.121]:5701 [dev] [3.7.8] Trying to join to discovered node: [10.3.2.160]:5701
2019-01-23 11:59:58.303  INFO 51656 --- [           main] c.h.i.cluster.impl.MulticastJoiner       : [10.3.2.121]:5701 [dev] [3.7.8] Trying to join to discovered node: [10.3.2.160]:5701
2019-01-23 12:00:28.585  INFO 51656 --- [           main] c.h.i.cluster.impl.MulticastJoiner       : [10.3.2.121]:5701 [dev] [3.7.8] Trying to join to discovered node: [10.3.2.160]:5701
2019-01-23 12:00:58.739  INFO 51656 --- [           main] c.h.i.cluster.impl.MulticastJoiner       : [10.3.2.121]:5701 [dev] [3.7.8] Trying to join to discovered node: [10.3.2.160]:5701
2019-01-23 12:01:28.925  INFO 51656 --- [           main] c.h.i.cluster.impl.MulticastJoiner       : [10.3.2.121]:5701 [dev] [3.7.8] Trying to join to discovered node: [10.3.2.160]:5701
2019-01-23 12:01:59.091  INFO 51656 --- [           main] c.h.i.cluster.impl.MulticastJoiner       : [10.3.2.121]:5701 [dev] [3.7.8] Trying to join to discovered node: [10.3.2.160]:5701
2019-01-23 12:02:29.269  INFO 51656 --- [           main] c.h.i.cluster.impl.MulticastJoiner       : [10.3.2.121]:5701 [dev] [3.7.8] Trying to join to discovered node: [10.3.2.160]:5701
2019-01-23 12:02:59.358 ERROR 51656 --- [           main] com.hazelcast.instance.Node              : [10.3.2.121]:5701 [dev] [3.7.8] Could not join cluster in 300000 ms. Shutting down now!
2019-01-23 12:02:59.369  INFO 51656 --- [           main] com.hazelcast.core.LifecycleService      : [10.3.2.121]:5701 [dev] [3.7.8] [10.3.2.121]:5701 is SHUTTING_DOWN
2019-01-23 12:02:59.370  WARN 51656 --- [           main] com.hazelcast.instance.Node              : [10.3.2.121]:5701 [dev] [3.7.8] Terminating forcefully...
2019-01-23 12:02:59.370  INFO 51656 --- [           main] com.hazelcast.instance.Node              : [10.3.2.121]:5701 [dev] [3.7.8] Shutting down multicast service...
2019-01-23 12:02:59.372  INFO 51656 --- [           main] com.hazelcast.instance.Node              : [10.3.2.121]:5701 [dev] [3.7.8] Shutting down connection manager...
2019-01-23 12:02:59.376  INFO 51656 --- [           main] com.hazelcast.nio.tcp.TcpIpConnection    : [10.3.2.121]:5701 [dev] [3.7.8] Connection[id=1, /10.3.2.121:59390->/10.3.2.160:5701, endpoint=[10.3.2.160]:5701, alive=false, type=NONE] closed. Reason: TcpIpConnectionManager is stopping
2019-01-23 12:02:59.381  INFO 51656 --- [           main] com.hazelcast.instance.Node              : [10.3.2.121]:5701 [dev] [3.7.8] Shutting down node engine...
2019-01-23 12:02:59.390  INFO 51656 --- [           main] com.hazelcast.instance.NodeExtension     : [10.3.2.121]:5701 [dev] [3.7.8] Destroying node NodeExtension.
2019-01-23 12:02:59.391  INFO 51656 --- [           main] com.hazelcast.instance.Node              : [10.3.2.121]:5701 [dev] [3.7.8] Hazelcast Shutdown is completed in 21 ms.
2019-01-23 12:02:59.391  INFO 51656 --- [           main] com.hazelcast.core.LifecycleService      : [10.3.2.121]:5701 [dev] [3.7.8] [10.3.2.121]:5701 is SHUTDOWN
2019-01-23 12:02:59.443  WARN 51656 --- [           main] com.hazelcast.util.PhoneHome             : [10.3.2.121]:5701 [dev] [3.7.8] Could not schedule phone home! Most probably Hazelcast is failed to start.
2019-01-23 12:02:59.444  INFO 51656 --- [           main] com.hazelcast.instance.Node              : [10.3.2.121]:5701 [dev] [3.7.8] Node is already shutting down... Waiting for shutdown process to complete...
2019-01-23 12:02:59.448  WARN 51656 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'undertowEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedUndertow.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webConfigurer' defined in URL [jar:file:/Users/mike.knoth/Desktop/automationstation.war!/WEB-INF/classes!/com/odp/config/WebConfigurer.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hazelcastInstance' defined in class path resource [com/odp/config/CacheConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception; nested exception is java.lang.IllegalStateException: Node failed to start!
2019-01-23 12:02:59.449  INFO 51656 --- [           main] com.odp.config.CacheConfiguration        : Closing Cache Manager
2019-01-23 12:02:59.493 ERROR 51656 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'undertowEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedUndertow.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webConfigurer' defined in URL [jar:file:/Users/mike.knoth/Desktop/automationstation.war!/WEB-INF/classes!/com/odp/config/WebConfigurer.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hazelcastInstance' defined in class path resource [com/odp/config/CacheConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception; nested exception is java.lang.IllegalStateException: Node failed to start!
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at com.odp.UiApp.main(UiApp.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'undertowEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedUndertow.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webConfigurer' defined in URL [jar:file:/Users/mike.knoth/Desktop/automationstation.war!/WEB-INF/classes!/com/odp/config/WebConfigurer.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hazelcastInstance' defined in class path resource [com/odp/config/CacheConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception; nested exception is java.lang.IllegalStateException: Node failed to start!
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:199)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134)
    ... 14 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webConfigurer' defined in URL [jar:file:/Users/mike.knoth/Desktop/automationstation.war!/WEB-INF/classes!/com/odp/config/WebConfigurer.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hazelcastInstance' defined in class path resource [com/odp/config/CacheConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception; nested exception is java.lang.IllegalStateException: Node failed to start!
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:519)
    at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.getCustomizers(EmbeddedServletContainerCustomizerBeanPostProcessor.java:82)
    at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:72)
    at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:59)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
    ... 22 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hazelcastInstance' defined in class path resource [com/odp/config/CacheConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception; nested exception is java.lang.IllegalStateException: Node failed to start!
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
    ... 38 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception; nested exception is java.lang.IllegalStateException: Node failed to start!
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 51 common frames omitted
Caused by: java.lang.IllegalStateException: Node failed to start!
    at com.hazelcast.instance.HazelcastInstanceImpl.<init>(HazelcastInstanceImpl.java:132)
    at com.hazelcast.instance.HazelcastInstanceFactory.constructHazelcastInstance(HazelcastInstanceFactory.java:218)
    at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:176)
    at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:126)
    at com.hazelcast.core.Hazelcast.newHazelcastInstance(Hazelcast.java:58)
    at com.odp.config.CacheConfiguration.hazelcastInstance(CacheConfiguration.java:75)
    at com.odp.config.CacheConfiguration$$EnhancerBySpringCGLIB$$1c92f609.CGLIB$hazelcastInstance$2(<generated>)
    at com.odp.config.CacheConfiguration$$EnhancerBySpringCGLIB$$1c92f609$$FastClassBySpringCGLIB$$3f6079fd.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
    at com.odp.config.CacheConfiguration$$EnhancerBySpringCGLIB$$1c92f609.hazelcastInstance(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 52 common frames omitted

标签: javaspringspring-mvcjhipsterhazelcast

解决方案


推荐阅读