spring-integration: NullPointerException with aspectj advice in spring boot
Hi Team,
I have a Spring Integration application that processes messages from a MQ and posts it to another. Am trying to migrate to Spring Boot. Snippets from the setup as below ,
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>`
</parent>
aspectjweaver version - 1.8.9
Application file,
@SpringBootApplication(exclude = { JmsAutoConfiguration.class })
@ComponentScan(basePackages = { "com.abc.xxx" })
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
ApplicationConfiguration:
@Configuration
@ImportResource(locations = { "classpath:accountingContext.xml" })
public class ApplicationConfiguration {
}
Everything works fine and the application starts without any errors. But when the application processes any message from the queue, I get the following error,
Caused by: org.springframework.messaging.MessageDeliveryException: failed to send Message to channel null'; nested exception is java.lang.NullPointerException
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:449)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at com.ntrs.geh.message.job.RequestTimeoutCheckerCronJob.execute(RequestTimeoutCheckerCronJob.java:29)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
... 1 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:406)
... 4 common frames omitted
Upon debugging, I found that the datatypes reference is null in the following line,
if (this.datatypes.length > 0)` in the `AbstractMessageChannel
After referring to this thread https://github.com/spring-cloud/spring-cloud-stream/issues/881
I removed the aspect defined on the channel below and it started to work fine.
<tx:advice id="txAdvice" transaction-manager="dataSourceTransactionManager">
<tx:attributes>
<tx:method name="send" />
</tx:attributes>
</tx:advice>
<int:channel id="requestSchemaValidationChannel" />
<aop:config>
<aop:advisor advice-ref="txAdvice" pointcut="bean(requestSchemaValidationChannel)" />
</aop:config>
The same configuration used to work before we migrated to spring boot. Can you please let me know if am doing some thing wrong or if there is a workaround ?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (11 by maintainers)
Here’s the fix; add …
to
application.properties