Heroku / Kotlin: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics - java

I try to run kotlin spring webapp via heroku run bash. I run then:
java -cp ./build/libs/pss_kotlin-1.0-SNAPSHOT.jar pl.makzyt.pss_kotlin.MainKt
Then I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at pl.makzyt.pss_kotlin.MainKt.main(Main.kt)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
I know I could run this if I get kotlin-runtime.jar. Is there possibility to obtain it with some command or should I download it manually?
EDIT
Here are my build.gradle dependencies:
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile group: 'org.springframework.boot',
name: 'spring-boot-autoconfigure',
version: '2.0.0.RELEASE'
compile group: 'org.springframework.boot',
name: 'spring-boot-starter-data-jpa',
version: '2.0.0.RELEASE'
compile group: 'org.springframework.boot',
name: 'spring-boot-starter-web',
version: '2.0.0.RELEASE'
compile group: 'org.postgresql',
name: 'postgresql',
version: '42.2.2'
compile group: 'org.hibernate',
name: 'hibernate-core',
version: '5.2.12.Final'
compile group: 'org.hibernate',
name: 'hibernate-entitymanager',
version: '5.2.12.Final'
compile group: 'javax.xml.bind',
name: 'jaxb-api',
version: '2.1'
compile group: 'org.springframework.boot',
name: 'spring-boot-starter-thymeleaf',
version: '2.0.0.RELEASE'
compile group: 'nz.net.ultraq.thymeleaf',
name: 'thymeleaf-layout-dialect',
version: '2.3.0'
}

If your spring boot app is configured correctly (spring boot plugin is applied in build.gradle) you just need to run the jar.
java -jar yourjar.jar
You don’t need to use the -cp option because Spring Boot repackages all dependencies in the jar that’s why you get a class not found error.

I'm not sure why you're getting this error. But you might want to try generating a new Spring + Kotlin app from https://start.spring.io and copying the Maven dependencies/plugins into your pom.xml.

Related

Google DataflowRunner "A JNI error has occurred, please check your installation and try again" - Gradle Beam Project

