-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 XMing, On 8/3/16 4:50 AM, XMing wrote: > I've add the following line to setenv.sh in tomcat bin directory. > > export CATALINA_OPTS="$CATALINA_OPTS -Djava.awt.headless=true" This shouldn't usually be necessary. What happens if you don't set "headless" mode? > I have some image processing code in spring bean which runs well at > the first time. > > After some time,let me say 1 or 2 days, exception occurs. Any clue > would be appreciated. > > Env detail: OS : Ubuntu 14.10 Server version: Apache Tomcat/7.0.63 > Server built: Jun 30 2015 08:08:33 UTC Server number: 7.0.63.0 > OS Name: Linux OS Version: 3.19.0-59-generic > Architecture: amd64 JVM Version: 1.7.0_79-b15 JVM Vendor: > Oracle Corporation > > > Here is the exception message: > ========================================== HTTP/1.1 500 Internal > Server Error Server: Apache-Coyote/1.1 Set-Cookie: > JSESSIONID=145E29B2CF34304B36EC686F20106B58; Path=/; HttpOnly > Content-Type: text/html;charset=utf-8 Content-Language: en > Content-Length: 5261 Date: Wed, 03 Aug 2016 08:04:07 GMT > Connection: close > > Apache Tomcat/7.0.63 - Error > report >

HTTP Status 500 - Handler processing failed; > nested exception is java.lang.NoClassDefFoundError: Could not > initialize class java.awt.image.BufferedImage


noshade="noshade">

type Exception > report

message Handler processing failed; nested > exception is java.lang.NoClassDefFoundError: Could not initialize > class java.awt.image.BufferedImage

description > The server encountered an internal error that prevented it from > fulfilling this request.

exception >

org.springframework.web.util.NestedServletException: Handler 
> processing failed; nested exception is
> java.lang.NoClassDefFoundError: Could not initialize class
> java.awt.image.BufferedImage 
> org.springframework.web.servlet.DispatcherServlet.triggerAfterCompleti
onWithError(DispatcherServlet.java:1303)
>
> 
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherS
ervlet.java:977)
> org.springframework.web.servlet.DispatcherServlet.doService(Dispatcher
Servlet.java:893)
>
> 
org.springframework.web.servlet.FrameworkServlet.processRequest(Framewor
kServlet.java:966)
> org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServl
et.java:868)
>
> 
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
> org.springframework.web.servlet.FrameworkServlet.service(FrameworkServ
let.java:842)
>
> 
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>
> 
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(
CharacterEncodingFilter.java:85)
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRe
questFilter.java:107)
>
> 

root cause

java.lang.NoClassDefFoundError: Coul
d
> not initialize class java.awt.image.BufferedImage 
> com.qqm.common.util.QRCodeUtil.createQRImage(QRCodeUtil.java:70) 
> com.qqm.api.service.business.app.v3.impl.V3InvitationBizServiceImpl.ge
tQrcodeInfo(V3InvitationBizServiceImpl.java:389)
>
> 
com.qqm.api.service.business.app.v3.impl.V3InvitationBizServiceImpl$$Fas
tClassBySpringCGLIB$$78bdc775.invoke(<generated>)
> org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:20
4)
>
> 
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedIntercepto
r.intercept(CglibAopProxy.java:649)
> com.qqm.api.service.business.app.v3.impl.V3InvitationBizServiceImpl$$E
nhancerBySpringCGLIB$$5ab5e2f0.getQrcodeInfo(<generated>)
>
> 
com.qqm.api.action.app.app3.InvitationAction.getQrcodeInfo(InvitationAct
ion.java:80)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
ava:57)
>
> 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:43)
> java.lang.reflect.Method.invoke(Method.java:606) 
> org.springframework.web.method.support.InvocableHandlerMethod.doInvoke
(InvocableHandlerMethod.java:221)
>
> 
org.springframework.web.method.support.InvocableHandlerMethod.invokeForR
equest(InvocableHandlerMethod.java:137)
> org.springframework.web.servlet.mvc.method.annotation.ServletInvocable
HandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
>
> 
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHand
lerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHa
ndlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
>
> 
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.
handle(AbstractHandlerMethodAdapter.java:85)
> org.springframework.web.servlet.DispatcherServlet.doDispatch(Dispatche
rServlet.java:959)
>
> 
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherSe
rvlet.java:893)
> org.springframework.web.servlet.FrameworkServlet.processRequest(Framew
orkServlet.java:966)
>
> 
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet
.java:868)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:650) 
> org.springframework.web.servlet.FrameworkServlet.service(FrameworkServ
let.java:842)
>
> 
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>
> 
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(
CharacterEncodingFilter.java:85)
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRe
questFilter.java:107)
>
> 

note The full stack trace of the root cause is > available in the Apache Tomcat/7.0.63 logs.


noshade="noshade">

Apache Tomcat/7.0.63

> ========================================== You need to look at the log file to see the "real" root cause: it's not displayed here in the abridged error message. - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJXqiW5AAoJEBzwKT+lPKRYRFEQAIZRpF/eGlJdL/QzO1L2QNgK KGvezeSIu9uN/5l/WZl5A1oz4HgIJiTp3K8B8psFlptUctiYTC5NstxV034zRSvk YdOuKl95R2bpcYjX6vAlToNgXDYxtOX0CEDVSGsFVl1KAlreJL4iwXHUf3emc9dO lsvCI1U9SfrXPrYAjMTpEJH/sGPGHi6/TgrkOPouFcwaE6Sj8Ywwl7fR+uuBDGei +pVsi3c/qQEm1PwGUtsFfqX0N0QQHNe80w40D0HG93TjRBj3iSD2rq7GZjySRWaT x6roBipIH+SjQmtw0Y8VU+N5BEcGqI7u5ZF/qcKGKWXz48iuTbjX7yPNU5INp87Q ug+AVRMla/7+VSzhe3q60rjlv2OQes3+3JH+pcpE94PqWcfCWIZvvG7Sld3wGH6u HHCHWGI05dg8SqZQnwqkdTTTvfKF4xQs+07uIIna/RPLRpxzzpdiKZ+zEAlrOfFU kMvyQhgq1OHLRldBFvaq7IOyOHRMHIwoPstfgGQmZLxqWUZxADvmOelEWvc4Q0b5 GVzQy+ALjdE5VNAflAjj/BOr0NRwnp6pS+hlkrrGYtOJL6+/CRXLdPGHFYhY0LVH Obn/ccTuQd4x8BI8s0eHtFtmBygdZPLFosno5SLVNJdAshlqAUZMPosnFZpwMRAe 9oaslEiTzAf9lPTPlNHQ =DnAl -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org