`
oboaix
  • 浏览: 273828 次
社区版块
存档分类
最新评论

linux tomcat日志错误Cannot run without an instance id & java.net.UnknownHostExceptio

    博客分类:
  • JAVA
 
阅读更多

   linux环境下面出现这种问题(而windows下面可能没有这种现象),
  quartz部署环境中可能会出现下面的代码异常问题:Caused by: java.lang.IllegalStateException: Cannot run without an instance id.
可以尝试使用下面的办法进行解决(一般情况是不能识别主机名):
另外主机:Caused by: java.net.UnknownHostException: stressweb
一般增加/etc/hosts下面的hostname的值,即可解决问题。

 

exception stacktrace:

2015-03-14 17:23:13,487 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in class path resource [applicationContext-scheduler.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot run without an instance id.
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:983)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1660)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Cannot run without an instance id.
        at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1215)
        at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1519)
        at org.springframework.scheduling.quartz.SchedulerFactoryBean.createScheduler(SchedulerFactoryBean.java:598)
        at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
        ... 25 more

###########################################################################################################
###########################################################################################################
###########################################################################################################

INFO ][2015-03-14 17:23:15,493][com.mchange.v2.log.MLog] - MLog clients using log4j logging.
[INFO ][2015-03-14 17:23:15,512][com.mchange.v2.c3p0.impl.C3P0ImplUtils] - Failed to get local InetAddress for VMID. This is unlikely to matter. At all. We'll add some extra randomness
java.net.UnknownHostException: stressweb: stressweb
        at java.net.InetAddress.getLocalHost(InetAddress.java:1473)
        at com.mchange.v2.c3p0.impl.C3P0ImplUtils.generateVmId(C3P0ImplUtils.java:120)
        at com.mchange.v2.c3p0.impl.C3P0ImplUtils.<clinit>(C3P0ImplUtils.java:98)
        at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.<init>(PoolBackedDataSourceBase.java:227)
        at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.<init>(AbstractPoolBackedDataSource.java:62)
        at com.mchange.v2.c3p0.ComboPooledDataSource.<init>(ComboPooledDataSource.java:109)
        at com.mchange.v2.c3p0.ComboPooledDataSource.<init>(ComboPooledDataSource.java:105)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:76)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:983)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1660)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.UnknownHostException: stressweb
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
        at java.net.InetAddress.getLocalHost(InetAddress.java:1469)
        ... 39 more

 

vi 编辑  /etc/hosts文件,将当前服务器主机名加入127.0.0.1这一行即可,仿照如下图修改:



 

 

再次启动tomcat即可。

 正常情况下,不会出现一些异常问题(for quartz),出现可能问题,建议quartz在使用过程中,mysql的jar包需要较高一点版本。
 

  • 大小: 5.3 KB
分享到:
评论
3 楼 羽风之扬 2016-09-06  
crazydayu 写道
您好,我在启动的时候也遇到了这种错误,但是加上127.0.0.1之后,还是会有这个错误
给您贴出来内容:
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.33.12 ISMPB-Interface
麻烦您帮忙看看,先谢谢了。

你的这个问题好了么
2 楼 羽风之扬 2016-09-06  
我的也[是这用错误,改过后没效果。这是我的截图,麻烦帮我看下吧,谢谢
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.18.113 ccss
1 楼 crazydayu 2016-04-27  
您好,我在启动的时候也遇到了这种错误,但是加上127.0.0.1之后,还是会有这个错误
给您贴出来内容:
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.33.12 ISMPB-Interface
麻烦您帮忙看看,先谢谢了。

相关推荐

    linux系统下部署TOMCAT错误java.net.UnknownHostException bogon bogon

    linux系统下部署TOMCAT异常错误java.net.UnknownHostException :bogon: bogon 主要原因是主机映射原因 修改hosts文件即可

    解决jvmjava.net.BindException: Address already in use: JVM_Bind异常

    【Java中的`java.net.BindException: Address already in use: JVM_Bind`异常】 在Java编程中,当你尝试启动一个服务器端应用,如Tomcat,或者任何需要监听特定端口的服务时,可能会遇到`java.net.BindException: ...

    linux系统下部署TOMCAT错误java.net.UnknownHostException bogon bogon.docx

    Linux下打开的文件过多错误

    Linux下运行tomcat或者was出现java.net.SocketException: 打开的文件过多错误 tomcat报“too many open files”的错误,解决办法如下:

    Linux tomcat下catalina.out日志文件分割

    Linux tomcat下catalina.out日志文件分割 前言: tomcat默认使用Java.util.logging记录日志,默认只记录tomcat的日志,不记录应用的日志。tomcat支持采用log4j进行日志记录,配置方法如下: 1.更新最新的tomcat_juli...

    javax.naming.NamingException: Cannot create resource instance

    javax.naming.NamingException: Cannot create resource instance类加载异常,希望可以帮助跟我一样错误的人。

    Linux下tomcat日志catalina.out按天(/周)分割

    在Linux环境中,Tomcat作为广泛使用的Java应用服务器,其日志管理是系统监控和问题排查的重要环节。默认情况下,Tomcat的主要日志输出文件是`catalina.out`,它记录了服务器启动、运行和关闭过程中的所有标准输出和...

    启动tomcat时 错误: 代理抛出异常 : java.rmi.server.ExportException: Port already in use: 1099的解决办法

     今天一来公司,在IntelliJ IDEA 中启动Tomcat服务器时就出现了如下图所示的错误:  错误: 代理抛出异常错误: java.rmi.server.ExportException: Port already in use: 1099; nested exception is: java.net....

    Linux中tomcat日志切割

    在Linux环境中,Tomcat作为广泛使用的Java应用服务器,其日志管理是系统监控和故障排查的重要环节。"Linux中Tomcat日志切割"是指通过特定的工具或脚本,将Tomcat的日志文件`catalina.out`按照日期进行分割,以实现...

    jdk&tomcat;.rar

    本教程将详细介绍如何在Linux系统上利用tar命令安装Java 1.8 JDK和Tomcat 8.5,这两个都是Web开发中不可或缺的组件。 首先,我们要处理的是`jdk-8u181-linux-x64.tar.gz`文件,这是Oracle JDK 1.8更新181的Linux 64...

    Apache服务器错误问题

    Apache服务器错误问题 Apache服务器错误问题 Apache服务器错误问题

    解决Linux下tomcat连接MySQL数据库

    即在尝试通过Tomcat服务器连接到MySQL数据库时,出现了`CommunicationsException`,进一步深入是由于`AccessControlException`导致的,错误信息提示访问权限被拒绝(`access denied (java.net.SocketPermission ...

    linux shell脚本定时清理tomcat日志文件

    Linux shell脚本定时清理tomcat日志文件 本文将详细介绍 Linux 环境中使用 shell 脚本来定时清理 Tomcat 日志文件的方法。该方法使用 cron 机制来实现每天自动切割日志文件,并删除 4 天前的日志文件。 知识点一:...

    Tomcat启动时报错:java.lang.UnsatisfiedLinkError的解决

    之前tomcat启动老是报错,虽然不影响项目的启动运行,但是有强迫症的程序员会心里不爽: 如下: 问题分析 由于本机安装的jdk版本与tomcat中使用的jdk版本不一致导致的。 解决方法 后面我把原先tomcat启动环境用的...

    An internal error occurred during: java.lang.NullPointerException

    这个错误通常伴随着`java.lang.NullPointerException`异常,导致在启动Tomcat服务器时不断弹出错误对话框。这种情况下,尽管后台没有明显的错误日志,但频繁出现的警告窗口无疑会给开发工作带来不便。 ### 错误分析...

    Docker配置Tomcat

    docker实践(tomcat配置),在docker环境下部署tomcat。

    最新版linux apache-tomcat-9.0.37.tar.gz

    Apache Tomcat是一款开源的Java应用服务器,主要用于运行Servlet和JSP应用。它是Apache软件基金会Jakarta项目的一部分,设计目标是实现Sun Microsystems的Java Servlet和JavaServer Pages(JSP)规范。在Linux环境下...

    tomcat启动的错误

    1. **查看日志文件**:检查Tomcat的日志文件(通常位于`logs`目录),寻找有关加载MySQL JDBC驱动的相关信息或错误提示。 2. **环境变量检查**:确认环境变量`JAVA_HOME`和`CATALINA_HOME`是否正确设置。 3. **配置`...

    Tomcat输出catalina.out的大小控制

    `catalina.out`是Tomcat默认的日志文件,它记录了Tomcat启动、运行以及错误信息,对开发者和管理员来说非常重要。然而,如果不进行适当管理,这个日志文件可能会无限制增长,占用大量磁盘空间,甚至可能导致服务器...

Global site tag (gtag.js) - Google Analytics