Andrei,
According to the log file you posted, there's no 'in' message on the
MessageExchange --> InOnly[
id: ID:10.12.34.82-11bdb82a40a-5:0
status: Active
role: provider
endpoint: endpoint1
in: null
]
Not sure if this is the MessageExchange that was started with your Java
code snippet below, but if it is: did you put any message content in
there? The message content is what is going into the JMS message body.
Could you try if this works if you set e.g. a StringSource with a simple
XML message payload?
Regards,
Gert
Andrei Slepchenko wrote:
Hi ServiceMix Community,
I have service, which get request from HTTP+SOAP(CXF, this is worked),
process it and deliver result to second service via JMS ActiveMQ.
I used internal(ActiveMQ 4.1.1) and external(ActiveMQ 5.1.0) message
brokers and servicemix 3.2.1 & 3.2.2.
First service sent NormalizedMessage to second service via JMS binding
component.
Second service received NormalizedMessage via JMS binding component.
The problem is as follows: First service sent null message to JMS
queue, send service received null message and ServiceMix throws
Exception:
Execution of JMS message listener failed;
javax.jms.JMSException: Error sending JBI exchange;
Caused by: java.lang.NullPointerException: text can not be null.
Is this error in my code or my bean.xml or this is servicemix bug and
i shall rewrite default marshaller?
Thank you for attention and help.
With best regards, Andrei.
PS>
---------------------------------------------------------------------------
xbean.xml (from first service)
---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
xmlns:amq="http://activemq.org/config/1.0"
xmlns:mail-template-jms-bridge="http://com.oxseed/services/mail-template-jms-bridge-service">
<jms:provider
service="mail-template-jms-bridge:MailTemplateJMSBridgeService"
endpoint="endpoint1"
destinationName="queue/A"
connectionFactory="#connectionFactory"/>
<amq:connectionFactory id="connectionFactory"
brokerURL="tcp://localhost:61617" />
</beans>
---------------------------------------------------------------------------
Code
---------------------------------------------------------------------------
.....
QName DEFAULT_MAIL_SERVICE = new
QName("http://com.oxseed/services/mail-template-jms-bridge-service",
"MailTemplateJMSBridgeService");
ServiceMixClient serviceMixClient = new ServiceMixClientFacade(context);
EndpointResolver endpointResolver =
serviceMixClient.createResolverForService(destQname);
InOnly inOnlyExchange =
serviceMixClient.createInOnlyExchange(endpointResolver);
NormalizedMessage msg = inOnlyExchange.getInMessage();
...
msg.setProperty(MSG_TAG_TO, headers.get("To"));
...
serviceMixClient.sendSync(inOnlyExchange);
serviceMixClient.close();
.....
---------------------------------------------------------------------------
xbean.xml (from second service binding component)
---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
xmlns:amq="http://activemq.org/config/1.0"
xmlns:mail-template-jms-bridge="http://com.oxseed/services/mail-template-jms-bridge-service">
<jms:consumer
service="mail-template-jms-bridge:MailTemplateJMSBridgeService"
endpoint="endpoint"
targetService="mail-template-jms-bridge:MailTemplateJMSBridgeService"
destinationName="queue/A"
connectionFactory="#connectionFactory" />
<amq:connectionFactory id="connectionFactory"
brokerURL="tcp://localhost:61617" />
</beans>
---------------------------------------------------------------------------
xbean.xml (from second service service engine )
---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:bean="http://servicemix.apache.org/bean/1.0"
xmlns:mail-template-jms-bridge="http://com.oxseed/services/mail-template-jms-bridge-service">
<bean:endpoint
service="mail-template-jms-bridge:MailTemplateJMSBridgeService"
endpoint="endpoint" bean="#MessageRouterImpl" />
<bean id="MessageRouterImpl"
class="com.oxseed.services.mail_template_jms_bridge_service.MessageExchangeListenerImpl"
/>
</beans>
---------------------------------------------------------------------------
Code
---------------------------------------------------------------------------
package com.oxseed.services.mail_template_jms_bridge_service;
import javax.annotation.Resource;
import javax.jbi.component.ComponentContext;
import javax.jbi.messaging.DeliveryChannel;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.InOnly;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;
import org.apache.servicemix.MessageExchangeListener;
import org.apache.servicemix.common.ExchangeProcessor;
public class MessageExchangeListenerImpl implements
MessageExchangeListener { @Resource
private DeliveryChannel channel;
public MessageExchangeListenerImpl() {
super();
}
public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
// InOnly inOnly = (InOnly) exchange;
//System.out.println("JMS message received ...");
//System.out.println("Message: "+messageExchange);
//System.out.println("-----------------------------------------------");
//messageExchange.setStatus(ExchangeStatus.DONE);
//channel.send(exchange);
}
}
---------------------------------------------------------------------------
ServiceMix Log
---------------------------------------------------------------------------
18:09:18,953 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
CxfSeComponent | emix.common.AsyncBaseLifeCycle 468 |
Received exchange: status: Active, role: provider
18:09:18,953 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
CxfSeComponent | emix.common.AsyncBaseLifeCycle 536 |
Retrieved correlation id: ID:10.12.34.82-11bdb82a40a-4:0
18:09:18,953 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
faultListableBeanFactory | ry.support.AbstractBeanFactory 203 |
Returning cached instance of singleton bean
'org.apache.cxf.transport.jbi.JBITransportFactory'
18:09:18,953 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
faultListableBeanFactory | ry.support.AbstractBeanFactory 203 |
Returning cached instance of singleton bean
'org.apache.cxf.transport.jbi.JBITransportFactory'
18:09:19,156 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
CxfSeComponent | emix.common.AsyncBaseLifeCycle 593 |
Correlation id retrieved from ThreadLocal: ID:10.12.34.82-11bdb82a40a-4:0
18:09:19,156 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
DeliveryChannelImpl | .messaging.DeliveryChannelImpl 458 |
SendSync ID:10.12.34.82-11bdb82a40a-5:0 in
DeliveryChannel{servicemix-cxf-se}
18:09:19,156 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
SecuredBroker | mix.jbi.security.SecuredBroker 66 | send
exchange with secure broker
18:09:19,156 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
SecuredBroker | mix.jbi.security.SecuredBroker 72 |
service name
:{http://com.oxseed/services/mail-template-jms-bridge-service}MailTemplateJMSBridgeService
18:09:19,156 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
SecuredBroker | mix.jbi.security.SecuredBroker 73 |
operation name :null
18:09:19,156 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
SedaFlow | emix.jbi.nmr.flow.AbstractFlow 118 |
Called Flow send
18:09:19,156 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
DeliveryChannelImpl | .messaging.DeliveryChannelImpl 693 |
Waiting for exchange ID:10.12.34.82-11bdb82a40a-5:0 (1760aec) to be
answered in DeliveryChannel{servicemix-cxf-se} from sendSync
18:09:19,156 | DEBUG | pool-flow.seda.servicemix-jms-thread-1 |
SedaQueue | .jbi.nmr.flow.seda.SedaQueue$1 132 |
[EMAIL PROTECTED] dequeued
exchange: InOnly[
id: ID:10.12.34.82-11bdb82a40a-5:0
status: Active
role: provider
endpoint: endpoint1
in: null
]
18:09:19,156 | DEBUG | pool-flow.seda.servicemix-jms-thread-1 |
JmsComponent | emix.common.AsyncBaseLifeCycle 468 |
Received exchange: status: Active, role: provider
18:09:19,156 | DEBUG | pool-flow.seda.servicemix-jms-thread-1 |
JmsComponent | emix.common.AsyncBaseLifeCycle 536 |
Retrieved correlation id: ID:10.12.34.82-11bdb82a40a-4:0
18:09:19,156 | DEBUG | pool-flow.seda.servicemix-jms-thread-1 |
WireFormatNegotiator | transport.WireFormatNegotiator 71 |
Sending: WireFormatInfo { version=2,
properties={TightEncodingEnabled=true, CacheSize=1024,
TcpNoDelayEnabled=true, SizePrefixDisabled=false,
StackTraceEnabled=true, MaxInactivityDuration=30000,
CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
18:09:19,171 | DEBUG | ActiveMQ Transport:
tcp://localhost/127.0.0.1:61617 | WireFormatNegotiator |
transport.WireFormatNegotiator 102 | Received WireFormat:
WireFormatInfo { version=3, properties={TightEncodingEnabled=true,
CacheSize=1024, TcpNoDelayEnabled=true, SizePrefixDisabled=false,
StackTraceEnabled=true, MaxInactivityDurationInitalDelay=10000,
MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
18:09:19,171 | DEBUG | ActiveMQ Transport:
tcp://localhost/127.0.0.1:61617 | WireFormatNegotiator |
transport.WireFormatNegotiator 109 | tcp://localhost/127.0.0.1:61617
before negotiation: OpenWireFormat{version=2, cacheEnabled=false,
stackTraceEnabled=false, tightEncodingEnabled=false,
sizePrefixDisabled=false}
18:09:19,171 | DEBUG | ActiveMQ Transport:
tcp://localhost/127.0.0.1:61617 | WireFormatNegotiator |
transport.WireFormatNegotiator 120 | tcp://localhost/127.0.0.1:61617
after negotiation: OpenWireFormat{version=2, cacheEnabled=true,
stackTraceEnabled=true, tightEncodingEnabled=true,
sizePrefixDisabled=false}
18:09:19,171 | DEBUG | pool-flow.seda.servicemix-jms-thread-1 |
JmsTemplate | framework.jms.core.JmsTemplate 426 |
Executing callback on JMS Session [ActiveMQSession
{id=ID:defender-2452-1219158515937-3:52:1,started=false}]
18:09:19,171 | DEBUG | pool-flow.seda.servicemix-jms-thread-1 |
JmsTemplate | framework.jms.core.JmsTemplate 509 |
Sending created message [ActiveMQTextMessage {commandId = 0,
responseRequired = false, messageId = null, originalDestination =
null, originalTransactionId = null, producerId = null, destination =
null, transactionId = null, expiration = 0, timestamp = 0, arrival =
0, correlationId = null, replyTo = null, persistent = false, type =
null, priority = 0, groupID = null, groupSequence = 0,
targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null,
redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties
= false, readOnlyBody = false, droppable = false, text = null}]
18:09:19,171 | DEBUG | pool-flow.seda.servicemix-jms-thread-1 |
ActiveMQSession | pache.activemq.ActiveMQSession 1545 |
Sending message: ActiveMQTextMessage {commandId = 0, responseRequired
= false, messageId = ID:defender-2452-1219158515937-3:52:1:1:1,
originalDestination = null, originalTransactionId = null, producerId =
ID:defender-2452-1219158515937-3:52:1:1, destination =
queue://queue/A, transactionId = null, expiration = 0, timestamp =
1219158559171, arrival = 0, correlationId = null, replyTo = null,
persistent = true, type = null, priority = 4, groupID = null,
groupSequence = 0, targetConsumerId = null, compressed = false, userID
= null, content = null, marshalledProperties = null, dataStructure =
null, redeliveryCounter = 0, size = 0, properties = null,
readOnlyProperties = true, readOnlyBody = true, droppable = false,
text = null}
18:09:19,171 | DEBUG | pool-flow.seda.servicemix-jms-thread-1 |
DeliveryChannelImpl | .messaging.DeliveryChannelImpl 425 | Send
ID:10.12.34.82-11bdb82a40a-5:0 in DeliveryChannel{servicemix-jms}
18:09:19,171 | DEBUG | DefaultMessageListenerContainer-1 |
ActiveMQMessageConsumer | tivemq.ActiveMQMessageConsumer 397 |
Received message: MessageDispatch {commandId = 0, responseRequired =
false, consumerId = ID:defender-2452-1219158515937-3:51:1:1,
destination = queue://queue/A, message = ActiveMQTextMessage
{commandId = 5, responseRequired = true, messageId =
ID:defender-2452-1219158515937-3:52:1:1:1, originalDestination = null,
originalTransactionId = null, producerId =
ID:defender-2452-1219158515937-3:52:1:1, destination =
queue://queue/A, transactionId = null, expiration = 0, timestamp =
1219158559171, arrival = 0, correlationId = null, replyTo = null,
persistent = true, type = null, priority = 4, groupID = null,
groupSequence = 0, targetConsumerId = null, compressed = false, userID
= null, content = null, marshalledProperties = null, dataStructure =
null, redeliveryCounter = 0, size = 0, properties = null,
readOnlyProperties = true, readOnlyBody = true, droppable = false,
text = null}, redeliveryCounter = 0}
18:09:19,171 | DEBUG | pool-flow.seda.servicemix-jms-thread-1 |
SecuredBroker | mix.jbi.security.SecuredBroker 66 | send
exchange with secure broker
18:09:19,171 | DEBUG | DefaultMessageListenerContainer-1 |
MessageListenerContainer | ollingMessageListenerContainer 303 |
Received message of type [class
org.apache.activemq.command.ActiveMQTextMessage] from consumer
[ActiveMQMessageConsumer {
value=ID:defender-2452-1219158515937-3:51:1:1, started=true }] of
session [ActiveMQSession
{id=ID:defender-2452-1219158515937-3:51:1,started=true}]
18:09:19,171 | DEBUG | pool-flow.seda.servicemix-jms-thread-1 |
SedaFlow | emix.jbi.nmr.flow.AbstractFlow 118 |
Called Flow send
18:09:19,171 | DEBUG | DefaultMessageListenerContainer-1 |
MessageListenerContainer | stractMessageListenerContainer 482 |
Invoking listener with message of type [class
org.apache.activemq.command.ActiveMQTextMessage] and session
[ActiveMQSession {id=ID:defender-2452-1219158515937-3:51:1,started=true}]
18:09:19,171 | DEBUG | pool-flow.seda.servicemix-jms-thread-2 |
SedaQueue | .jbi.nmr.flow.seda.SedaQueue$1 132 |
[EMAIL PROTECTED] dequeued
exchange: InOnly[
id: ID:10.12.34.82-11bdb82a40a-5:0
status: Done
role: consumer
endpoint: endpoint1
in: null
]
18:09:19,187 | DEBUG | pool-flow.seda.servicemix-jms-thread-2 |
DeliveryChannelImpl | .messaging.DeliveryChannelImpl 710 |
Notifying exchange ID:10.12.34.82-11bdb82a40a-5:0(1760aec) in
DeliveryChannel{servicemix-cxf-se} from processInboundSynchronousExchange
18:09:19,187 | DEBUG | pool-flow.seda.servicemix-cxf-se-thread-1 |
DeliveryChannelImpl | .messaging.DeliveryChannelImpl 704 |
Notified: ID:10.12.34.82-11bdb82a40a-5:0(1760aec) in
DeliveryChannel{servicemix-cxf-se} from sendSync
18:09:19,187 | WARN | DefaultMessageListenerContainer-1 |
MessageListenerContainer | stractMessageListenerContainer 613 |
Execution of JMS message listener failed
javax.jms.JMSException: Error sending JBI exchange
at
org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:492)
at
org.apache.servicemix.jms.endpoints.JmsConsumerEndpoint$1.onMessage(JmsConsumerEndpoint.java:372)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:485)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:442)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:414)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:309)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:254)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:871)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:811)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException: text can not be null
at
org.apache.servicemix.jbi.jaxp.StringSource.<init>(StringSource.java:42)
at
org.apache.servicemix.jms.endpoints.DefaultConsumerMarshaler.populateMessage(DefaultConsumerMarshaler.java:94)
at
org.apache.servicemix.jms.endpoints.DefaultConsumerMarshaler.createExchange(DefaultConsumerMarshaler.java:72)
at
org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:460)
... 9 more