0

I am seeing the following error when using Http.outboundGateway, Can someone help where i am going wrong

@Bean
public IntegrationFlow syncProcessFlow() {
    return 
            // dsl code to fetch a message from Queue
            ...
            .<Event, EventType>route(event -> event.getType(), mapping -> mapping
                    .channelMapping(EventType.CREATE, "createFlow")
                    .defaultOutputChannel("nullChannel")
                    .resolutionRequired(false))
            .get();
}

@Bean
public IntegrationFlow createFlow() {
    return IntegrationFlows.from("createFlow")
           .handle(Http.outboundGateway("http://google.com")
                    .httpMethod(HttpMethod.GET)
                    .expectedResponseType(String.class))
            .log(LoggingHandler.Level.DEBUG, "response", m -> m.getPayload())
            .log(LoggingHandler.Level.DEBUG, "response", m -> m.getHeaders())
            .get();
}

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler#0': Post-processing of merged bean definition failed; nested exception is java.la
ng.IllegalStateException: Failed to introspect Class [org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandler] from ClassLoader [java.net.URLClassLoader@6e708cdf]


Caused by: java.lang.NoClassDefFoundError: Lorg/springframework/expression/spel/support/SimpleEvaluationContext;
Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
nagendra
  • 593
  • 1
  • 9
  • 29

1 Answers1

2

The

java.lang.NoClassDefFoundError: Lorg/springframework/expression/spel/support/SimpleEvaluationContext;

means that you have upgraded to the latest Spring Integration, but you still stick with the previous Spring Framework version.

Or you need to rely on the transitive dependency from the Spring Integration, or upgrade Spring Framework as well.

All the reason of such a breaking change is here: https://spring.io/blog/2018/04/05/multiple-cve-reports-published-for-the-spring-framework

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • The above error disappeared after moving from `5.0.4.RELEASE 2.0.0.RELEASE` to `5.0.5.RELEASE 2.0.1.RELEASE` – nagendra Apr 11 '18 at 13:42
  • 1
    You don’t need to manage Spring Integration version if you deal with Spring Boot – Artem Bilan Apr 11 '18 at 13:44
  • okay. That answers why spring integration version is not mentioned in example https://spring.io/guides/gs/integration/ – nagendra Apr 11 '18 at 13:50
  • Now i am seeing the following error `Bean named 'createFlow' is expected to be of type 'org.springframework.messaging.MessageChannel' but was actually of type 'org.springframework.integration.dsl.StandardIntegrationFlow' ` when i change the IntegrationFlows.from("createFlow") to IntegrationFlows.from(MessageChannels.direct("createFlow")) then i see `Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'createFlow': Requested bean is currently in creation: Is there an unresolvable circular reference?` – nagendra Apr 11 '18 at 13:53
  • 1
    You can’t use the same bean name for different objects. You see you declare an `IntegrationFlow` bean as `createFlow`, but the you try to use the same nam for channel definition – Artem Bilan Apr 11 '18 at 14:00
  • Ok got it. Worked now by changing the bean name – nagendra Apr 11 '18 at 14:27