java.lang.IllegalArgumentException

tip

If you're unit testing, you should instantiate only the service and mock the dependencies. If you're testing integration, you should add all the mocking to the configurations file.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • When using a simple gemfire message store, first msg is received successfully, then continuously getting two exceptions. Just started happening when upgrading to 2.1M3 1. From thread doing a queue.send(): {code} org.springframework.integration.MessageDeliveryException: failed to send Message to channel 'gemfireBackedChannel' at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:165) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128) at com.vmware.vshield.vsm.auditing.service.impl.AuditingServiceImpl.log(AuditingServiceImpl.java:50) at com.vmware.vshield.vsm.auditing.service.impl.AuditLogGenerator$AuditLogThread.run(AuditLogGenerator.java:49) Caused by: java.lang.IllegalArgumentException: Object of class [null] must be an instance of interface org.springframework.integration.Message at org.springframework.util.Assert.isInstanceOf(Assert.java:337) at org.springframework.util.Assert.isInstanceOf(Assert.java:319) at org.springframework.integration.store.AbstractKeyValueMessageStore.getRawMessage(AbstractKeyValueMessageStore.java:277) at org.springframework.integration.store.AbstractKeyValueMessageStore.getMessage(AbstractKeyValueMessageStore.java:50) at org.springframework.integration.store.AbstractKeyValueMessageStore.buildMessageGroup(AbstractKeyValueMessageStore.java:242) at org.springframework.integration.store.AbstractKeyValueMessageStore.getMessageGroup(AbstractKeyValueMessageStore.java:87) at org.springframework.integration.store.AbstractKeyValueMessageStore.addMessageToGroup(AbstractKeyValueMessageStore.java:99) at org.springframework.integration.store.MessageGroupQueue.offer(MessageGroupQueue.java:86) at org.springframework.integration.store.MessageGroupQueue.put(MessageGroupQueue.java:169) at org.springframework.integration.store.MessageGroupQueue.put(MessageGroupQueue.java:37) at org.springframework.integration.channel.QueueChannel.doSend(QueueChannel.java:79) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157) {code} 2. From second thread (poller) attempting to get the next msg from the queue: {code} 09:59:31.488 ERROR task-scheduler-2 LoggingHandler:126 - java.lang.IllegalArgumentException: message must not be null at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.integration.support.MessageBuilder.fromMessage(MessageBuilder.java:74) at org.springframework.integration.store.AbstractKeyValueMessageStore.normalizeMessage(AbstractKeyValueMessageStore.java:207) at org.springframework.integration.store.AbstractKeyValueMessageStore.pollMessageFromGroup(AbstractKeyValueMessageStore.java:186) at org.springframework.integration.store.MessageGroupQueue.poll(MessageGroupQueue.java:105) at org.springframework.integration.store.MessageGroupQueue.poll(MessageGroupQueue.java:37) at org.springframework.integration.channel.QueueChannel.doReceive(QueueChannel.java:94) at org.springframework.integration.channel.AbstractPollableChannel.receive(AbstractPollableChannel.java:57) at org.springframework.integration.endpoint.PollingConsumer.doPoll(PollingConsumer.java:58) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:144) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:207) at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48) at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:202) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) {code}
    via by Jim Stabile,
  • When using a simple gemfire message store, first msg is received successfully, then continuously getting two exceptions. Just started happening when upgrading to 2.1M3 1. From thread doing a queue.send(): {code} org.springframework.integration.MessageDeliveryException: failed to send Message to channel 'gemfireBackedChannel' at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:165) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128) at com.vmware.vshield.vsm.auditing.service.impl.AuditingServiceImpl.log(AuditingServiceImpl.java:50) at com.vmware.vshield.vsm.auditing.service.impl.AuditLogGenerator$AuditLogThread.run(AuditLogGenerator.java:49) Caused by: java.lang.IllegalArgumentException: Object of class [null] must be an instance of interface org.springframework.integration.Message at org.springframework.util.Assert.isInstanceOf(Assert.java:337) at org.springframework.util.Assert.isInstanceOf(Assert.java:319) at org.springframework.integration.store.AbstractKeyValueMessageStore.getRawMessage(AbstractKeyValueMessageStore.java:277) at org.springframework.integration.store.AbstractKeyValueMessageStore.getMessage(AbstractKeyValueMessageStore.java:50) at org.springframework.integration.store.AbstractKeyValueMessageStore.buildMessageGroup(AbstractKeyValueMessageStore.java:242) at org.springframework.integration.store.AbstractKeyValueMessageStore.getMessageGroup(AbstractKeyValueMessageStore.java:87) at org.springframework.integration.store.AbstractKeyValueMessageStore.addMessageToGroup(AbstractKeyValueMessageStore.java:99) at org.springframework.integration.store.MessageGroupQueue.offer(MessageGroupQueue.java:86) at org.springframework.integration.store.MessageGroupQueue.put(MessageGroupQueue.java:169) at org.springframework.integration.store.MessageGroupQueue.put(MessageGroupQueue.java:37) at org.springframework.integration.channel.QueueChannel.doSend(QueueChannel.java:79) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157) {code} 2. From second thread (poller) attempting to get the next msg from the queue: {code} 09:59:31.488 ERROR task-scheduler-2 LoggingHandler:126 - java.lang.IllegalArgumentException: message must not be null at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.integration.support.MessageBuilder.fromMessage(MessageBuilder.java:74) at org.springframework.integration.store.AbstractKeyValueMessageStore.normalizeMessage(AbstractKeyValueMessageStore.java:207) at org.springframework.integration.store.AbstractKeyValueMessageStore.pollMessageFromGroup(AbstractKeyValueMessageStore.java:186) at org.springframework.integration.store.MessageGroupQueue.poll(MessageGroupQueue.java:105) at org.springframework.integration.store.MessageGroupQueue.poll(MessageGroupQueue.java:37) at org.springframework.integration.channel.QueueChannel.doReceive(QueueChannel.java:94) at org.springframework.integration.channel.AbstractPollableChannel.receive(AbstractPollableChannel.java:57) at org.springframework.integration.endpoint.PollingConsumer.doPoll(PollingConsumer.java:58) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:144) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:207) at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48) at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:202) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) {code}
    via by Jim Stabile,
  • While prepping to release Spring BlazeDS Integration 1.5.0.M2, I discovered a change in the behavior of the inbound-channel-adapter. When referencing a POJO method, and the method returns null, the following error now occurs (whereas versions prior to 2.0.2 allowed this, essentially discarding the null result): {code} ERROR: org.springframework.integration.handler.LoggingHandler - java.lang.IllegalArgumentException: payload must not be null at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.integration.support.MessageBuilder.<init>(MessageBuilder.java:57) at org.springframework.integration.support.MessageBuilder.withPayload(MessageBuilder.java:83) at org.springframework.integration.endpoint.AbstractMessageSource.receive(AbstractMessageSource.java:74) at org.springframework.integration.endpoint.SourcePollingChannelAdapter.doPoll(SourcePollingChannelAdapter.java:89) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:145) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:143) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:206) at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48) at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:201) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680) {code} For an example of the problem, see the Spring BlazeDS Integration Test Drive app at: https://src.springframework.org/svn/spring-flex/trunk/spring-flex-samples/spring-flex-testdrive This error appears upon startup, and reoccurs every 5 seconds due to the configured polling interval.
    via by Jeremy Grelle,
  • While prepping to release Spring BlazeDS Integration 1.5.0.M2, I discovered a change in the behavior of the inbound-channel-adapter. When referencing a POJO method, and the method returns null, the following error now occurs (whereas versions prior to 2.0.2 allowed this, essentially discarding the null result): {code} ERROR: org.springframework.integration.handler.LoggingHandler - java.lang.IllegalArgumentException: payload must not be null at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.integration.support.MessageBuilder.<init>(MessageBuilder.java:57) at org.springframework.integration.support.MessageBuilder.withPayload(MessageBuilder.java:83) at org.springframework.integration.endpoint.AbstractMessageSource.receive(AbstractMessageSource.java:74) at org.springframework.integration.endpoint.SourcePollingChannelAdapter.doPoll(SourcePollingChannelAdapter.java:89) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:145) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:143) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:206) at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48) at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:201) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680) {code} For an example of the problem, see the Spring BlazeDS Integration Test Drive app at: https://src.springframework.org/svn/spring-flex/trunk/spring-flex-samples/spring-flex-testdrive This error appears upon startup, and reoccurs every 5 seconds due to the configured polling interval.
    via by Jeremy Grelle,
  • Spring Boot test class wont inject beans
    via Stack Overflow by rayman
    ,
  • Spring file upload by ajax
    via Stack Overflow by kris14an
    ,
    • java.lang.IllegalArgumentException: message must not be null at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.integration.support.MessageBuilder.fromMessage(MessageBuilder.java:74) at org.springframework.integration.store.AbstractKeyValueMessageStore.normalizeMessage(AbstractKeyValueMessageStore.java:207) at org.springframework.integration.store.AbstractKeyValueMessageStore.pollMessageFromGroup(AbstractKeyValueMessageStore.java:186) at org.springframework.integration.store.MessageGroupQueue.poll(MessageGroupQueue.java:105) at org.springframework.integration.store.MessageGroupQueue.poll(MessageGroupQueue.java:37) at org.springframework.integration.channel.QueueChannel.doReceive(QueueChannel.java:94) at org.springframework.integration.channel.AbstractPollableChannel.receive(AbstractPollableChannel.java:57) at org.springframework.integration.endpoint.PollingConsumer.doPoll(PollingConsumer.java:58) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:144) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:207) at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48) at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:202) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)

    Users with the same issue

    osvzsosvzs
    2 times, last one,
    oddodd
    2 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    mauritiusmauritius
    1 times, last one,
    189 more bugmates