I have the following Spring Integration configuration for inbound channel Adaptor:
<bean id="inputQueue"
class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="INBOUND.QUEUE" />
</bean>
<int:channel id="inputChannel">
<int:queue ref="inputQueue"></int:queue>
</int:channel>
<jms:inbound-channel-adapter
channel="inputChannel" connection-factory="activemqConnectionFactory"
destination-name="inputQueue"></jms:inbound-channel-adapter>
I am facing issues while starting the application as it is unable to create the inputChannel bean. Please help.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inputChannel': Unsatisfied dependency expressed through constructor parameter 0: Could not convert argument value of type [org.apache.activemq.command.ActiveMQQueue] to required type [java.util.Queue]: Failed to convert value of type 'org.apache.activemq.command.ActiveMQQueue' to required type 'java.util.Queue'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.apache.activemq.command.ActiveMQQueue' to required type 'java.util.Queue': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:697) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:192) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1270) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at com.example.demo.Example1Application.main(Example1Application.java:12) [classes/:na]
The "org.apache.activemq.command.ActiveMQQueue doesn’t implement Java.util.Queue. That is what you have in the stack trace so far. On the other hand you don’t need to ad that <queue> declaration to the channel: you define a JMS Channel Adapter to deal with ActiveMQ.
Another your problem that you declare a destination-name="inputQueue", where it is a bean name. You should consider to use just destination which is indeed a reference to a bean, or really just use that INBOUND.QUEUE in this destination-name.
Related
I am using an AMQP backed channel with Spring Boot 1.4.4.RELEASE and spring-cloud-dependencies. Up to Brixton.SR6, everything is working fine. The only thing I change in my project is Brixton.SR6 to Brixton.SR7 (note that I tried all Camden versions as well and I experienced the same issue) and I start getting:
org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener threw exception at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.wrapToListenerExecutionFailedExceptionIfNeeded(AbstractMessageListenerContainer.java:873)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:783)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:703)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(SimpleMessageListenerContainer.java:98)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(SimpleMessageListenerContainer.java:189)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:1236)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:684)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:1190)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$500(SimpleMessageListenerContainer.java:98)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$4.doInTransaction(SimpleMessageListenerContainer.java:1157)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$4.doInTransaction(SimpleMessageListenerContainer.java:1150)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:1150)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1200(SimpleMessageListenerContainer.java:98)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1363)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.messaging.MessageDeliveryException: failed to send Message to channel 'Action.FieldBackup'; nested exception is org.springframework.amqp.support.converter.MessageConversionException: failed to convert to serialized Message content
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:449)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:171)
at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter.access$400(AmqpInboundChannelAdapter.java:45)
at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$1.onMessage(AmqpInboundChannelAdapter.java:95)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:780)... 14 common frames omitted
Caused by: org.springframework.amqp.support.converter.MessageConversionException: failed to convert to serialized Message content at org.springframework.amqp.support.converter.SimpleMessageConverter.createMessage(SimpleMessageConverter.java:159)
at org.springframework.amqp.support.converter.AbstractMessageConverter.toMessage(AbstractMessageConverter.java:56)
at org.springframework.amqp.rabbit.core.RabbitTemplate.convertMessageIfNecessary(RabbitTemplate.java:1227)
at org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:782)
at org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:778)
at org.springframework.integration.amqp.channel.AbstractAmqpChannel.doSend(AbstractAmqpChannel.java:165)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
... 50 common frames omitted
Caused by: java.lang.IllegalArgumentException: Could not serialize object of type: class org.springframework.messaging.support.GenericMessage at org.springframework.amqp.utils.SerializationUtils.serialize(SerializationUtils.java:52)
at org.springframework.amqp.support.converter.SimpleMessageConverter.createMessage(SimpleMessageConverter.java:156)
... 56 common frames omitted
Caused by: java.io.NotSerializableException: org.springframework.messaging.support.MessageHeaderAccessor
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at org.springframework.amqp.utils.SerializationUtils.serialize(SerializationUtils.java:49)
... 57 common frames omitted
My payload is a serializable object and with debug on (in both cases, ie Brixton.SR6 and Brixton.SR7, I can see:
o.s.messaging.MessageHeaders : Ignoring non-serializable message headers: [currentSpan, X-Current-Span]
Has anyone experienced a similar issue and found a way to upgrade to Brixton.SR7 or Camden.
The message I am trying to send to Action.FieldBackup can be seen below:
o.s.i.amqp.channel.PollableAmqpChannel : preSend on channel 'Action.FieldBackup', message: GenericMessage [payload=uk.gov.ons.ctp.response.action.message.instruction.ActionInstruction#2868ea3c, headers={amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedExchange=action-outbound-exchange, amqp_deliveryTag=394, X-Message-Sent=true, amqp_redelivered=true, messageSent=true, spanTraceId=15090187c236028f, spanId=8eff5c3a7c511e5b, amqp_receivedRoutingKey=Action.Field.binding, X-B3-SpanId=8eff5c3a7c511e5b, currentSpan=[Trace: 15090187c236028f, Span: 8eff5c3a7c511e5b, Parent: 15090187c236028f, exportable:false], X-B3-Sampled=0, X-B3-TraceId=15090187c236028f, id=8e4b81b8-17d0-1d15-d961-fe2b4d0e9cf5, amqp_consumerTag=amq.ctag-EXgeAZXQ5fGy8fUdHPdapQ, X-Current-Span=[Trace: 15090187c236028f, Span: 8eff5c3a7c511e5b, Parent: 15090187c236028f, exportable:false], spanSampled=0, contentType=text/xml, timestamp=1487262992385}]
And just before the exception ListenerExecutionFailedException is thrown I can see:
o.s.messaging.MessageHeaders : Ignoring non-serializable message headers: [currentSpan, X-Current-Span]
My xml configuration is below:
<bean id="actionInstructionListenerContainer" class="org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory" />
<property name="queueNames" value="Action.Field" />
<property name="concurrentConsumers" value="${messaging.consumingThreads}" />
<property name="prefetchCount" value="${messaging.prefetchCount}" />
<property name="txSize" value="${messaging.txSize}" />
<property name="channelTransacted" value="true" />
<property name="transactionManager" ref="transactionManager" />
</bean>
<!-- Xml msg is taken off the queue Action.Field and put on the channel actionInstructionXml -->
<int:channel id="actionInstructionXml" />
<bean id="simpleMessageConverter" class="org.springframework.amqp.support.converter.SimpleMessageConverter" />
<int-amqp:inbound-channel-adapter id="actionInstructionInboundAmqp" listener-container="actionInstructionListenerContainer"
message-converter="simpleMessageConverter" channel="actionInstructionXml" />
<!-- Xml validated against the inbound schema -->
<int:channel id="actionInstructionInvalidXml" />
<int-amqp:outbound-channel-adapter id="invalidActionInstructionOutboundAmqp" channel="actionInstructionInvalidXml" exchange-name="action-invalid-exchange" routing-key="Action.ActionInstruction.binding" />
<!-- Option to be used in Debug/Test: throw-exception-on-rejection="true" -->
<int-xml:validating-filter id="actionInstructionValidator" input-channel="actionInstructionXml"
output-channel="actionInstructionXmlValid" schema-location="classpath:xsd/actionInstruction.xsd" discard-channel="actionInstructionInvalidXml"/>
<!-- The now validated xml is transformed into the jaxb generated object model -->
<!-- To mark the channel as "pollable", set the "message-driven" property to "false" -->
<int-amqp:channel id="Action.FieldBackup" message-driven="false" connection-factory="connectionFactory"
channel-transacted="true" transaction-manager="transactionManager" tx-size="${messaging.txSize}"
concurrent-consumers="${messaging.consumingThreads}" prefetch-count="${messaging.prefetchCount}" />
<int-xml:unmarshalling-transformer
input-channel="actionInstructionXmlValid" output-channel="Action.FieldBackup"
unmarshaller="actionInstructionMarshaller" />
We are working under fix in the https://github.com/spring-cloud/spring-cloud-sleuth/issues/523. Although actually it has been done already in the https://jira.spring.io/browse/SPR-15262.
The workaround for is like:
public class ImmutableMessageInterceptor extends ChannelInterceptorAdapter {
#Override
public Message<?> preSend(Message<?> message, MessageChannel channel) {
MessageHeaderAccessor headers = MessageHeaderAccessor.getMutableAccessor(message);
return new GenericMessage<Object>(message.getPayload(), headers.toMessageHeaders());
}
}
Which you have to apply to that your Action.FieldBackup AMQP-backed channel. And the massage will be free from the left-over of the mutability hooks.
I am trying to send a basic String payload using Spring Integration Kafka v1.2.1, but it's failing with the following exception:
2015-09-03 11:50:39.729 ERROR 14418 --- [task-executor-3] [ ] o.s.integration.handler.LoggingHandler : org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.kafka.outbound.KafkaProducerMessageHandler#0]; nested exception is org.apache.kafka.common.errors.SerializationException: Can't convert value of class [B to class org.apache.kafka.common.serialization.StringSerializer specified in value.serializer
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:84)
at org.springframework.integration.endpoint.PollingConsumer.handleMessage(PollingConsumer.java:74)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:219)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:55)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:149)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:298)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.kafka.common.errors.SerializationException: Can't convert value of class [B to class org.apache.kafka.common.serialization.StringSerializer specified in value.serializer
My configuration XML looks as follows:
<task:executor id="schedule-request-task-executor" pool-size="5" keep-alive="120" queue-capacity="125"/>
<bean id="kafkaStringSerializer" class="org.apache.kafka.common.serialization.StringSerializer"/>
<int-kafka:producer-context id="schedule-request-producer-context">
<int-kafka:producer-configurations>
<int-kafka:producer-configuration topic="schedule.requests"
key-serializer="kafkaStringSerializer"
value-serializer="kafkaStringSerializer"
broker-list="${kafka.brokers}"/>
</int-kafka:producer-configurations>
</int-kafka:producer-context>
<int-kafka:outbound-channel-adapter
kafka-producer-context-ref="schedule-request-producer-context"
channel="schedule-request-channel">
<int:poller receive-timeout="0"
fixed-delay="100" time-unit="MILLISECONDS"
task-executor="schedule-request-task-executor"/>
</int-kafka:outbound-channel-adapter>
And I'm sending the message with the following code:
Message message = MessageBuilder.withPayload("PAYLOAD")
.setHeader("messageKey", "KEY")
.setHeader("topic", "schedule.requests")
.build();
scheduleRequestChannel.send(message);
I looked at the samples at https://github.com/spring-projects/spring-integration-extensions/blob/master/samples/ but these seem to be outdated.
After debugging SI and Kafka classes, I found that this happens because Spring Integration converts the String to a byte[] unless the key-class-type and value-class-type is specified in Producer Configuration.
Here's the updated configuration in case someone is interested.
<int-kafka:producer-context id="schedule-request-producer-context">
<int-kafka:producer-configurations>
<int-kafka:producer-configuration topic="schedule.requests"
key-class-type="java.lang.String"
key-serializer="kafkaStringSerializer"
value-class-type="java.lang.String"
value-serializer="kafkaStringSerializer"
broker-list="${kafka.brokers}"/>
I'm having some problems with Hazelcast deserialize. I don't know why it is happening to me.
When I build my project with Maven I can see the next error code:
GRAVE: Failed to execute callback: com.hazelcast.client.proxy.ClientMapProxy$1#382710c7! Request: com.hazelcast.map.impl.client.MapGetRequest#cbe959e, response: HeapData{type=- 25,
hashCode=1128451374, partitionHash=1128451374, dataSize=89, heapCost=117}
com.hazelcast.nio.serialization.HazelcastSerializationException: Failed to deserialize enum: com.grupo.exception.ExceptionCauseEnum
at com.hazelcast.nio.serialization.DefaultSerializers$EnumSerializer.read(DefaultSerializers.java:243)
at com.hazelcast.nio.serialization.DefaultSerializers$EnumSerializer.read(DefaultSerializers.java:225)
at com.hazelcast.nio.serialization.StreamSerializerAdapter.toObject(StreamSerializerAdapter.java:65)
at com.hazelcast.nio.serialization.SerializationServiceImpl.toObject(SerializationServiceImpl.java:260)
at com.hazelcast.client.spi.impl.ClientCallFuture$1.run(ClientCallFuture.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
Caused by: java.lang.ClassNotFoundException: com.grupo.exception.ExceptionCauseEnum
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
at com.hazelcast.nio.ClassLoaderUtil.tryLoadClass(ClassLoaderUtil.java:124)
at com.hazelcast.nio.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:113)
at com.hazelcast.nio.serialization.DefaultSerializers$EnumSerializer.read(DefaultSerializers.java:241)
... 9 more
ExceptionCauseEnum is in my classpath.
My Hazelcast instance configuration (just in case it is useful):
<hz:hazelcast id="instance">
<hz:config>
<hz:group name="${name}"
password="${pass}" />
<hz:network port="23456"
port-auto-increment="true">
<hz:join>
<hz:multicast
enabled="false"
multicast-group="${multicast-group}"
multicast-port="${multicast-port}" />
<hz:tcp-ip enabled="true">
<hz:interface>127.0.0.1</hz:interface>
</hz:tcp-ip>
</hz:join>
<hz:interfaces enabled="false">
<hz:interface></hz:interface>
</hz:interfaces>
</hz:network>
<hz:map name="myMap" max-size="5000" max-idle-seconds="3600"
time-to-live-seconds="7200" eviction-percentage="25"
eviction-policy="LRU" />
</hz:config>
</hz:hazelcast>
Although Maven throws me that error, it builds correctly.
Any idea what is happening and what am I doing wrong?
Thanks in advance.
I had a similar problem: in my case my enums had a constructor, so my solution was to create a parameterless constructor.
Spring Integration and Spring Integration AMQP.
I have the following code:
<bean id="allHeadersMapper" class="org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper">
<property name="requestHeaderNames" value="*" />
<property name="replyHeaderNames" value="*" />
</bean>
<int-amqp:inbound-channel-adapter channel="ResponseChannel" queue-names="OutputQueue" connection-factory="amqpConnectionFactory" error-channel="274ErrorChannel" header-mapper="allHeadersMapper" />
I am converting the EDI message to JSON and Placing in "OutputQueue" . While I try to Read the mesage from OutputQueue and Place in Channel, I try to map all standard and non Standard Header.
Eg.
[payload={abcPayload}, headers={amqp_consumerQueue=OutputQueue, amqp_receivedExchange=XExchange, VERSION_ID=1.0, amqp_contentEncoding=UTF-8, contentType=text/plain, amqp_redelivered=true, STATUS=ABC, timestamp=1432235031343, id=793599d5-6236-c6a1-717e-4f85f9cd9f7b, history=JSONChannel,ResponseLogging,FilterChannel1, amqp_receivedRoutingKey=OutputQueueKey, MESSAGE_ID=MESSAGE_ID, amqp_deliveryMode=NON_PERSISTENT, RECORD_ID=RECORD_ID, amqp_consumerTag=amq.ctag-7jyApLDNT5s_HbxOU8gkPQ, FLOW_NAME=BCD, amqp_deliveryTag=1}]
I am getting the Exception:
Incorrect type specified for header 'history'. Expected [class org.springframework.integration.history.MessageHistory] but actual type is [class java.util.ArrayList]
I have the following exception:
INFO 2015-01-19 11:00:00 [AbstractCorrelatingMessageHandler] - Expiring MessageGroup with correlationKey[aa7eb738-b47e-3bbe-8aca-282453ae5b29]
ERROR 2015-01-19 11:00:00 [JdbcMessageStore] - Exception in expiry callback
org.springframework.integration.MessageDeliveryException: Dispatcher has no subscribers for channel 'org.springframework.context.support.ClassPathXmlApplicationContext#19e0ff2f.SIEBELDOC_PARK_after_aggregation'.
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:81)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:181)
at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:330)
at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:169)
at org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler.sendReplyMessage(AbstractCorrelatingMessageHandler.java:436)
at org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler.sendReplies(AbstractCorrelatingMessageHandler.java:429)
at org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler.completeGroup(AbstractCorrelatingMessageHandler.java:404)
at org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler.completeGroup(AbstractCorrelatingMessageHandler.java:389)
at org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler.expireGroup(AbstractCorrelatingMessageHandler.java:371)
at org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler.forceComplete(AbstractCorrelatingMessageHandler.java:308)
at org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler.access$000(AbstractCorrelatingMessageHandler.java:71)
at org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler$1.execute(AbstractCorrelatingMessageHandler.java:137)
at org.springframework.integration.store.AbstractMessageGroupStore.expire(AbstractMessageGroupStore.java:117)
at org.springframework.integration.store.AbstractMessageGroupStore.expireMessageGroups(AbstractMessageGroupStore.java:87)
at org.springframework.integration.store.MessageGroupStoreReaper.run(MessageGroupStoreReaper.java:115)
at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
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:662)
That's the flow:
<int:channel id="SIEBELDOC_PARK_job_Channel"/>
<int:channel id="SIEBELDOC_PARK_after_split"/>
<int:channel id="SIEBELDOC_PARK_after_aggregation"/>
<int:inbound-channel-adapter channel="SIEBELDOC_PARK_job_Channel" expression="#parkingGetItems.getItems('SIEBELDOC_PARK')">
<int:poller fixed-rate="${fdl.db.item.polling.rate}"/>
</int:inbound-channel-adapter>
<int:splitter input-channel="SIEBELDOC_PARK_job_Channel" output-channel="SIEBELDOC_PARK_after_split"/>
<int:aggregator input-channel="SIEBELDOC_PARK_after_split" output-channel="SIEBELDOC_PARK_after_aggregation" message-store="SIEBELDOC_PARK_messageStore"
ref="parkingStackMessageAggregator" method="aggregate"
correlation-strategy="parkingStackMessageAggregator"
correlation-strategy-method="correlate"
release-strategy="parkingStackMessageAggregator"
release-strategy-method="release"
send-partial-result-on-expiry="true"
expire-groups-upon-completion="true"
>
</int:aggregator>
<int:chain id="jobexecutor" input-channel="SIEBELDOC_PARK_after_aggregation" >
<int:transformer>
<bean class="hu.telekom.fdl.job.IntegrationMessageToJobRequest"/>
</int:transformer>
<int:service-activator>
<bean class = "hu.telekom.fdl.job.JobLaunchMessageHandler"/>
</int:service-activator>
</int:chain>
I'm using the following reaper and messagestore code:
<int-jdbc:message-store id="SIEBELDOC_PARK_messageStore" region="SIEBELDOC_PARK_GRP" data-source="jobRepoDataSource" table-prefix="INT_" lob-handler="lobHandler"/>
<bean id="SIEBELDOC_PARK_messageStoreReaper" class="org.springframework.integration.store.MessageGroupStoreReaper">
<property name="messageGroupStore" ref="SIEBELDOC_PARK_messageStore" />
<property name="timeout" value="100000" />
</bean>
<task:scheduled-tasks>
<task:scheduled ref="SIEBELDOC_PARK_messageStoreReaper" method="run" cron="* */30 * * * ?"/>
</task:scheduled-tasks>
Can you give me advices what could be the problem?
Thanks,
For me the channel name: org.springframework.context.support.ClassPathXmlApplicationContext#19e0ff2f.SIEBELDOC_PARK_after_aggregation is also strange for me.
The original channel name is: SIEBELDOC_PARK_after_aggregation which is not the same as the channel name referred in the stacktracce.
Ferenc
org.springframework.context.support.ClassPathXmlApplicationContext#19e0ff2f.SIEBELDOC_PARK_after_aggregation is a result of AbstractMessageChannel#getFullChannelName(). As you see we include there an ApplicationContext id.
I may guess, but would be better if you remove that jobexecutor id from the <chain>. There might be another bean in the ctx with the same id. No ?
How does it work if you just send messages to the aggregator for regular releasing? Don't you see the same MessageDeliveryException ?