I have Gradle Apache beam java project that reads events from pubsub and writes to Cloud Firestore. I can run this streaming job using DirectRunner. While executing on DataflowRunner, the worker startup logs shows following error lines :
Line1 : "A JNI error has occurred, please check your installation and try again"
Line2 : "java.lang.NoClassDefFoundError: org/apache/beam/vendor/guava/v26_0_jre/com/google/common/graph/Network
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.beam.vendor.guava.v26_0_jre.com.google.common.graph.Network
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)"
Line 3: "Error syncing pod 8db0cbe852963b21f84ca2ee52e431a4 ("dataflow-streamprocessorapplicatio-06011028-n4lo-harness-sz6k_default(8db0cbe852963b21f84ca2ee52e431a4)"), skipping: failed to "StartContainer" for "java-streaming" with CrashLoopBackOff: "Back-off 5m0s restarting failed container=java-streaming pod=dataflow-streamprocessorapplicatio-06011028-n4lo-harness-sz6k_default(8db0cbe852963b21f84ca2ee52e431a4)"
I also tried adding beam-vendors-guava and beam-vendors-grpc dependency. But it didnt help while running on DataflowRunner.
Here is my build.gradle file dependencies section. I am using gradle shade plugin to build uber jar and execute it/create dataflow template and run it:
dependencies {
testCompile('org.junit.jupiter:junit-jupiter-api:5.4.0')
testCompile('org.junit.jupiter:junit-jupiter-params:5.4.0')
testCompile('org.junit.jupiter:junit-jupiter-engine:5.4.0')
testCompile(group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.2.4')
testCompile(group: 'org.powermock', name: 'powermock-module-junit4', version: '2.0.4')
testCompile(group: 'org.mockito', name: 'mockito-core', version: '2.28.2') { force true }
testCompile(group: 'org.powermock', name: 'powermock-api-mockito2', version: '2.0.4')
testCompile(group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3')
// compile(group: 'org.apache.beam', name: 'beam-runners-google-cloud-dataflow-java', version: '2.19.0')
// runtimeClasspath(group: 'org.apache.beam', name: 'beam-runners-google-cloud-dataflow-java', version: '2.19.0')
runtime(group: 'org.apache.beam', name: 'beam-runners-google-cloud-dataflow-java', version: '2.19.0')
compile(group: 'org.apache.beam', name: 'beam-sdks-java-io-google-cloud-platform', version: '2.19.0') {
exclude(group: 'io.grpc', module: 'grpc-all')
}
// https://mvnrepository.com/artifact/org.apache.beam/beam-sdks-java-core
compile group: 'org.apache.beam', name: 'beam-sdks-java-core', version: '2.19.0'
compile group: 'org.apache.beam', name: 'beam-sdks-java-io-redis', version: '2.19.0'
compile(group: 'org.apache.beam', name: 'beam-sdks-java-maven-archetypes-starter', version: '2.19.0')
// runtime(group: 'org.apache.beam', name: 'beam-sdks-java-maven-archetypes-starter', version: '2.19.0')
compileOnly group: 'org.apache.beam', name: 'beam-runners-direct-java', version: '2.19.0'
compile(group: 'io.grpc', name: 'grpc-all', version: '1.25.0') {
force true
}
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
compile group: 'com.google.cloud', name: 'google-cloud-firestore', version: '1.32.2'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.0'
}
Any help/suggestions in this case would be helpful. I am using Apache Beam SDK 2.19.0 for Java.
Since your question says "any help suggestions" I will write my comments also as an answer to "how can I try to debug this"?
Check that org/apache/beam/vendor/guava/v26_0_jre/com/google/common/graph/Network is in the uber jar. If not, it is a shadow plugin configuration issue.
Check that the uber jar is being staged. If not, there may be a problem with the runtime classpath. You can also specify --filesToStage on the command line on setFilesToStage in Java code.
Check that the uber jar has downloaded properly on the worker.

Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer

trying to convert and old app into a spring boot app and getting the above error. I've been seeing a lot of threads regarding missing dependencies but I'm not sure which one I'm missing, if I am indeed missing one to begin with? No libraries are missing from any other portion of code but I'm clearly missing something? Or on second thought it is could it be I'm import unnecessary dependencies that are cluttering up the app making it not start as well?
See below for a redacted snippet of the gradle.build containing dependencies and also a redacted list of the stack trace.
dependencies {
compile group: 'javax.mail', name: 'mail', version:'1.4.1'
compile group: 'com.google.code.gson', name: 'gson', version:'2.3'
compile group: 'commons-codec', name: 'commons-codec', version:'20041127.091804'
compile group: 'org.jsoup', name: 'jsoup', version:'1.7.2'
compile group: 'commons-io', name: 'commons-io', version:'2.5'
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.5'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.3.5'
compile group: 'org.json', name: 'json', version:'20140107'
compile group: 'com.itextpdf.tool', name: 'xmlworker', version:'5.5.6'
compile group: 'log4j', name: 'log4j', version:'1.2.17'
compile group: 'org.quartz-scheduler', name: 'quartz', version:'2.2.1'
compile group: 'org.quartz-scheduler', name: 'quartz-jobs', version:'2.2.1'
compile group: 'org.springframework', name: 'spring-context-support', version:'3.1.3.RELEASE'
compile group: 'org.springframework', name: 'spring-webmvc', version:'3.1.0.RELEASE'
compile group: 'org.springframework', name: 'spring-tx', version:'3.1.0.RELEASE'
compile group: 'org.springframework', name: 'spring-jdbc', version:'4.0.6.RELEASE'
compile group: 'c3p0', name: 'c3p0', version:'0.9.1.2'
compile group: 'mssqlserver', name: 'sqljdbc4', version:'3.0'
compile group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: '2.1.6.RELEASE', ext: 'pom'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-web'
compile group: 'org.springframework', name: 'spring-orm', version: '2.5.1'
compile group: 'org.springframework', name: 'spring-orm', version: '4.3.18.RELEASE'
}
java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$EndpointWebMvcConfiguration due to org/springframework/web/servlet/config/annotation/AsyncSupportConfigurer not found. Make sure your own configuration does not rely on that class. This can also happen if you are #ComponentScanning a springframework package (e.g. if you put a #ComponentScan in the default package by mistake)
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:55) ~[spring-boot-autoconfigure-1.5.14.RELEASE.jar:1.5.14.RELEASE]
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102) ~[spring-context-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$TrackedConditionEvaluator.shouldSkip(ConfigurationClassBeanDefinitionReader.java:444) ~[spring-context-4.3.18.RELEASE.jar:4.3.18.RELEASE]
etc...
at com.dish.wfm.controller.SamsungUpdateJobApplication.main(SamsungUpdateJobApplication.java:17) [classes/:na]
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/servlet/config/annotation/AsyncSupportConfigurer
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_211]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_211]
at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_211]
etc...
Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_211]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_211]
... 36 common frames omitted
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration] for bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration': problem with class file or dependent class; nested exception is java.lang.VerifyError: class org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration overrides final method configureHandlerExceptionResolvers.(Ljava/util/List;)V
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1394) ~[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:641) ~[spring-beans-4.3.18.RELEASE.jar:4.3.18.RELEASE]
etc...
Caused by: java.lang.VerifyError: class org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration overrides final method configureHandlerExceptionResolvers.(Ljava/util/List;)V
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_211]
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_211]
etc...
Your dependencies are a bit of a mess. You have dependencies that are already managed by the spring-boot-starter-* dependencies. However you are overriding those with manual org.springframework dependencies from different Spring versions. You are mixing 2.5.1, 3.1.0, 3.1.3, 4.0.6 and 4.1.3. Mixing jars from different versions of any framework is a bad idea they are generally incompatible.
To fix, remove the org.springframework dependencies, those interfere/break the Spring Boot managed dependencies.
Next you don't need the spring-boot-gradle-plugin as a dependency and finally the javax.mail stuff is part of the spring-boot-starter-mail. A
This would result in the following list of dependencies
dependencies {
compile group: 'com.google.code.gson', name: 'gson', version:'2.3'
compile group: 'commons-codec', name: 'commons-codec', version:'20041127.091804'
compile group: 'org.jsoup', name: 'jsoup', version:'1.7.2'
compile group: 'commons-io', name: 'commons-io', version:'2.5'
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.5'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.3.5'
compile group: 'org.json', name: 'json', version:'20140107'
compile group: 'com.itextpdf.tool', name: 'xmlworker', version:'5.5.6'
compile group: 'log4j', name: 'log4j', version:'1.2.17'
compile group: 'org.quartz-scheduler', name: 'quartz', version:'2.2.1'
compile group: 'org.quartz-scheduler', name: 'quartz-jobs', version:'2.2.1'
compile group: 'c3p0', name: 'c3p0', version:'0.9.1.2'
compile group: 'mssqlserver', name: 'sqljdbc4', version:'3.0'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-mail'
}
NOTES
Depending on the Spring Boot version you are using you could also use spring-boot-starter-quartz for quartz (or remove the version element from the dependencies).
Spring Boot 2.x doesn't support log4j 1 so you might want to replace that with logback (the default) or log4j2 (using the spring-boot-starter-log4j2 dependency).
I would also suggest replacing C3P0 with the default HikariCP (saves you a dependency and is imho a better connection pool).
You could also remove the version from the GSON dependency as Spring Boot also manages that (and that way you have a compatible version).
remove dependency spring-webmvc. Because AsyncSupportConfigurer is a class that exists since 3.2.
In fact, you can remove the org.springframework related dependencies. And it is safe.

Gradle : Could not find org.codehaus.groovy:groovy:1.0.0

I am using gradle to compile my Groovy and Java code. today I update my groovy 2.5.4 and upgrade gradle to version 5.
gradle run command failing now with this error message.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileGroovy'.
> Could not resolve all files for configuration ':detachedConfiguration1'.
> Could not find org.codehaus.groovy:groovy:1.0.0.
Searched in the following locations:
- https://jcenter.bintray.com/org/codehaus/groovy/groovy/1.0.0/groovy-1.0.0.pom
- https://jcenter.bintray.com/org/codehaus/groovy/groovy/1.0.0/groovy-1.0.0.jar
- http://repository.apache.org/snapshots/org/codehaus/groovy/groovy/1.0.0/groovy-1.0.0.pom
- http://repository.apache.org/snapshots/org/codehaus/groovy/groovy/1.0.0/groovy-1.0.0.jar
Required by:
project :
* Try:
Here is the build.gradle file.
plugins {
id 'groovy'
id 'application'
}
repositories {
jcenter()
maven {
url "http://repository.apache.org/snapshots/"
}
}
dependencies {
// Use the latest Groovy version for building this library
implementation 'org.codehaus.groovy:groovy-all:2.5.4'
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.9'
compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.6.1'
compile group: 'org.apache.directory', name: 'groovyldap', version: '0.1-SNAPSHOT'
// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
// https://mvnrepository.com/artifact/org.apache.directory.shared/shared-ldif
compile group: 'org.apache.directory.shared', name: 'shared-ldif', version: '0.9.19'
// https://mvnrepository.com/artifact/org.apache.directory.api/api-ldap-model
compile group: 'org.apache.directory.api', name: 'api-ldap-model', version: '1.0.0-M15'
// https://mvnrepository.com/artifact/com.opencsv/opencsv
compile group: 'com.opencsv', name: 'opencsv', version: '4.0'
// https://mvnrepository.com/artifact/org.jsoup/jsoup
compile group: 'org.jsoup', name: 'jsoup', version: '1.11.2'
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.11'
// https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc
compile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '6.4.0.jre8'
// https://mvnrepository.com/artifact/net.sourceforge.jtds/jtds
compile group: 'net.sourceforge.jtds', name: 'jtds', version: '1.3.1'
// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
// https://mvnrepository.com/artifact/org.yaml/snakeyaml
compile group: 'org.yaml', name: 'snakeyaml', version: '1.21'
// https://mvnrepository.com/artifact/com.rubiconproject.oss/jchronic
compile group: 'com.rubiconproject.oss', name: 'jchronic', version: '0.2.8'
compile group: 'io.github.http-builder-ng', name: 'http-builder-ng-core', version: '1.0.3'
// Use the awesome Spock testing and specification framework
testImplementation 'org.spockframework:spock-core:1.2-groovy-2.5'
}
// Define the main class for the application
mainClassName = 'ssl.test.App'
any help to resolve this error message?
Thanks
SR
You can replace your groovyldap dependency declaration with the following (as already mentioned by #paul-king in the comments):
compile(group: 'org.apache.directory', name: 'groovyldap', version: '0.1-SNAPSHOT') {
exclude group: 'groovy', module: 'groovy'
}
This will at least help you get rid of the dependency resolution error.
I don’t know if your groovyldap dependency will still work with Groovy 2.5.4 but it’s definitely worth a try.

Unable to compile jrxml containing highchart component with JasperCompileManager.compileReport()

I would like to compile a jrxml containing a highchart component (jasper pro) using Java.
Therefore I created a build.gradle with all the dependencies it requires.
My dependencies look like:
dependencies {
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.3'
compile group: 'commons-collections', name: 'commons-collections', version: '3.2.2'
compile group: 'commons-digester', name: 'commons-digester', version: '2.1'
compile 'net.sf.jasperreports:jasperreports:6.3.1'
compile fileTree(dir: 'lib', include: '**/*.jar')
compile 'org.codehaus.groovy:groovy-all:2.4.1'
compile "org.spockframework:spock-core:1.1-groovy-2.4-rc-2"
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-core:1.3'
compile group: 'joda-time', name: 'joda-time', version: '2.9.4'
compile group: 'commons-logging', name: 'commons-logging', version: '1.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.4'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.4'
compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
compile group: 'org.mozilla', name: 'rhino', version: '1.7.7.1'
compile group: 'jfree', name: 'jfreechart', version: '1.0.13'
compile group: 'org.olap4j', name: 'olap4j', version: '1.2.0'
compile group: 'bouncycastle', name: 'bcprov-jdk14', version: '1.50'
compile group: 'com.lowagie', name: 'itext', version: '2.1.7'
}
The JasperReports pro libraries are located in lib.
But I got stuck when compiling as it says the license file is invalid.
I am using my jasperserver.licence file, but somehow it is not capable in reading it properly
net.sf.jasperreports.engine.JRException: Error compiling report design.
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:247)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:357)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:290)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:575)
at ch.prospective.jasperreports.wekklyreports.WeeklyReports.fetch report(WeeklyReports.groovy:16)
Caused by: com.jaspersoft.jasperreports.license.LicenseException: License is in invalid state
at com.jaspersoft.jasperreports.license.BaseLicenseProviderImpl.requireLicense(BaseLicenseProviderImpl.java:189)
at com.jaspersoft.jasperreports.license.BaseLicenseProviderImpl.requireFeature(BaseLicenseProviderImpl.java:196)
at com.jaspersoft.jasperreports.license.LicenseManager.requireFeature(LicenseManager.java:113)
at com.jaspersoft.jasperreports.highcharts.HighChartsUtils.requireHighchartsFeature(HighChartsUtils.java:43)
at com.jaspersoft.jasperreports.highcharts.charts.StandardChartComponent.(StandardChartComponent.java:73)
at com.jaspersoft.jasperreports.highcharts.charts.ChartCompiler.toCompiledComponent(ChartCompiler.java:69)
at net.sf.jasperreports.engine.base.JRBaseComponentElement.(JRBaseComponentElement.java:59)
at net.sf.jasperreports.engine.base.JRBaseObjectFactory.visitComponentElement(JRBaseObjectFactory.java:1736)
at net.sf.jasperreports.engine.design.JRDesignComponentElement.visit(JRDesignComponentElement.java:105)
at net.sf.jasperreports.engine.JRAbstractObjectFactory.getVisitResult(JRAbstractObjectFactory.java:88)
at net.sf.jasperreports.engine.base.JRBaseElementGroup.(JRBaseElementGroup.java:83)
at net.sf.jasperreports.engine.base.JRBaseBand.(JRBaseBand.java:84)
at net.sf.jasperreports.engine.base.JRBaseObjectFactory.getBand(JRBaseObjectFactory.java:533)
at net.sf.jasperreports.engine.base.JRBaseReport.(JRBaseReport.java:242)
Does someone have got experience in this ?
I've linked the whole project to this question as zip file. Just extract and run.
The zip file can be found here:
https://www.dropbox.com/s/1zvbjgehtnfc1wn/jasper-reports-with-highcharts.zip?dl=0
Simply call
gradle test
or run the testcase within your IDE.

