WSO2 ESB not serialize JMS (ActiveMQ) with local transport - wso2

I'm using WSO2 ESB 4.6.0, and I've tried to use local transport with this
example.
I have no problem with Send mediator if it uses HTTP.
With 'local transport' everything works well, except using JMS between proxies, then the exception below is triggered.
Unexpected error during sending message out
{org.apache.synapse.core.axis2.Axis2Sender}
java.lang.NullPointerException
at org.wso2.carbon.message.store.persistence.jms.util.JMSPersistentMessageHelper.createPersistentMessage(JMSPersistentMessageHelper.java:221)
An example of my test:
Proxy01:
<send>
<endpoint>
<address uri="local://services/Proxy02" format="soap11"/>
</endpoint>
</send>
Proxy02:
<send>
<endpoint>
<address uri="local://services/Proxy03_MessageStore" format="soap11"/>
</endpoint>
</send>
Proxy03_MessageStore
<property name="target.endpoint" value="EndPoint"/>
<store messageStore="MessageStore"/>
Message Store
<messageStore xmlns="http://ws.apache.org/ns/synapse"
name="MessageStore" class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
<parameter name="java.naming.provider.url">tcp://IP_SERVER:61616</parameter>
<parameter name="store.jms.ConsumerReceiveTimeOut">0</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
<parameter name="store.jms.destination">queueName</parameter>
Any suggestion?

I did the upgrade to the ESB 4.9.0 version and I solved my problem.

Related

wso2 EI 611 ActiveMQ

Declared Message store in ESB
<?xml version="1.0" encoding="UTF-8"?>
<messageStore class="org.apache.synapse.message.store.impl.jms.JmsStore" name="MySQLStockAdjustment" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="store.jms.destination">MySQLStockAdjustment</parameter>
<parameter name="store.failover.message.store.name">MySQLStockAdjustmentFailover</parameter>
<parameter name="store.jms.connection.factory">myQueueConnectionFactory</parameter>
<parameter name="store.producer.guaranteed.delivery.enable">true</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
</messageStore>
and I just want for beginning to store the mesage in it and than use a proxy to read messages form it ..
proxy is simple
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="stockAdjustment" startOnLoad="true" transports="jms" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<!-- get all data -->
<sequence key="AdjustmentContext"/>
<filter regex="MySQL" source="$ctx:StockSource">
<then>
<iterate expression="//request">
<target>
<sequence>
<property expression="//qty" name="qty" scope="default" type="STRING"/>
<property expression="//code" name="code" scope="default" type="STRING"/>
<log level="custom">
<property expression="fn:concat('parmams:Code: ' ,$ctx:code, ' ;Qty: ',$ctx:qty)" name="info"/>
</log>
<call blocking="true">
<endpoint key="StockAdjustmentEp"/>
</call>
</sequence>
</target>
</iterate>
</then>
<else/>
</filter>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence>
</faultSequence>
</target>
<parameter name="transport.jms.Destination">MySQLStockAdjustment</parameter>
<parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory</parameter>
</proxy>
so when I send a data message trough Postman Im getting the following:
WARN {org.apache.axis2.transport.jms.JMSUtils} - Can't determine size of JMS message; unsupported message type : org.apache.activemq.command.ActiveMQObjectMessage {org.apache.axis2.transport.jms.JMSUtils}
ERROR {org.apache.axis2.transport.base.BaseUtils} - Unsupported JMS message type org.apache.activemq.command.ActiveMQObjectMessage {org.apache.axis2.transport.base.BaseUtils}
ERROR {org.apache.axis2.transport.jms.JMSMessageReceiver} - Unknown error processing message {org.apache.axis2.transport.jms.JMSMessageReceiver}
message is
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<StockAdjRequest>
<source>MySQL</source>
<request><qty>2</qty><code>PR2</code></request>
<request><qty>2</qty><code>PR2</code></request>
<request><qty>2</qty><code>PR2</code></request>
</StockAdjRequest>
</soapenv:Body>
</soapenv:Envelope>
I see that message ended in queue but I can't read it trough ActiveMQ web console ...
I documentation I found that maybe a proble that I need to "...If you are using ActiveMQ 5.12.2 and above when working with message stores, you need to set the following system property on server start up for the JMS message store of the ESB Profile to work as expected.
-Dorg.apache.activemq.SERIALIZABLE_PACKAGES="*" ...."
BUt I dont found HOW to do it ... can anyone help me ?
When you store a message in a JMS queue defining a messageStore and using store mediator, you don't just store the "textual" payload from the message, but the entire java MessageContext object is serialized and store as a binary message in the queue.
To read such a message, you need to use a message processor, you can't read it with a simple JMS proxy or even jms inbound endpoint.
And you can't read it with ActiveMQ console because it can't deserialize it

