I am trying to run my app and keep encountering the error:
Error:Error converting bytecode to dex:
Cause: default or static interface method used without --min-sdk-version >= 24
I am unsure what is wrong as it doesnt provide much information. It was running before. i have looked at similar questions but they are different. They all had to do with the dependencies in the build.gradle though so i have shown that below.
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile group: 'com.googlecode.libphonenumber', name: 'libphonenumber', version: '8.4.3'
compile group: 'com.pubnub', name: 'pubnub-gson', version: '4.6.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.7.3'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.7.3'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.3'
compile group: 'com.google.guava', name: 'guava', version: '21.0'
compile group: 'joda-time', name: 'joda-time', version: '2.9.7'
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.google.android.gms:play-services-location:10.2.6'
The culprit here is guava
compile group: 'com.google.guava', name: 'guava', version: '21.0'
change it to:
compile group: 'com.google.guava', name: 'guava', version: '22.0'
and it will work
you can see in the changelog:
https://github.com/google/guava/wiki/Release21
Related
I have a spring boot app. It is mainly a Kafka listening app and its only web application part is the health check API through the spring-boot-starter-actuator.
When running locally in IntelliJ, the application runs perfectly, with no errors and no crashes.
However, when trying to run the app through docker, the app starts (i can see the spring logo) and then it imidietly crashes with the next error:
[org.springframework.boot.SpringApplication] - Application run failed
MyApp | 2021-02-25T19:17:17.802342316Z org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
My dependency section in the build.gradle file looks as follows:
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.kafka:spring-kafka'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.4.2'
/*logging*/
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.30'
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
compile group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '6.4'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3'
compile group: 'ch.qos.logback', name: 'logback-access', version: '1.2.3'
/*lombok*/
compileOnly 'org.projectlombok:lombok:1.18.16'
annotationProcessor 'org.projectlombok:lombok:1.18.16'
/*metrics*/
compile group: 'io.prometheus', name: 'simpleclient', version: '0.9.0'
compile group: 'io.prometheus', name: 'simpleclient_httpserver', version: '0.9.0'
compile group: 'io.prometheus', name: 'simpleclient_servlet', version: '0.9.0'
compile group: 'io.micrometer', name: 'micrometer-registry-prometheus', version: '1.5.1'
compile group: 'io.micrometer', name: 'micrometer-core', version: '1.5.1'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '2.4.2'
/*Jetty server*/
compile group: 'org.eclipse.jetty', name: 'jetty-server', version: '9.4.29.v20200521'
compile group: 'org.eclipse.jetty', name: 'jetty-servlet', version: '9.4.29.v20200521'
/* mysql */
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.22'
/*mongo*/
compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.12.7'
// generate pojo from avro schema
compile "org.apache.avro:avro-compiler:1.10.0"
//avro serde
compile group: 'io.confluent', name: 'kafka-streams-avro-serde', version: '5.2.1'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.12.0'
compile group: 'io.projectreactor', name: 'reactor-core', version: '3.4.0'
implementation('com.fasterxml.jackson.dataformat:jackson-dataformat-avro:2.11.2')
/* cassandra*/
implementation("io.dropwizard.metrics:metrics-core:3.2.2")
compile group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '3.8.0'
compile group: 'com.datastax.cassandra', name: 'cassandra-driver-mapping', version: '3.10.2'
/*tests*/
testImplementation 'org.springframework.kafka:spring-kafka-test'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testCompile("junit:junit:4.12")
}
My main application class looks as follows:
#SpringBootApplication()
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
}
Can anyone shed some light on the reason behind this issue and how to fix it?
Why would it run with no problems in IntelliJ but crash with docker?
Any help would be appreciated.
Thank you.
I've recently started using Avro and Kafka in my spring boot project. Now I've googled this and can't seem to find a straight answer.
When I build my war via my gradle build file, can I include the classes autogenerated from Avro schema?
Look at the war file when its exploded it doesnt seem to include those classes.
Here is my build.gradle file.
Many thanks for reading this question and if you have the time to help!
plugins {
id "org.springframework.boot" version "2.4.2"
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
id "com.commercehub.gradle.plugin.avro" version "0.21.0"
id "idea"
}
group 'com.test.tge-auth-service'
version '1.0'
java {
sourceCompatibility = JavaVersion.VERSION_14
targetCompatibility = JavaVersion.VERSION_14
}
ext {
avroVersion = "1.10.1"
}
repositories {
mavenCentral()
jcenter()
maven {
url "https://packages.confluent.io/maven/"
}
}
avro {
createSetters = true
fieldVisibility = "PRIVATE"
}
//apply plugin: "war"
dependencies {
// providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
compile group: 'co.elastic.logging', name: 'logback-ecs-encoder', version: '0.5.2'
compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.860'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '3.0.0'
compile group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'
compile('org.springframework.boot:spring-boot-starter-data-elasticsearch')
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-mongodb', version: '2.3.3.RELEASE'
compile group: 'org.springframework.data', name: 'spring-data-elasticsearch', version: '4.0.4.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '2.3.3.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '2.3.3.RELEASE'
compile group: 'org.springframework.security', name: 'spring-security-oauth2-client', version: '5.4.0'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: '2.4.2'
compile group: 'org.springframework.kafka', name: 'spring-kafka', version: '2.6.5'
compile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.11.2'
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.21'
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
compile group: 'org.openapitools', name: 'jackson-databind-nullable', version: '0.2.1'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.11'
compile group: 'org.passay', name: 'passay', version: '1.6.0'
compile group: 'com.google.guava', name: 'guava', version: '30.0-jre'
compile group: 'io.confluent', name: 'kafka-schema-registry-client', version: '6.0.0'
compile group: 'io.confluent', name: 'kafka-avro-serializer', version: '6.0.0'
compile group: 'io.confluent', name: 'monitoring-interceptors', version: '6.0.0'
compile(group: 'io.confluent', name: 'kafka-streams-avro-serde', version:'6.0.0') {
exclude(module: 'log4j-over-slf4j')
}
compile "org.apache.avro:avro:1.10.1"
implementation "org.apache.avro:avro:${avroVersion}"
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
implementation 'com.amazonaws:aws-java-sdk-s3'
implementation 'org.springframework.boot:spring-boot-starter-web'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompileOnly 'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
jar {
manifest {
attributes(
'Main-Class': 'com.test.SpringBootPersistenceApplication'
)
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
}
Ok so, for me what worked was a rebuild of the project in Intellij.
We decided to use SparkJava, Kotlin and Mustache for a commercial web product. And our product needs to be integrated with Google (YouTube) API’s.
The project’s all endpoints were working properly. (Backoffice, CRUD operations etc.) And we started to implement integrations of YouTube and I had to add Google libraries into my project for kickoff. (Not to add any of extra code, just added the library google-oauth-client-jetty.)
You can find my Gradle libraries below :
dependencies {
// Below library is a part of the requirements or YouTube Integration
compile group: 'com.google.oauth-client', name: 'google-oauth-client-jetty', version: '1.11.0-beta'
// And these are the others
compile fileTree(include: ['*.jar'], dir: 'lib')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile group: 'com.sparkjava', name: 'spark-core', version: '2.7.0'
compile 'com.google.code.gson:gson:2.8.1'
compile group: 'commons-codec', name: 'commons-codec', version: '1.9'
compile 'com.github.jkcclemens:khttp:0.1.0' // -SNAPSHOT
compile 'com.beust:klaxon:0.30'
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.58'
compile group: 'org.hibernate', name: 'hibernate-gradle-plugin', version: '5.2.10.Final'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.10.Final'
compile group: 'org.hibernate', name: 'hibernate-entitymanager', version: '5.2.10.Final'
compile group: 'org.hibernate', name: 'hibernate-validator', version: '6.0.0.CR3'
compile group: 'mysql', name: 'mysql-connector-java', version: '6.0.6'
compile group: 'org.hibernate', name: 'hibernate-c3p0', version: '4.1.0.Final'
compile 'io.sentry:sentry-log4j:1.4.0'
compile group: 'javax.mail', name: 'mail', version: '1.4.1'
compile group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.0'
compile group: 'commons-validator', name: 'commons-validator', version: '1.4.0'
compile "org.testng:testng:6.9.10"
compile "org.apache.httpcomponents:httpclient:4.5.2"
compile "org.apache.httpcomponents:httpcore:4.4.4"
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
compile group: 'com.sparkjava', name: 'spark-template-mustache', version: '2.5.5'
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
When I especially add library 'google-oauth-client-jetty', version: '1.11.0-beta’ into the project, I cannot reach the endpoints via http (GET, POST, PUT none of them). I enabled SparkJava's logs and I am facing with the logs below.
For example, I am calling
http://localhost:3000/admin
And the result is :
[qtp1864334028-15] WARN org.eclipse.jetty.server.HttpChannel - /admin
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getHeaders(Ljava/lang/String;)Ljava/util/Collection;
at spark.utils.GzipUtils.checkAndWrap(GzipUtils.java:67)
at spark.http.matching.Body.serializeTo(Body.java:69)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:189)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:564)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591)
at java.lang.Thread.run(Thread.java:745)
As It seems, it is quite mandatory to use method "LocalServerReceiver() in the google-oauth-client-jetty library".
We need any help to move on.
I found the problem :
google-oauth-client-jetty (LocalServerReceiver) was using the org.mortbay.jetty which has the old version of servlet-api. (2.5.**)
I excluded and changed LocalServerReceiver class.. Put in my package. And changed jetty to org.eclipse.jetty.
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.
org.apache.hadoop.mapred.WeightAdjuster
and
org.apache.hadoop.mapred.NewJobWeightBooster
I've added all the jars I can find on Maven almost. Here's my current build.gradle:
dependencies {
compile group: 'org.apache.hadoop', name: 'hadoop-core', version: '1.2.1'
compile group: 'org.apache.hadoop', name: 'hadoop-common', version: '2.5.1'
compile group: 'org.apache.hadoop', name: 'hadoop-yarn-common', version: '2.5.1'
compile group: 'org.apache.hadoop', name: 'hadoop-yarn-server-common', version: '2.5.1'
compile group: 'org.apache.hadoop', name: 'hadoop-mapreduce-client-core', version: '2.5.1'
compile group: 'org.apache.hadoop', name: 'hadoop-mapreduce-client-common', version: '2.5.1'
compile group: 'org.apache.hadoop', name: 'hadoop-mapreduce-client-jobclient', version: '2.5.1'
compile group: 'org.apache.hadoop', name: 'hadoop-mapreduce-client-app', version: '2.5.1'
compile group: 'org.apache.hadoop', name: 'hadoop-tools', version: '1.2.1'
}
Which jar should I be grabbing? This link gives a partial description.
After adding every hadoop jar on Maven, I found it:
compile group: 'org.apache.hadoop', name: 'hadoop-yarn-server-resourcemanager', version: '2.5.1'