Spring data Mongo DB wrong REST configuration

currently I am writing some small web application using Spring and Mongo DB. My problem is to display ID in RESTs. I found this solution:
import org.springframework.context.annotation.Configuration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
import pl.rakoczy.taskmanager.model.Task;
#Configuration
public class RepositoryConfig extends
RepositoryRestMvcConfiguration {
#Override
protected void configureRepositoryRestConfiguration(
RepositoryRestConfiguration config) {
config.exposeIdsFor(Task.class);
}
}
After start application exception appears:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'repositoryExporterHandlerAdapter' defined in class path resource [pl/rakoczy/taskmanager/repository/RepositoryConfig.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.data.util.ClassTypeInformation.from(Ljava/lang/Class;)Lorg/springframework/data/util/TypeInformation;
I found solution to update some dependencies in gradle configuration, but I think I do have newest versions:
dependencies {
compile 'org.slf4j:slf4j-api:1.7.21'
compile group: 'org.springframework', name: 'spring-context', version: '4.3.2.RELEASE'
compile group: 'org.springframework', name: 'spring-core', version: '4.3.2.RELEASE'
compile group: 'org.springframework', name: 'spring-beans', version: '4.3.2.RELEASE'
compile group: 'org.springframework', name: 'spring-web', version: '4.3.2.RELEASE'
compile group: 'org.springframework', name: 'spring-expression', version: '4.3.2.RELEASE'
compile group: 'org.springframework', name: 'spring-asm', version: '3.1.4.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '1.4.0.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.4.0.RELEASE'
compile group: 'org.springframework.data', name: 'spring-data-mongodb', version: '1.9.2.RELEASE'
compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '1.10.2.RELEASE'
compile group: 'org.springframework.data', name: 'spring-data-rest-webmvc', version: '2.0.0.RELEASE'
compile group: 'org.springframework.hateoas', name: 'spring-hateoas', version: '0.16.0.RELEASE'
compile group: 'org.tinylog', name: 'tinylog', version: '1.1'
compile group: 'javax.inject', name: 'javax.inject', version: '1'
compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.3.0'
compile group: 'org.aspectj', name: 'aspectjweaver', version: '1.8.9'
compile group: 'cglib', name: 'cglib-nodep', version: '3.2.4'
testCompile 'junit:junit:4.12'
testCompile 'com.jayway.jsonpath:json-path'
testCompile 'org.springframework.boot:spring-boot-starter-test'
}
I am new at Spring, can you see any problems?
You have added both Spring and Spring boot dependencies. Best way to start is to use Spring Boot dependencies and then add other dependencies as per requirement. Please check https://spring.io/guides/gs/accessing-data-mongodb/. The error you are getting is related to "org.springframework.data.util.ClassTypeInformation" class which is part of spring-data-commons jar file. Check if this jar file and its latest version is there in your deployed war file. I will again suggest you to clean up your Gradle build and keep required and latest files. For example you are using older version of spring-data-rest-webmvc.
The error says that Spring is trying to invoke an init() method in that class, and none exists.
Consult the spring documentation here: http://docs.spring.io/spring-data/rest/docs/current/reference/html/#customizing-sdr.adding-sdr-to-spring-mvc-app

Categories

Resources