WSO2 ESB endpoint jms uri syntax-format in proxy service

In my proxy service, am trying to create endpoint with JMS-ActiveMQ and it fails in the uri. Is my JMS Endpoint uri correct? am using ActiveMQ with EI611 on tooling380.
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="CSVProcessor" startOnLoad="true" transports="vfs" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log level="full"/>
<smooks config-key="smooks-config" description="GetSmooks">
<input type="text"/>
<output type="xml"/>
</smooks>
<log description="GetData" level="full"/>
<datamapper config="gov:datamapper/NewConfig.dmc" description="MapPriceData" inputSchema="gov:datamapper/NewConfig_inputSchema.json" inputType="XML" outputSchema="gov:datamapper/NewConfig_outputSchema.json" outputType="XML"/>
<log description="LogDataMapper" level="full"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<send>
<endpoint>
<address uri="jms:/foo.bar?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue"/>
</endpoint>
</send>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="transport.vfs.FileURI">file://c:\test-data\in</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file://c:\test-data\original</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.csv</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file://c:\test-data\out</parameter>
</proxy>
Error :
[2017-10-19 17:20:30,944] [] ERROR - ClientUtils The system cannot infer the transport information from the jms:/foo.bar?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue URL.
[2017-10-19 17:20:30,948] [] ERROR - Axis2Sender Unexpected error during sending message out
org.apache.axis2.AxisFault: The system cannot infer the transport information from the jms:/foo.bar?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue URL.
at org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:81)
at org.apache.axis2.client.OperationClient.prepareMessageContext(OperationClient.java:288)
at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:249)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:595)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:83)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:548)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:382)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:65)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:121)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:213)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.axis2.transport.base.AbstractTransportListener.handleIncomingMessage(AbstractTransportListener.java:328)
at org.apache.synapse.transport.vfs.VFSTransportListener.processFile(VFSTransportListener.java:824)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:472)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:188)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:134)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[2017-10-19 17:20:30,958] [] WARN - EndpointContext Endpoint : AnonymousEndpoint with address jms:/foo.bar?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue will be marked SUSPENDED as it failed
Ok, that was my bad.
I did not fully uncomment the below entry in axis2.xml(in C:\wso2ei-6.1.1\conf\axis2), which resulted in this error. I uncommented the leading <!-- but not the trailing -->. Am an idiot, for sure.
<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>
After uncommenting, the data transformed from the source CSV file into a new XML format, was sent to the destination jms queue of ActiveMQ, as desired.

WSO2 ESB MailTransportListener not receiving

I just installed my brand new WSO2 ESB 4.9.0. This is the latest version which I downloaded yesterday.
I am trying to get my ESB to receive e-mail from a server. I have tried POP3 and IMAP. I have been using several references to help me(Since I am a new member, my reputation does not yet allow me to post proper links to all my references):
stackoverflow.com/questions/27376833/wso2-mailto-transport-emptied-my-inbox
javamail.java.net/nonav/docs/api/com/sun/mail/pop3/package-summary.html
javamail.java.net/nonav/docs/api/com/sun/mail/imap/package-summary.html
sparkletechthoughts.blogspot.fr/2013/10/how-to-receive-emails-to-wso2-esb.html
charithaka.blogspot.com/2012/11/how-to-enable-mail-transport-for-wso2.html
irhamiqbal.wordpress.com/how-to-receive-email-using-wso2-esb/
jayalalk.blogspot.com/2014/06/wso2-esb-mail-sending-with-html-complex.html
And of course the official documentation:
https://docs.wso2.com/display/ESB481/MailTo+Transport
https://docs.wso2.com/display/AS501/Using+Mail+transport+to+Invoke+Web+Services
All of my reading leads me to believe that I have everything set up properly (or if not properly, good enough to get some error messages to troubleshoot).
I did restart the WSO2 ESB and the following message shows up in the console log:
TID[-1234] [ESB] [2016-08-02 21:45:37,237] INFO {org.apache.axis2.transport.mail.MailTransportListener} - MAILTO listener started
I get no other indication in the logs one way or another.
I edited (and double checked) my $CARBON_HOME/repository/conf/axis2/axis2.xml, and I'm pretty sure I have the mail transport enabled properly:
<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.MailTransportListener">
<!-- configure any optional POP3/IMAP properties
check com.sun.mail.pop3 and com.sun.mail.imap package documentation for more details-->
</transportReceiver>
<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
<parameter name="mail.smtp.host">my.smtp.server</parameter>
<parameter name="mail.smtp.port">587</parameter>
<parameter name="mail.smtp.starttls.enable">false</parameter>
<parameter name="mail.smtp.auth">true</parameter>
<parameter name="mail.smtp.user">my#user.id</parameter>
<parameter name="mail.smtp.password">password</parameter>
<parameter name="mail.smtp.from">my#email.com</parameter>
</transportSender>
And, finally, I have my Proxy Service setup (in its current iteration, anyway):
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="JasperEmailPOP3"
transports="mailto"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="senderAddress"
expression="get-property('transport', 'From')"
scope="default"
type="STRING"/>
<log level="custom">
<property name="Date" expression="$trp:Date"/>
<property name="Subject" expression="$trp:Subject"/>
<property name="Content-Type" expression="$trp:Content-Type"/>
<property name="From" expression="$trp:From"/>
</log>
<drop/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<parameter name="mail.pop3.socketFactory.class">javax.net.ssl.SSLSocketFactory</parameter>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="mail.pop3.host">my.pop3.email</parameter>
<parameter name="mail.pop3.user">my#email.com</parameter>
<parameter name="transport.mail.Protocol">pop3</parameter>
<parameter name="mail.pop3.socketFactory.port">995</parameter>
<parameter name="transport.mail.Address">jasper#eryjus.com</parameter>
<parameter name="mail.pop3.password">password</parameter>
<parameter name="mail.pop3.port">995</parameter>
<parameter name="mail.pop3.socketFactory.fallback">false</parameter>
<description/>
</proxy>
With all of this, my question is: is there something else I am missing to get the ESB to at least attempt to retrieve e-mail? What bothers me is I am not getting any error messages to troubleshoot (such as my mail not being in plain test).
I tried the same scenario with a Gmail account and it works fine for me, seems like some mis-configuration in your POP server. You need to add following property as well.
<parameter name="transport.mail.ContentType">text/plain</parameter>
See the full proxy configs below.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="JasperEmailPOP3"
transports="mailto"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="senderAddress"
expression="get-property('transport', 'From')"
scope="default"
type="STRING"/>
<log level="custom">
<property name="Date" expression="$trp:Date"/>
<property name="Subject" expression="$trp:Subject"/>
<property name="Content-Type" expression="$trp:Content-Type"/>
<property name="From" expression="$trp:From"/>
</log>
<drop/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<parameter name="mail.pop3.socketFactory.class">javax.net.ssl.SSLSocketFactory</parameter>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="mail.pop3.host">pop.gmail.com</parameter>
<parameter name="mail.pop3.user">ycwso2test</parameter>
<parameter name="transport.mail.Protocol">pop3</parameter>
<parameter name="mail.pop3.socketFactory.port">995</parameter>
<parameter name="transport.mail.Address">ycwso2test#gmail.com</parameter>
<parameter name="mail.pop3.password">wso2qa123</parameter>
<parameter name="mail.pop3.port">995</parameter>
<parameter name="mail.pop3.socketFactory.fallback">false</parameter>
<parameter name="transport.mail.ContentType">text/plain</parameter>
<description/>
</proxy>
Also if you need to further debug this you can enable DEBUG logs. To do this add the following line to repository/conf/log4j.properties and restart.
log4j.logger.org.apache.axis2.transport.mail.MailTransportListener=DEBUG

