当前位置: 首页 > 工具软件 > FontMapper > 使用案例 >

错误 500 java.lang.NoClassDefFoundError: com/lowagie/text/pdf/FontMapper

家浩瀚
2023-12-01

在制作报表过程中,以pdf格式打印时出现的错误:

HTTP Status 500 -


type Exception report

message

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

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: 
java.lang.NoClassDefFoundError: com/lowagie/text/pdf/FontMapper




	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/lowagie/text/pdf/FontMapper
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
	org.apache.jsp.html.page.report.report_jsp._jspService(report_jsp.java:126)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

出现此问题的原因:

原来是我导的包有问题,如下:

jasperreports-3.5.3.jar   ---> iText-2.1.0.jar  才是正确的


iText-2.1.0.jar ---> com.lowagie

 

iText-5.0.6.jar ---> com.itextpdf.text 

 

所以在用 jasperreports-3.5.3.jar时,不能用 iText-5.0.6.jar

 

 

 

 

 

 

 

 类似资料: