Reputation: 1324
Getting below issue post upgrading Spring boot app to Java 11, this was working fine even on 2.1 spring boot on Jdk 8
Jdk : Correto 11
Spring boot : 2.2.13.RELEASE
Spring Integration : 5.2.11.RELEASE
Code :
.route("headers.get(T(com.foo.integration.FlowHeaders).FEED).getProcessingMode()",
m -> m.subFlowMapping(Feed.ProcessingMode.stream, this.streamFlow(sinkStreamProcessingHandler))
.subFlowMapping(Feed.ProcessingMode.batch,
this.batchFlow(sinkBatchProcessingHandler, props))
.subFlowMapping(Feed.ProcessingMode.group,
Exception :
ExceptionFlow - Exception in flow ... [EL1005E: Type cannot be found 'com.foo.integration.FlowHeaders']
org.springframework.messaging.MessageHandlingException: Expression evaluation failed: headers.get(T(com.foo.integration.FlowHeaders).FEED).getProcessingMode();
nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1005E: Type cannot be found 'com.foo.integration.FlowHeaders'
at org.springframework.integration.support.utils.IntegrationUtils.wrapInHandlingExceptionIfNecessary(IntegrationUtils.java:191)
at org.springframework.integration.util.AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:137)
at org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor.processMessage(ExpressionEvaluatingMessageProcessor.java:107)
at org.springframework.integration.router.AbstractMessageProcessingRouter.getChannelKeys(AbstractMessageProcessingRouter.java:84)
at org.springframework.integration.router.AbstractMappingMessageRouter.determineTargetChannels(AbstractMappingMessageRouter.java:202)
at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:170)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:177)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:115)
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1005E: Type cannot be found 'com.wellmanage.wfg.fdps.integration.FDPSHeaders'
at org.springframework.expression.spel.support.StandardTypeLocator.findType(StandardTypeLocator.java:117)
at org.springframework.expression.spel.ExpressionState.findType(ExpressionState.java:155)
at org.springframework.expression.spel.ast.TypeReference.getValueInternal(TypeReference.java:69)
at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:55)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:91)
at org.springframework.expression.spel.ast.MethodReference.getArguments(MethodReference.java:164)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:94)
at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:61)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:91)
at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:117)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:375)
at org.springframework.integration.util.AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:171)
at org.springframework.integration.util.AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:129)
UPDATE
This change somehow made it work though not completely sure as this is the same code as in the oob bean
@Primary @Bean(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME)
public IntegrationEvaluationContextFactoryBean evaluationContextFactoryBean(){
var factoryBean = new IntegrationEvaluationContextFactoryBean();
factoryBean.setTypeLocator(new CustomStandardTypeLocator());
return factoryBean;
}
static class CustomStandardTypeLocator extends StandardTypeLocator {
@Override
public Class<?> findType(String typeName) throws EvaluationException {
LOG.info("Finding type {} in classloader {}", typeName, ClassUtils.getDefaultClassLoader().getName());
return super.findType(typeName);
}
}
Upvotes: 3
Views: 4683