CentOS Unknown host问题导致Elastic Job项目启动出错

前端之家收集整理的这篇文章主要介绍了CentOS Unknown host问题导致Elastic Job项目启动出错前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

最近在CentOS6.5服务器上部署了一个web项目,启动时报如下错误

信息: Illegal access: this web application instance has been stopped already. Could not load org.apache.zookeeper.server.ZooTrace. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access,and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1750)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1128)

七月 11,2017 7:55:09 下午 org.apache.catalina.loader.WebappClassLoader loadClass
信息: Illegal access: this web application instance has been stopped already. Could not load org.apache.zookeeper.ClientCnxn$SendThread. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access,and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1750)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
at ch.qos.logback.classic.spi.PackagingDataCalculator.loadClass(PackagingDataCalculator.java:207)
at ch.qos.logback.classic.spi.PackagingDataCalculator.bestEffortLoadClass(PackagingDataCalculator.java:232)
at ch.qos.logback.classic.spi.PackagingDataCalculator.computeBySTEP(PackagingDataCalculator.java:138)
at ch.qos.logback.classic.spi.PackagingDataCalculator.populateUncommonFrames(PackagingDataCalculator.java:113)
at ch.qos.logback.classic.spi.PackagingDataCalculator.populateFrames(PackagingDataCalculator.java:105)
at ch.qos.logback.classic.spi.PackagingDataCalculator.calculate(PackagingDataCalculator.java:57)
at ch.qos.logback.classic.spi.ThrowableProxy.calculatePackagingData(ThrowableProxy.java:147)
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:124)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:440)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:396)
at ch.qos.logback.classic.Logger.error(Logger.java:559)
at org.apache.zookeeper.ClientCnxn$1.uncaughtException(ClientCnxn.java:414)
at java.lang.Thread.dispatchUncaughtException(Thread.java:1986)

七月 11,2017 7:55:09 下午 org.apache.catalina.loader.WebappClassLoader loadClass
信息: Illegal access: this web application instance has been stopped already. Could not load org.apache.catalina.loader.WebappClassLoader. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access,and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1750)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
at ch.qos.logback.classic.spi.PackagingDataCalculator.loadClass(PackagingDataCalculator.java:207)
at ch.qos.logback.classic.spi.PackagingDataCalculator.bestEffortLoadClass(PackagingDataCalculator.java:232)
at ch.qos.logback.classic.spi.PackagingDataCalculator.computeBySTEP(PackagingDataCalculator.java:138)
at ch.qos.logback.classic.spi.PackagingDataCalculator.populateUncommonFrames(PackagingDataCalculator.java:113)
at ch.qos.logback.classic.spi.PackagingDataCalculator.populateFrames(PackagingDataCalculator.java:105)
at ch.qos.logback.classic.spi.PackagingDataCalculator.calculate(PackagingDataCalculator.java:57)
at ch.qos.logback.classic.spi.ThrowableProxy.calculatePackagingData(ThrowableProxy.java:147)
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:124)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:440)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:396)
at ch.qos.logback.classic.Logger.error(Logger.java:559)
at org.apache.zookeeper.ClientCnxn$1.uncaughtException(ClientCnxn.java:414)
at java.lang.Thread.dispatchUncaughtException(Thread.java:1986)
七月 11,and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1750)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:191)
at ch.qos.logback.classic.spi.PackagingDataCalculator.bestEffortLoadClass(PackagingDataCalculator.java:239)
at ch.qos.logback.classic.spi.PackagingDataCalculator.computeBySTEP(PackagingDataCalculator.java:138)
at ch.qos.logback.classic.spi.PackagingDataCalculator.populateUncommonFrames(PackagingDataCalculator.java:113)
at ch.qos.logback.classic.spi.PackagingDataCalculator.populateFrames(PackagingDataCalculator.java:105)
at ch.qos.logback.classic.spi.PackagingDataCalculator.calculate(PackagingDataCalculator.java:57)
at ch.qos.logback.classic.spi.ThrowableProxy.calculatePackagingData(ThrowableProxy.java:147)
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:124)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:440)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:396)
at ch.qos.logback.classic.Logger.error(Logger.java:559)
at org.apache.zookeeper.ClientCnxn$1.uncaughtException(ClientCnxn.java:414)
at java.lang.Thread.dispatchUncaughtException(Thread.java:1986)

