This question already has an answer here:
-
How do I fix a NoSuchMethodError?
28 answers
I run in Tomcat, jasper report crashed with PDF, excel still running fine.
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
ByteArrayOutputStream os = new ByteArrayOutputStream();
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(os));
exporter.exportReport();
And error shot out:
java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V
net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:480)
net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:379)
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:122)
ReportServlet.processRequest(ReportServlet.java:104)
ReportServlet.doGet(ReportServlet.java:142)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
I use the following libraries:
- iText-2.1.7.js2.jar
- itext-4.2.0.jar
- itextpdf-5.5.0.jar
- jasperreports-5.6.0.jar
- jasperreports-fonts-5.6.0.jar
- jasperreports-javaflow-5.6.0.jar
Thanks for your help!
Your itext version is old as compared to jasperreports version. Please use the latest version. Note that the artifactId and/or groupId have changed:-
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
</dependency>
After using the latest version 5.5.13, I checked that the war file after the build file has version text-2.0.8 and caused errors. So how to do to fix?
Here is build.grade file:
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "gradle.plugin.com.craigburke.gradle:karma-gradle:1.4.3"
classpath "com.craigburke.gradle:client-dependencies:1.1.1"
classpath "org.grails.plugins:angular-scaffolding:1.0.0"
classpath "org.grails.plugins:hibernate5:6.0.0"
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.11.1"
classpath "org.grails.plugins:views-gradle:1.1.0"
classpath 'org.grails.plugins:quartz:2.0.6'
classpath 'jcifs:jcifs:1.3.17'
classpath 'com.hierynomus:smbj:0.7.0'
}
}
ext.springSecurityRestVersion = '2.0.0.M2'
version "1.0.0"
group "m1t.ptud"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.grails-gsp"
apply plugin:"com.craigburke.karma"
apply plugin:"com.craigburke.client-dependencies"
apply plugin:"asset-pipeline"
apply plugin:"org.grails.plugins.views-json"
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}
grails {
pathingJar = true
}
dependencies {
assets "com.craigburke.angular:angular-template-asset-pipeline:2.3.0"
assets "com.craigburke.angular:angular-annotate-asset-pipeline:2.4.0"
assets "com.craigburke:js-closure-wrap-asset-pipeline:1.2.0"
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-plugin-url-mappings"
compile "org.grails:grails-plugin-rest"
compile "org.grails:grails-plugin-codecs"
compile "org.grails:grails-plugin-interceptors"
compile "org.grails:grails-plugin-services"
compile "org.grails:grails-plugin-datasource"
compile "org.grails:grails-plugin-databinding"
compile "org.grails:grails-plugin-async"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-logging"
compile "org.grails.plugins:cache"
compile "org.grails:grails-plugin-gsp"
compile "org.grails.plugins:angular-scaffolding:1.0.1"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.1.Final"
compile "org.grails.plugins:views-json"
compile "org.grails.plugins:views-json-templates"
// compile 'org.grails.plugins:spring-security-cas:3.1.0'
/*compile "net.sf.jasperreports:jasperreports:5.6.0"
compile "net.sf.jasperreports:jasperreports-fonts:5.6.0"*/
console "org.grails:grails-console"
profile "org.grails.profiles:angular"
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.11.1"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
testCompile "org.grails:grails-datastore-rest-client"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
// added
compile ("com.hazelcast:hazelcast-hibernate5:1.0") {
exclude group: "com.hazelcast"
}
compile "org.grails.plugins:spring-security-core:3.1.1"
compile "org.grails.plugins:spring-security-rest:${springSecurityRestVersion}"
compile 'org.grails.plugins:spring-security-ldap:3.0.1'
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.7.0"
compile "com.hazelcast:hazelcast-all:3.7.1"
compile "com.sun.mail:javax.mail:1.5.6"
compile "net.sf.jt400:jt400:9.1"
compile 'org.grails.plugins:excel-import:3.0.0.RC2'
compile "org.grails.plugins:excel-export:2.0.3"
compile 'com.jameskleeh:excel-builder:0.3.0'
compile "org.grails.plugins:mail:2.0.0.RC1"
compile "com.jcraft:jsch:0.1.49"
compile 'org.grails.plugins:quartz:2.0.6'
compile 'org.grails.plugins:quartz-monitor:1.3'
compile 'jcifs:jcifs:1.3.17'
compile 'com.hierynomus:smbj:0.7.0'
compile group: 'com.itextpdf', name: 'itextpdf', version: '5.5.13'
// compile 'org.apache.poi:poi-ooxml:jar:3.17'
// compile 'net.sf.jasperreports:jasperreports:6.4.0'
// compile 'net.sf.jasperreports:jasperreports-fonts:6.0.0'
// compile 'org.grails.plugins:jasper:2.0.0.RC1'
assets 'com.bertramlabs.plugins:less-asset-pipeline:2.11.1'
assets 'com.bertramlabs.plugins:sass-asset-pipeline:2.11.1'
compile fileTree(dir: 'lib', include: ['*.jar'])
compile(project(':ast'))
}
clientDependencies {
npm {
'angular'('1.5.x', into: 'angular') {
include 'angular.js'
}
'angular-mocks'('1.5.x', into: 'angular') {
include 'angular-mocks.js'
}
'angular-resource'('1.5.x', into: 'angular') {
include 'angular-resource.js'
}
'angular-ui-bootstrap'('1.3.x', into: 'angular') {
include 'ui-bootstrap-tpls.js'
}
'angular-ui-router'('0.2.x', into: 'angular', from: 'release') {
include 'angular-ui-router.js'
}
'bootstrap-sass'('3.3.x', into: 'bootstrap', from: 'assets') {
include 'fonts/**'
include 'stylesheets/**'
}
'font-awesome'('4.6.x', into: 'font-awesome') {
include 'scss/**'
include 'fonts/**'
}
'angular-translate'('2.12.x', into: 'angular') {
include 'angular-translate.js'
}
'angular-translate-loader-static-files'('2.12.x', into: 'angular') {
include 'angular-translate-loader-static-files.js'
}
'angular-translate-handler-log'('2.12.x', into: 'angular') {
include 'angular-translate-handler-log.js'
}
'ngstorage'('0.3.x', into: 'angular') {
include 'ngStorage.js'
}
'alertifyjs'('1.8.x', into: 'alertify', from: 'build') {
include '**'
}
'ng-file-upload'('12.2.x', into: 'angular', from: 'dist') {
include 'ng-file-upload-all.js'
}
}
bower {
'angular-smart-table'('2.1.x', into: 'angular', from: 'dist') {
include 'smart-table.js'
}
'angular-ui-select'('0.19.x', into: 'angular/select', from: 'dist') {
include 'select.js'
include 'select.css'
}
'simple-line-icons'('2.4.x', into: 'simple-line-icons') {
include 'fonts/*'
include 'scss/*'
}
'angular-loading-bar'('0.9.x',into: 'angular/loading', from: 'build') {
include 'loading-bar.js'
include 'loading-bar.css'
}
'angular-animate'('1.5.x',into: 'angular') {
include 'angular-animate.js'
}
'angular-sanitize'('1.5.x', into: 'angular') {
include 'angular-sanitize.js'
}
'angular-validation'('1.4.x', into: 'angular', from: 'dist') {
include 'angular-validation.js'
include 'angular-validation-rule.js'
}
'ng-currency'('0.*', into: 'angular', from: 'dist') {
include 'ng-currency.js'
}
'blob-polyfill'('1.0.x', into: 'blob-polyfill') {
include 'Blob.js'
}
'file-saver'('1.3.x', into: 'file-saver') {
include 'FileSaver.js'
}
}
}
karma {
dependencies(['karma-wrap-preprocessor'])
profile 'angularJS'
preprocessors = [
'grails-app/assets/javascripts/**/*.js': ['wrap']
]
wrapPreprocessor = [
template: "(function () { 'use strict'; <%= contents %> })()"
]
}
assets {
minifyJs = false
minifyCss = false
enableSourceMaps = true
enableGzip = true
includes = ['**/m1t.ptud.js', '**/application.css']
excludes = ['**/*.js', '**/*.html', '**/*.*css']
developmentRuntime=true
}