问题描述:
断电后,linux服务器系统重启,启动Apache Tomcat、Apache Camel服务后,tomcat服务下载及打印Excel、PDF报错
- Tomcat异常
- camel异常
2019-05-30 18:54:17,296 [pool-3-thread-145] INFO Tracer:96 - >>> bean://captureFront?method=receive --> OnException[CamelExecutionException] <<<
INFO | jvm 1 | 2019/05/30 18:54:17 | 2019-05-30 18:54:17,297 [pool-3-thread-145] INFO Tracer:96 - >>> OnException[CamelExecutionException] --> bean[ref:exceptionHandle] <<<
INFO | jvm 1 | 2019/05/30 18:54:17 | org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: 9w0AKDkcUqj3NMTpUidDQAZwMnpRjk8/hRJ/q6P4h9B/KgA2Z69BQVCgkDJp/wDD+VJ2NIQ1SdjAqPmHOeopBjNObrTO5pjFweuTmlAx9aUdKUUAN6Htk+lAJyMnAz26mj+Km/xL9aAHhV6gY5oIbcvTaeetOH3R9f60rdF+lAERzkcCmtnA3DNSHqPxph6CkAh3Akk8HoBSE4IKgZPGKdL/AEpv8a/WmAisCzgk5XmrqMWgB4QHGe5rPT/j4n+gq+f9QPoKTAr3JVSCEG48Ams64j8qFWcKATgba0Lv+D6iqWq/8ecX+9QAwSSF2YqoVxyAO3t6U2N3LAjIAycfSpD/AA/7v9Kji6n/AHW/lTAt2l4JXjaVCFkHy4/rVqV40QEdW9KyrX/U2P8Au1cm+5D/AMC/madgLayQmElt2RVaa+iT5IUZ5CuelL/yxNZyf8fx/wCua/1osInRLm6m2scfxbc8CpItPLY+0YYg52g/LU9j/wAfjf8AXOra0rjY11jt1Ayo44CihgxIxnb71HqH3l/Cpx91aZI1UCqc9qTIJIXPWpG+4ajTqfrQAwpvADH9aQJtXgk/Wpe1Ifu/nSGQnkDP5CkC8gg4FA+/+NOH3BTAUACoyGK9eKlPWmL91frQIaM4x1I9TRjAyRSr1P8AvU4/d/CgBAP5Uh69O+KcPu/gKb/F+NAAQPyppHFO9fpSHpQIYcgdSfrTJfMMZEZUSY+UnpmpW+6KafvD60xmd9qvApBjtptp2kocYNR3Ba4BY2REgHBV84/Cn2X3bj/rpVq36yUhkWln906DjGDz61abIAIHfmqmnfek+o/nVxvu/iaBBuIPIzn1o45A4wKG6ik/iNADWI3pG7EM43Lj0FOIyvPSopv+P21/65t/SpT/AKugBe3SmtjHORmnr90fhUcnagB5FIecc8UrdPypo+6tMBF3BiuFCdiO9Oz7fjSjp+FNH3aQDuuccGkVcDrzSp940DqKAGgAj15p... [Body clipped after 1000 chars, total length is 1906]]
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1635)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:308)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:254)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:171)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:68)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.component.bean.BeanProducer.process(BeanProducer.java:38)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.camel.component.mina2.Mina2Consumer$ReceiveHandler.messageReceived(Mina2Consumer.java:403)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:74)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTask(OrderedThreadPoolExecutor.java:769)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTasks(OrderedThreadPoolExecutor.java:761)
INFO | jvm 1 | 2019/05/30 18:54:17 | at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:703)
INFO | jvm 1 | 2019/05/30 18:54:17 | at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
INFO | jvm 1 | 2019/05/30 17:09:30 | at java.lang.Class.forName0(Native Method)
INFO | jvm 1 | 2019/05/30 17:09:30 | at java.lang.Class.forName(Class.java:191)
INFO | jvm 1 | 2019/05/30 17:09:30 | at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
INFO | jvm 1 | 2019/05/30 17:09:30 | at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
INFO | jvm 1 | 2019/05/30 17:09:30 | at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1182)
INFO | jvm 1 | 2019/05/30 17:09:30 | at java.awt.image.BufferedImage.getGraphics(BufferedImage.java:1172)
INFO | jvm 1 | 2019/05/30 17:09:30 | at com.richfit.trans.utils.ImgCompress.resize(ImgCompress.java:83)
INFO | jvm 1 | 2019/05/30 17:09:30 | at com.richfit.trans.utils.ImgCompress.resizeByHeight(ImgCompress.java:70)
INFO | jvm 1 | 2019/05/30 17:09:30 | at com.richfit.trans.utils.ImgCompress.resizeFix(ImgCompress.java:49)
INFO | jvm 1 | 2019/05/30 17:09:30 | at com.richfit.trans.business.CaptureFront.receive(CaptureFront.java:195)
INFO | jvm 1 | 2019/05/30 17:09:30 | at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source)
INFO | jvm 1 | 2019/05/30 17:09:30 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 1 | 2019/05/30 17:09:30 | at java.lang.reflect.Method.invoke(Method.java:606)
INFO | jvm 1 | 2019/05/30 17:09:30 | at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)
INFO | jvm 1 | 2019/05/30 17:09:30 | at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)
INFO | jvm 1 | 2019/05/30 17:09:30 | at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)
INFO | jvm 1 | 2019/05/30 17:09:30 | ... 25 more
解决办法
Tomcat解决办法:网上搜索了一下,在catalina.sh里加上“-Djava.awt.headless=true \”,问题解决(一共添加了8处,Tomcat版本7.0.59)。参照如下修改
exec "$_RUNJDB" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
-sourcepath "$CATALINA_HOME"/../../java \
-Djava.security.manager \
-Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
-Dcatalina.base="$CATALINA_BASE" \
-Dcatalina.home="$CATALINA_HOME" \
-Djava.io.tmpdir="$CATALINA_TMPDIR" \
-Djava.awt.headless=true \
org.apache.catalina.startup.Bootstrap "$@" start
camel解决办法:没找到要添加的配置文件。
最终解决办法:来电后由于ups已无法正常供电,还需要重启服务器,等服务器完全启动后,再启动应用服务(综合分析是由于服务器没有完全启动,Xserver服务未启动就启动Tomcat、camel服务导致的)
如有疑问或者错误,请您留言,我会尽快回复!欢迎一起学习讨论!