I have set up a new Spring Boot + Spring Integration + Spring Integration Java DSL project using latest available versions. The project builds okay but, when I run the application, I am getting:
Caused by: java.lang.NoSuchMethodError: org.springframework.integration.dsl.StandardIntegrationFlow.isRegisterComponents()Z
at org.springframework.integration.dsl.config.IntegrationFlowBeanPostProcessor.processStandardIntegrationFlow(IntegrationFlowBeanPostProcessor.java:139) ~[spring-integration-java-dsl-1.2.3.RELEASE.jar:?]
at org.springframework.integration.dsl.config.IntegrationFlowBeanPostProcessor.postProcessBeforeInitialization(IntegrationFlowBeanPostProcessor.java:100) ~[spring-integration-java-dsl-1.2.3.RELEASE.jar:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:423) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE]
The dependencies being used are currently as follows:
compile ("org.springframework.boot:spring-boot-starter:2.0.0.RC1") {
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
}
compile "org.springframework.boot:spring-boot-starter-data-jpa:2.0.0.RC1"
compile "org.springframework.boot:spring-boot-starter-log4j2:2.0.0.RC1"
compile "org.springframework.integration:spring-integration-core:5.0.1.RELEASE"
compile "org.springframework.integration:spring-integration-http:5.0.1.RELEASE"
compile "org.springframework.integration:spring-integration-jms:5.0.1.RELEASE"
compile "org.springframework.integration:spring-integration-java-dsl:1.2.3.RELEASE"
Could the error be due to wrong combination of jar versions? I am not sure how to debug this error.
When you use Spring Integration 5.0 already, you don't need that extra spring-integration-java-dsl dependency. It has been merged to the core project since the version 5.0.
See more info in the Migration Guide and on that page for Spring Integration Java DSL project.
Related
I am working on a spring multi module project. I have upgraded spring version from 3.x to 5.3.17. After upgradation, while running project Iam getting following error:
Exception in thread "main" java.lang.StackOverflowError
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130)
at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
at org.slf4j.impl.JCLLoggerFactory.getLogger(JCLLoggerFactory.java:88)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130)
at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
at org.slf4j.impl.JCLLoggerFactory.getLogger(JCLLoggerFactory.java:88)
in build.gradle file:
compile(group: "org.springframework", name: "spring-core", version: "3.0.5.RELEASE").Here version changed to 5.3.17
similar things applied for spring-context,spring-web etc spring related dependencies in build.gradle
Your SLF4J uses JCL as backend and your JCL uses SLF4J as backend, hence the StackOverflow.
Newer versions of Spring have spring-jcl as transitive dependency and they redirect logging coded using Jakarta Commons Logging to SLF4J.
If moreover you have a slf4j-jcl binding on your classpath that performs the opposite redirect, you get a StackOverflowException.
Just remove slf4j-jcl from your dependencies and you should be fine.
Our project still worked well in gradle 4.10.2 (Spring boot 1.5.22), but when i have upgraded gradle to 6.6.1 it thrown exception
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':my-app'.
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener
Caused by: java.lang.NoSuchMethodError: org.gradle.api.tasks.TaskInputs.file(Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;
at org.springframework.boot.gradle.repackage.RepackagePluginFeatures$RegisterInputsOutputsAction.setupInputOutputs(RepackagePluginFeatures.java:150)
at org.springframework.boot.gradle.repackage.RepackagePluginFeatures$RegisterInputsOutputsAction.execute(RepackagePluginFeatures.java:136)
I have tried with gradle 5 it still happend.
This is my gradle.build bootRepackage section, when i removed classifier = "boot" it work without classifier feature
bootRepackage {
enabled = true
classifier = "boot"
doLast{
//some tasks
}
}
Why could this be?
Gradle 5 has removed a method that Spring Boot 1.5’s Gradle plugin requires. Spring Boot 1.5 supports Gradle 2.x or 3.x so it isn’t surprising that it does not work with Gradle 5.
If you want to use a more up-to-date version of Gradle, you’ll have to upgrade to a more up-to-date version of Spring Boot as well. At the time of writing 2.3.x is the oldest generation of Spring Boot that is still supported.
I have a Spring Boot project which uses "blessed" dependencies via the Gradle plugin. The dependencies block in my build.gradle file looks like this:
dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile "com.fasterxml.jackson.core:jackson-core"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-csv"
}
(I've removed several other dependencies for brevity.)
The above code is broken because Spring Boot does not have a "blessed" version for the dataformat-csv extension.
All I want to do is get it to use the Spring Boot-derived version for jackson-core and use it for the jackson-dataformat-csv as well for consistency. How do I get the version number for that dependency if it's been derived by a plugin?
We have a web service project that relies on Netflix's Eureka and it has a dependency on Jersey client 1.x.
Our project is using gradle and in the project we have our src, unit, integration, and functional tests. For our functional tests we have a jar that we import in the testCompile gradle section that wraps a Jersey client to send requests to the web service.
Now my question is how can I get the netflix Jersey client dependency to be ignored in the testCompile so I can use the new Jersey 2.x client for the functional tests?
Build Scripts below:
Main service build script excerpt:
dependencies {
compile 'com.netflix.eureka:eureka-client:1.1.97'
compile 'com.sun.jersey:jersey-bundle:1.18'
testCompile 'some.domain:service-test-client:1.0.1'
}
service test client relevant parts:
dependencies {
compile 'org.glassfish.jersey.core:jersey-client:2.19'
compile 'org.glassfish.jersey.connectors:jeresey-apache-connector:2.19'
}
Relevant parts of the Eureka Client gradle script from github:
ext {
githubProjectName = 'eureka'
awsVersion='1.9.3'
servletVersion='2.5'
jerseyVersion='1.11'
governatorVersion='1.3.3'
archaiusVersion='0.6.5'
blitzVersion='1.34'
mockitoVersion='1.9.5'
junit_version='4.10'
mockserverVersion='3.9.2'
jetty_version='7.2.0.v20101020'
}
dependencies {
compile "com.sun.jersey:jersey-core:$jerseyVersion"
compile "com.sun.jersey:jersey-client:$jerseyVersion"
compile 'com.sun.jersey.contribs:jersey-apache-client4:1.11'
compile 'org.apache.httpcomponents:httpclient:4.2.1'
}
With the above setup I get method not found errors because when the tests are running some of the jersey 1.x classes are taking precedence over the classes brought in with the test-client jar.
You can use gradle dependency monitoring to find out what libraries are bringing in jersey.
./gradlew dependencies
You can pipe that into a file, and less your way into finding out who's bringing in jersey 1.*.
Then, just exclude it from those specifically, and compile your own:
compile("com.example.library:artifactId:x.y.z"){
exclude group:'org.glassfish.jersey', module:jersey-common
}
compile('org.glassfish.jersey.core:jersey-common:2.4.1')
I got same problem with jersey 1.x vs glassfish 2.x with Eureka (but with Spring Cloud). I'm trying this:
compile ("org.springframework.cloud:spring-cloud-starter-eureka:1.0.0.RELEASE")
{
exclude group:'com.sun.jersey', module: 'jsr311-api'
}
But then Eureka doesn't work for me...
I think I will try to switch to Eureka 2.0 with different jersey, but without spring cloud:
https://github.com/Netflix/eureka/wiki/Eureka-2.0-Architecture-Overview
http://mvnrepository.com/artifact/com.netflix.eureka check Eureka2 dependencies
maybe you can use them?
I get the following error when trying to compile my Grails App using Spring Social plugin:
| Error Fatal error during compilation org.apache.tools.ant.BuildException:
java.lang.NoClassDefFoundError: org/springframework/social/ApiBinding
This is what I have added to my BuildConfig.groovy plugins section:
compile ':spring-security-core:1.2.7.3'
compile ":spring-security-facebook:0.14.5"
compile ":spring-social-core:0.1.31"
compile ":spring-social-facebook:0.1.32"
I had the same problem, and think I've just solved it by switching to the "spring-security-facebook" and "spring-security-twitter" Grails plugins, which themselves just source current versions of the Spring Social plugins directly from SpringSource repos.
I'm using the following with Grails 2.3.0 without errors:
Custom repositories:
mavenRepo "http://repository.springsource.com/maven/bundles/release/"
mavenRepo "http://repository.springsource.com/maven/bundles/external/"
mavenRepo "http://maven.springframework.org/release/"
Plugins:
compile ":spring-security-core:1.2.7.3"
compile ":spring-security-facebook:0.15"
compile ":spring-security-twitter:0.5.4"
As far as I can tell the problem was simply that the Spring Social Core/Facebook/Twitter plugins for Grails are years out of date (last updated in 2011) and incompatible with recent versions of Spring Security and/or Grails.