使用jasperreports-5.6.0.jar导致的问题
使用jasperreports-5.6.0.jar导致的问题
Struts2+jasperReport5.6如下设置:
<!-- 社员档案 --> <package name="com.anche.qh.arc.arcMember"extends="json-default"> <result-types> <result-type name="jasper" class="org.apache.struts2.views.jasperreports.JasperReportsResult"/> </result-types> <action name="arcMember_*" class="actArcMember" method="{1}"> <result type="json"> <param name="root">jsonResult</param> </result> </action> <action name="arcMemberStr_*" class="actArcMember" method="{1}"> <result type="json"> <param name="root">returnStr</param> </result> </action> <action name="arcMemberPdf_*" class="actArcMember" method="{1}"> <result name="success" type="jasper"> <param name="location">/reportSource/arc/member.jasper</param> <param name="dataSource">list</param> <param name="format">PDF</param> </result> </action> </package> |
运行系统提示错误如下:
六月 07, 2016 11:46:05 上午 org.apache.catalina.core.StandardWrapperValve
invoke 严重: Servlet.service() for servlet [default] in context
with path [/yyhzs] threw exception [Filter execution threw an exception] with
root cause java.lang.NoSuchMethodError: net.sf.jasperreports.engine.util.JRLoader.loadObject(Ljava/lang/String;)Ljava/lang/Object; at
org.apache.struts2.views.jasperreports.JasperReportsResult.doExecute(JasperReportsResult.java:323) at
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:374) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:278) at
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) at
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211) at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211) at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:510) at
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957) at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423) at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079) at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620) at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318) at
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at
java.lang.Thread.run(Unknown Source) |
解决问题:
参考(http://bbs.csdn.net/topics/390861809)说是因为JasperReport版本的问题,
于是安装iReport5.2,并用里面的和替换原来的jar包,问题解决。