七月 11,2017 7:55:09 下午 org.apache.catalina.loader.WebappClassLoader loadClass
信息: Illegal access: this web application instance has been stopped already. Could not load ch.qos.logback.core.status.WarnStatus. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access,and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1750)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
at ch.qos.logback.classic.LoggerContext.noAppenderDefinedWarning(LoggerContext.java:175)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:267)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:442)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:396)
at ch.qos.logback.classic.Logger.error(Logger.java:559)
at org.apache.zookeeper.ClientCnxn$1.uncaughtException(ClientCnxn.java:414)
at java.lang.Thread.dispatchUncaughtException(Thread.java:1986)

Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "localhost-startStop-1-SendThread(192.168.1.7:2181)"

在网上搜了一下,资料很少,有一个人说是curator-framework作为zookeeper客户端连接zookeeper服务器出错导致-------tomcat重启的时候,因为之前的tomcat中的线程还没有完全关闭,新启动tomcat就会报这个异常。 解决办法也容易,只要把tomcat的server.xml中的reloadable="true"改成false。

因为同样的代码部署在其他服务器上都没有报出这个错误,所以还是考虑服务器环境问题。刚好在另一个项目启动时连接dubbo的zookeeper注册中心报错:

19:55:08.509 [localhost-startStop-1] WARN c.a.dubbo.config.AbstractConfig - [DUBBO] jian27: jian27: 未知的名称或服务,dubbo version: 2.5.3,current host: 127.0.0.1
java.net.UnknownHostException: jian27: jian27: 未知的名称或服务
at java.net.InetAddress.getLocalHost(InetAddress.java:1475) ~[na:1.7.0_79]
at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:299) [dubbo-2.5.3.jar:2.5.3]

java.net.UnknownHostException: jian27: jian27: 未知的名称或服务
at java.net.InetAddress.getLocalHost(InetAddress.java:1475) ~[na:1.7.0_79]
at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:299) [dubbo-2.5.3.jar:2.5.3]
at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:281) [dubbo-2.5.3.jar:2.5.3]
at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:242) [dubbo-2.5.3.jar:2.5.3]
at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:143) [dubbo-2.5.3.jar:2.5.3]
at com.alibaba.dubbo.config.spring.AnnotationBean.postProcessAfterInitialization(AnnotationBean.java:195) [dubbo-2.5.3.jar:2.5.3]
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapablebeanfactory.java:422) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.initializeBean(AbstractAutowireCapablebeanfactory.java:1583) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.doCreateBean(AbstractAutowireCapablebeanfactory.java:545) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.createBean(AbstractAutowireCapablebeanfactory.java:482) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.Abstractbeanfactory$1.getObject(Abstractbeanfactory.java:305) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.Abstractbeanfactory.doGetBean(Abstractbeanfactory.java:301) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.Abstractbeanfactory.getBean(Abstractbeanfactory.java:196) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.DefaultListablebeanfactory.findAutowireCandidates(DefaultListablebeanfactory.java:1145) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.DefaultListablebeanfactory.doResolveDependency(DefaultListablebeanfactory.java:1069) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.DefaultListablebeanfactory.resolveDependency(DefaultListablebeanfactory.java:967) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:543) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.populateBean(AbstractAutowireCapablebeanfactory.java:1214) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.doCreateBean(AbstractAutowireCapablebeanfactory.java:543) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.createBean(AbstractAutowireCapablebeanfactory.java:482) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.Abstractbeanfactory$1.getObject(Abstractbeanfactory.java:305) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.Abstractbeanfactory.doGetBean(Abstractbeanfactory.java:301) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.Abstractbeanfactory.getBean(Abstractbeanfactory.java:196) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.DefaultListablebeanfactory.preInstantiateSingletons(DefaultListablebeanfactory.java:772) [spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishbeanfactoryInitialization(AbstractApplicationContext.java:834) [spring-context-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) [spring-context-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446) [spring-web-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328) [spring-web-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) [spring-web-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5003) [catalina.jar:7.0.64]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5517) [catalina.jar:7.0.64]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.64]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574) [catalina.jar:7.0.64]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) [catalina.jar:7.0.64]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
Caused by: java.net.UnknownHostException: jian27: 未知的名称或服务
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.7.0_79]
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901) ~[na:1.7.0_79]
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1295) ~[na:1.7.0_79]
at java.net.InetAddress.getLocalHost(InetAddress.java:1471) ~[na:1.7.0_79]
... 41 common frames omitted

这个问题网上的资料很多,我修改了/etc/hosts和/etc/hostname文件里的hostname后,重启项目问题解决。然后我想同样都是连接zookeeper错误,这2个错误会不会是同一个原因?回去重启了前面那个项目,果然再没有报错。

猜你在找的CentOS相关文章