use vfs in wso2 esb?

I create a proxy service that transform file new text document.txt from ///d:test/orginal
to ///d:test/pass in local
My proxy code is:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="testVFS"
transports="https,http,local"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<outSequence>
<send/>
</outSequence>
<endpoint>
<address uri="https://127.0.0.1:9443/services/SimpleStockQuoteService?wsdl"/>
</endpoint>
</target>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.FileURI">file:///D:/test/Orginal/</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///D:/test/Pass/</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///D:/test/Failures/</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.xml</parameter>
<parameter name="transport.vfs.ContentType">text/xml</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<description/>
</proxy>
But I have an error and not transform files:
<TryitProxyError xmlns:h="http://wso2.org/ns/TryitProxy" h:status="SOAP envelope error">org.apache.axis2.AxisFault: Read timed out</TryitProxyError>
Thanks
In your proxy your transports are set as:
transports="https,http,local"
Changing this to
transports="vfs"
will ensure it tries to use the VFSTransportListener.
Just make sure that the following line is not commented in %ESB_HOME%\repository\conf\axis2\axis2.xml:
<transportReceiver class="org.apache.synapse.transport.vfs.VFSTransportListener" name="vfs"/>
You must use vfs transport. To understand how to use refer http://docs.wso2.org/display/ESB470/VFS+Transport and http://docs.wso2.org/pages/viewpage.action?pageId=26838852
The problem is related to the SoapAction endpoint.
Example using:
<header name="Action" value="urn:mediate"/>
<send>
<endpoint key="SimpleStockQuoteService"/>
</send>

JMS Not working in Wso2Esb 4.7.0

i am working with wso2esb 4.7.0 and ActiveMQ5.8.0 whenever i am working with wso2esb4.6.0 and ActiveMQ5.5.1 its working fine i am publishing my configuration below any one help for this
message store
<messageStore xmlns="http://ws.apache.org/ns/synapse"
class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore"
name="JMSQueue">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
<parameter name="store.jms.destination">JMS_Reading_Queue</parameter>
</messageStore>
message processor
<messageProcessor xmlns="http://ws.apache.org/ns/synapse"
class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor"
name="faisal"
messageStore="JMSQueue">
<parameter name="max.delivery.attempts">4</parameter>
<parameter name="interval">1000</parameter>
</messageProcessor
and proxy is like this
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Jms"
transports="https http jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="messageType" value="application/json" scope="axis2"/>
<log level="full"/>
<store messageStore="JMSQueue"/>
<property name="target.endpoint"
value="JmsEndpoint"
scope="default"
type="STRING"/>
</inSequence>
<outSequence/>
</target>
</proxy>
and i defined my endpoint in endpoints
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="JmsEndpoint">
<address uri="http://192.168.1.122:8282/services/ReadingsMobile"
format="soap11"/>
</endpoint>
now i am getting no target endpoint errors same configuration working in wso2esb4.6.0 mbut not working in wso2esb4.7.0
and its giving errors like this
[2013-08-21 16:48:32,049] WARN - ForwardingHandler Property target.endpoint not found in the message context. Removing the message.
[2013-08-21 16:49:32,093] WARN - SourceHandler Connection time out after request is read: http-incoming-13
Try doing the below modifications in the proxy configuration in order to get rid of the warnings;
a) Replace < target > with < target endpoint="JmsEndpoint" >
b) Move the "store" tag entry after the property where you set the "target.endpoint".
These changes seem to do the trick in my environment. Check if it fixes your issue too.
Hope this helps.
Basically the error you are getting says message processor cannot find the target.endpoint property from the stored message context.
The reason for this is, you are storing the message before setting this property.
You have to set the 'target.endpoint' property before the store mediator in the flow.
Proxy configuration should look likes follows.
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Jms"
transports="https http jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="messageType" value="application/json" scope="axis2"/>
<log level="full"/>
<property name="target.endpoint"
value="JmsEndpoint"
scope="default"
type="STRING"/>
<store messageStore="JMSQueue"/>
</inSequence>
<outSequence/>
</target>
</proxy>