Jasper Reports + WebSphere 7, ExceptionInInitializ

2019-08-03 03:29发布

We're getting the below exception when calling JasperFillManager.fillReport(). The confusing aspect is that it happens in our "production" environment, but works fine in our TEST environment.

Apparently this issue happens during initialization of a static property, and we think it may be related to the multi-threading Jasper does (ThreadLocal-stuff).

We've tried the java.awt.headless=true JVM setting as some suggestions have indicated, but there was no change. We're really in need of suggestions for troubleshooting, or clues as to what might cause this in one environment but not the other. As far as we can tell, they're the same, but obviously something is different and we're out of ideas for things to check. So the question really is... how can we troubleshoot an issue like this?

Jasper Reports 4.7 (Also occurs with 3.7)

Java 1.6, Flex (GraniteDS on server)/Spring/Hibernate
(we're not using EJB, and we deploy via a simple war file)

FunctionName: com.ibm.ws.webcontainer.servlet.ServletWrapper.service
SourceId: com.ibm.ws.webcontainer.servlet
Category: SEVERE
ExtendedMessage: SRVE0068E: Uncaught exception created in one of the service methods of the servlet ReportServlet in application B
AO. Exception created : java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:222)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:121)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:153)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:55)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:407)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:824)
at gov.bao.util.JasperWork.execute(JasperWork.java:36)
at org.hibernate.impl.SessionImpl.doWork(SessionImpl.java:1997)
at gov.bao.dao.ReportDao.generateJasperReport(ReportDao.java:246)
at gov.bao.service.ReportService.getTracerReport(ReportService.java:258)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy65.getTracerReport(Unknown Source)
at gov.bao.servlet.ReportServlet.doGet(ReportServlet.java:110)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:359)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:275)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:344)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:272)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:81)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
at com.ib***BUFFER OVERFLOW***Y
Trace: 2012/09/06 08:43:55.556 01 t=8C9CF0 c=UNK key=P8 (00000011)
Description: Log Java Message
Message: SRVE0068E: Uncaught exception created in one of the service methods of the servlet ReportServlet in application BAO. Exce
ption created : java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:222)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:121)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:153)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:55)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:407)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:824)
at gov.bao.util.JasperWork.execute(JasperWork.java:36)
at org.hibernate.impl.SessionImpl.doWork(SessionImpl.java:1997)
at gov.bao.dao.ReportDao.generateJasperReport(ReportDao.java:246)
at gov.bao.service.ReportService.getTracerReport(ReportService.java:258)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy65.getTracerReport(Unknown Source)
at gov.bao.servlet.ReportServlet.doGet(ReportServlet.java:110)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:359)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:275)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:344)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:272)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:81)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
at com.ib***BUFFER OVERFLOW***Y com.ibm.ws.webcontainer.servlet.ServletWrapper.service

2条回答
该账号已被封号
2楼-- · 2019-08-03 04:05

To troubleshoot the issue, you need to get the original exception thrown by the static initializer. Normally that exception is linked to the ExceptionInInitializerError, the first time an attempt is made to load the class that contains the static initializer.

Therefore you need to do two things:

  1. Ensure that you are able to get the entire stack trace. The stack trace you have posted seems to be truncated (see the ***BUFFER OVERFLOW*** marker).
  2. Get the stack trace of the exception thrown when the first attempt to initialize the class is made. If necessary, restart the application or server.
查看更多
Viruses.
3楼-- · 2019-08-03 04:08

The original answer of post's author (@Mifune):

Solved by adding two libs:

  • jasperreports-javaflow.jar
  • Apache commons-javaflow.jar
查看更多
登录 后发表回答