When I try to use call mediator within the sequence with blocking="true" its throwing an error while send mediator is working properly. Can someone please highlight where i am wrong.
I am using WSO2 APIM 2.6.0
Code:
<call blocking="true">
<endpoint>
<http method="get" uri-template="http://10.10.10.10:10/XYZ/rest/1.0/abc/{uri.var.userId}"/>
</endpoint>
</call>
<respond/>
I am getting below error message:
INFO {org.apache.axis2.transport.http.HTTPSender} - Unable to sendViaGet to url[http://10.10.10.10:10/XYZ/rest/1.0/abc/USERX] {org.apache.axis2.transport.http.HTTPSender}
org.apache.axis2.AxisFault: Transport error: 404 Error:
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:371)
at org.apache.axis2.transport.http.HTTPSender.sendViaGet(HTTPSender.java:109)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:63)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:459)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:286)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:441)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:227)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.message.senders.blocking.BlockingMsgSender.sendReceive(BlockingMsgSender.java:490)
at org.apache.synapse.message.senders.blocking.BlockingMsgSender.send(BlockingMsgSender.java:382)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:88)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:85)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:547)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:384)
at org.apache.synapse.endpoints.HTTPEndpoint.send(HTTPEndpoint.java:85)
at org.apache.synapse.mediators.builtin.CallMediator.handleBlockingCall(CallMediator.java:164)
at org.apache.synapse.mediators.builtin.CallMediator.mediate(CallMediator.java:119)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:108)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:70)
at org.apache.synapse.config.xml.AnonymousListMediator.mediate(AnonymousListMediator.java:37)
at org.apache.synapse.config.xml.SwitchCase.mediate(SwitchCase.java:69)
at org.apache.synapse.mediators.filters.SwitchMediator.mediate(SwitchMediator.java:134)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:108)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:70)
at org.apache.synapse.mediators.filters.FilterMediator.mediate(FilterMediator.java:169)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:108)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:70)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler.mediate(APIManagerExtensionHandler.java:66)
at org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler.handleRequest(APIManagerExtensionHandler.java:75)
at org.apache.synapse.rest.API.process(API.java:325)
Try adding this before the call mediator.
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
Related
I am consuming messages and then passing them on to a taskexecutor.. My MessageListener will instantiate a SimpleMessageListenerContainer Bean which in turn will instantiate other beans(consumer etc).
When I start the tomcat server and post a message the SimpleMessageListenerContainer bean is getting invoked correctly but when in the same queue I post another message I see RabbitListenerEndpointContainer is getting called. As a result, my other beans are not getting set. I get the message but MDB is not invoked.
When I post a message in a different queue (without restart) it works as expected.
I see no exceptions saying the listener is shutdown etc. Is there a property I am missing?
The only thing I can think of is the first message is not formed correctly resulting into some problem.
My Container Bean
<bean id="springListenerContainerCSWF"
class="org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer">
<property name="connectionFactory" ref="cachingConnectionFactory" />
<property name="queues" ref="rabbitDestinationCSWF" />
<property name="messageListener" ref="rabbitMessageListenerCSWF" />
</bean>
Here is the log snippet for first and second message:
Message 1 Log:
DEBUG org.springframework.amqp.rabbit.listener.BlockingQueueConsumer - Storing delivery for consumerTag: 'amq.ctag-Kidy_yvO5xOLL6_7SyuzBw' with deliveryTag: '1' in Consumer#1617944b: tags=[[amq.ctag-Kidy_yvO5xOLL6_7SyuzBw]], channel=Cached Rabbit Channel: AMQChannel(amqp://poc#10.165.1.11:5672/POC,2), conn: Proxy#58651bd2 Shared Rabbit Connection: SimpleConnection#1576020a [delegate=amqp://poc#10.165.1.11:5672/POC, localPort= 61774], acknowledgeMode=AUTO local queue size=0
18:44:29.704 [springListenerContainerABCD_ORDER-1] DEBUG org.springframework.amqp.rabbit.listener.BlockingQueueConsumer - Received message: (Body:'[B#3ac56714(byte[16757])' MessageProperties [headers={timestamp_in_ms=1570626869268}, timestamp=Wed Oct 09 18:44:29 IST 2019, contentLength=0, receivedDeliveryMode=NON_PERSISTENT, redelivered=false, receivedExchange=, receivedRoutingKey=Q.CSW.ABCD_PRODORDER.XYZ, deliveryTag=1, consumerTag=amq.ctag-Kidy_yvO5xOLL6_7SyuzBw, consumerQueue=Q.CSW.ABCD_PRODORDER.XYZ])
18:44:29.704 [springListenerContainerCSWF_ORDER-1] INFO
com.dell.ctm.queue.rabbitmessaging.RabbitMQListener - Received message for consumer: salesOrderConsumer
1
8:44:29.704 [springListenerContainerABCD_ORDER-1] DEBUG com.dell.ctm.queue.rabbitmessaging.RabbitMQListener - Message :: Some Message
Message 2 Log:
DEBUG org.springframework.amqp.rabbit.listener.BlockingQueueConsumer - Storing delivery for consumerTag: 'amq.ctag-LDAzqxJDNlI-zjXQz0iiiQ' with deliveryTag: '1' in Consumer#568eb60e: tags=[[amq.ctag-LDAzqxJDNlI-zjXQz0iiiQ]], channel=Cached Rabbit Channel: AMQChannel(amqp://poc#10.161.1.11:5672/POC,7), conn: Proxy#58651bd2 Shared Rabbit Connection: SimpleConnection#1576020a [delegate=amqp://poc#10.165.1.11:5672/POC, localPort= 61774], acknowledgeMode=AUTO local queue size=0
18:46:53.954 [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer#0-1] DEBUG org.springframework.amqp.rabbit.listener.BlockingQueueConsumer - Received message: (Body:'[B#21865b3b(byte[16757])' MessageProperties [headers={timestamp_in_ms=1570627013570}, timestamp=Wed Oct 09 18:46:53 IST 2019, contentLength=0, receivedDeliveryMode=NON_PERSISTENT, redelivered=false, receivedExchange=, receivedRoutingKey=Q.CSW.ABCD_PRODORDER.XYZ, deliveryTag=1, consumerTag=amq.ctag-LDAzqxJDNlI-zjXQz0iiiQ, consumerQueue=Q.CSW.ABCD_PRODORDER.XYZ])
18:46:54.018 [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer#0-1] DEBUG org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter - Processing [GenericMessage [payload=byte[16757], headers={amqp_receivedDeliveryMode=NON_PERSISTENT, amqp_receivedRoutingKey=Q.CSW.ABCD_PRODORDER.XYZ, timestamp_in_ms=1570627013570, amqp_deliveryTag=1, amqp_timestamp=Wed Oct 09 18:46:53 IST 2019, amqp_consumerQueue=Q.CSW.ABCD_PRODORDER.XYZ, amqp_redelivered=false, id=f55d83d9-88c0-6105-2d02-95e32ac5e57b, amqp_consumerTag=amq.ctag-LDAzqxJDNlI-zjXQz0iiiQ, timestamp=1570627014018}]]
18:46:54.034 [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer#0-1] INFO com.dell.ctm.queue.rabbitmessaging.RabbitMQListener - Received message for consumer: null
18:46:54.034 [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer#0-1] DEBUG com.dell.ctm.queue.rabbitmessaging.RabbitMQListener - Message :: Some Message
This is my connection factory
<bean id="rabbitListenerContainerFactory"
class="org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory">
<property name="connectionFactory">
<ref bean="cachingConnectionFactory" />
</property>
<property name="concurrentConsumers" value="50" />
<property name="maxConcurrentConsumers" value="100" />
<property name="startConsumerMinInterval" value="3000" />
</bean>
I'm using WSO2 APIManager 1.10.
I'd like to call api request using mediation like this.
<sequence name="loadbalancer_bycompany" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property expression="get-property('transport', 'company')"
name="company" scope="default" type="STRING"/>
<property name="POST_TO_URI" scope="axis2" type="STRING" value="true"/>
<switch source="$trp:company">
<case regex="sds">
<send>
<endpoint>
<address trace="disable" uri="https://70.30.182.167:8243/calc/1.0/"/>
</endpoint>
</send>
</case>
<case regex="etc">
<send>
<endpoint>
<address trace="disable" uri="https://70.30.182.167:9443/calc/1.0/"/>
</endpoint>
</send>
</case>
<default>
<send>
<endpoint>
<address trace="disable" uri="https://70.30.182.167:9443/carbon/"/>
</endpoint>
</send>
</default>
</switch>
</sequence>
So,I tried to set mediator and then i called api.
But, I got sometimes error response that is code 900902 missing credential,
sometimes got right response.
At that time, I found logs like this.
TID: [-1234] [] [2017-02-03 10:45:10,728] INFO {org.apache.synapse.mediators.builtin.LogMediator} - STATUS = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> Unexpected error sending message back {org.apache.synapse.mediators.builtin.LogMediator}
TID: [-1234] [] [2017-02-03 10:45:10,735] ERROR {org.apache.synapse.transport.passthru.PassThroughHttpSSLSender} - Failed to submit the response {org.apache.synapse.transport.passthru.PassThroughHttpSSLSender}
java.lang.NullPointerException
at org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:64)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:462)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:267)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:493)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:108)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:155)
at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:86)
at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102)
at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:108)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:534)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:172)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:251)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
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)
TID: [-1234] [] [2017-02-03 10:45:10,738] ERROR {org.apache.synapse.core.axis2.Axis2Sender} - Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><am:fault xmlns:am="http://wso2.org/apimanager"><am:code>0</am:code><am:type>Status report</am:type><am:message>Runtime Error</am:message><am:description>Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> Unexpected error sending message back</am:description></am:fault></soapenv:Body></soapenv:Envelope> Unexpected error sending message back {org.apache.synapse.core.axis2.Axis2Sender}
org.apache.axis2.AxisFault: Failed to submit the response
at org.apache.synapse.transport.passthru.PassThroughHttpSender.handleException(PassThroughHttpSender.java:610)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:269)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:493)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:108)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:155)
at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:86)
at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102)
at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:108)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:534)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:172)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:251)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
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: java.lang.NullPointerException
at org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:64)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:462)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:267)
... 18 more
TID: [-1234] [] [2017-02-03 10:45:10,740] ERROR {org.apache.axis2.transport.base.threads.NativeWorkerPool} - Uncaught exception {org.apache.axis2.transport.base.threads.NativeWorkerPool}
java.lang.RuntimeException: org.apache.synapse.SynapseException: Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><am:fault xmlns:am="http://wso2.org/apimanager"><am:code>0</am:code><am:type>Status report</am:type><am:message>Runtime Error</am:message><am:description>Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> Unexpected error sending message back</am:description></am:fault></soapenv:Body></soapenv:Envelope> Unexpected error sending message back
at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:110)
at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:108)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:534)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:172)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:251)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
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.synapse.SynapseException: Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><am:fault xmlns:am="http://wso2.org/apimanager"><am:code>0</am:code><am:type>Status report</am:type><am:message>Runtime Error</am:message><am:description>Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> Unexpected error sending message back</am:description></am:fault></soapenv:Body></soapenv:Envelope> Unexpected error sending message back
at org.apache.synapse.core.axis2.Axis2Sender.handleException(Axis2Sender.java:247)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:215)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:493)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:108)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:155)
at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:86)
at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102)
... 9 more
Caused by: org.apache.axis2.AxisFault: Failed to submit the response
at org.apache.synapse.transport.passthru.PassThroughHttpSender.handleException(PassThroughHttpSender.java:610)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:269)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212)
... 16 more
Caused by: java.lang.NullPointerException
at org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:64)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:462)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:267)
... 18 more
TID: [-1234] [] [2017-02-03 10:45:59,370] INFO {org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageHandler} - Stat is not enabled {org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageHandler}
TID: [-1234] [] [2017-02-03 10:45:59,374] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /calc/1.0/subtract?x=3&y=1, MessageID: urn:uuid:8f4000dc-b878-4d5f-b310-f0129f2db0a3, Direction: request, INFO = https://70.30.182.167:8243/calc/1.0/, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [-1234] [] [2017-02-03 10:45:59,390] INFO {org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler} - Stat is not enabled {org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler}
TID: [-1234] [] [2017-02-03 10:45:59,395] WARN {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler} - API authentication failure due to Missing Credentials {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler}
I found this logs repeatedly, so I i made an effort to fix it.
First of all, to remove this error,
NullPointerException
SourceResponseFactory.create(SourceResponseFactory.java:64)
I figured out code issue in PassThroughHttpSender.java that didn't handle with null case for sourceRequest. And then I found that issue was fixed
wso2-synapse
ESBJAVA-3770 Message size based filtering to prevent OOM. (#679)
https://github.com/wso2/wso2-synapse/commit/1aff92c4bad968f78cf38577cbb7c01516475217
So, I added that code into our codes.
And then NullPointException was disappeared.
And then I tried to remove missing credential error.
So I found this link.
Authorization Bearer in URL Request using WSO2 API Manager
And I tried to set configure like below link.
https://docs.wso2.com/display/AM1100/Writing+Custom+Handlers
And then Missing credential error was removed.
And then result is right response.
But I found below log infinitely
TID: [-1234] [] [2017-02-08 13:20:12,563] WARN {org.wso2.carbon.apimgt.gateway.handlers.throttling.APIThrottleHandler} - No authentication context information found on the request - Throttling not applied {org.wso2.carbon.apimgt.gateway.handlers.throttling.APIThrottleHandler}
I tried to debug SourceHandler and TargetHandler.
and I think connection was created infinitely and wasn't closed all.
I don't know what to do anymore.
So please let me know what I have to do.
Please go through the sample implementation provided in docs. Based on the APIThrottleHandler implementation, this warning message would appear if you haven't set the user context within your custom Auth handler. Please check how the default "OAuthAuthenticator" has been written and how the AuthenticationContext getting initialized. You need to do a similar implementation to your custom handler if need to work with throttling.
I'm pretty New to Java and Mulesoft, I have been working on one POC. It's nothing but capturing the Database Change Notification in Mule, where DB polling cannot be implemented due to performance issues & Datamapper cannot be used. Can anyone suggest me the right approach on this. Below is my sample code on which I have been working.
<db:oracle-config name="Oracle_Configuration" host="localhost" port="1521" instance="xe" user="HR" password="hr" doc:name="Oracle Configuration1"/>
<file:connector name="OutPutFile" autoDelete="false" streaming="true" validateConnections="true" doc:name="File" outputAppend="true" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].txt" dynamicNotification="true" writeToDirectory="C:\Users\IBM_ADMIN\MulesoftExamples"/>
<db:oracle-config name="Oracle_Configuration1" url="jdbc:thin.oracle://localhost:1521/HR" doc:name="Oracle Configuration1" transactionIsolation="READ_COMMITTED"/>
<http:request-config name="HTTP_Request_Configuration" host="localhost" port="1521" basePath="alertcapture" doc:name="HTTP Request Configuration"/>
<file:endpoint path="C:\Users\IBM_ADMIN\MulesoftExamples" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].txt" connector-ref="File" name="File" responseTimeout="10000" encoding="UTF-8" doc:name="File"/>
<flow name="alertcaptureFlow">
<poll doc:name="Poll">
<db:select config-ref="Oracle_Configuration" doc:name="ChangeNotify" target="#[flowVars.selectResult]" >
<db:parameterized-query><![CDATA[SELECT * FROM nfevents;]]></db:parameterized-query>
</db:select>
</poll>
<http:request config-ref="HTTP_Request_Configuration" path="/alertcapture/src/main/app" method="GET" doc:name="FetchData"/>
<file:outbound-endpoint path="/alertcapture/src/main/app" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].txt" connector-ref="OutPutFile" responseTimeout="10000" doc:name="Alertcapture" encoding="UTF-8" mimeType="text/xml" ref="File"/>
</flow>
>
I have a Mule flow that is converting an inbound file into some XML and I wish to post this to an HTTP outbound endpoint but my flow fails when I attempt to do so. My flow looks as follows:
<flow name="mainFlow" processingStrategy="synchronous">
<file:inbound-endpoint name="fileIn" path="path/to/file"/>
<file:file-to-string-transformer />
<component class="CUSTOM JAVA CLASS TO CONVERT CSV INPUT TO BASIC XML"/>
<mulexml:xml-to-dom-transformer returnClass="org.w3c.dom.Document"/>
<!-- XSLT converts my Java-produced XML to a more complex structure for output -->
<mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="path/to/xsl"/>
<object-to-string-transformer doc:name="Object to String"/>
<!-- AT THIS POINT, THE PAYLOAD IS A STRING OF XML (payload=java.lang.String) -->
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="hello" contentType="text/xml" method="POST" doc:name="HTTP"/>
</flow>
The errors I'm getting are as follows:
ERROR 2014-05-08 10:39:41,449 [[processes].consignmentInputFileConnector.receiver.02] org.mule.exception.CatchMessagingExceptionStrategy:
********************************************************************************
Message : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=http://localhost:8081/hello, connector=HttpConnector
{
name=connector.http.mule.default
lifecycle=start
this=45f8d5e5
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[http]
serviceOverrides=<none>
}
, name='endpoint.http.localhost.8081.hello', mep=REQUEST_RESPONSE, properties={http.method=POST, Content-Type=text/xml}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: PostMethod
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Connection refused (java.net.ConnectException)
java.net.PlainSocketImpl:-2 (null)
2. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=http://localhost:8081/hello, connector=HttpConnector
{
name=connector.http.mule.default
lifecycle=start
this=45f8d5e5
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[http]
serviceOverrides=<none>
}
, name='endpoint.http.localhost.8081.hello', mep=REQUEST_RESPONSE, properties={http.method=POST, Content-Type=text/xml}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: PostMethod (org.mule.api.transport.DispatchException)
org.mule.transport.http.HttpClientMessageDispatcher:155 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
The end goal of what I'm trying to achieve here is to evaluate the response code received from the HTTP endpoint and then proceed accordingly. However, I've so far been unable to get as far as posting successfully.
Are you sure something is listening on http://localhost:8081/hello? The java.net.ConnectException tends to say the opposite.
I have a proxy that calls another local proxy in WSO2 ESB 4.6.0.
Basically, the definition is:
<proxy name="Proxy1" >
<target>
<inSequence>
<xslt/>
<header name="Action" value="issueActivity" />
<send>
<endpoint>
<address uri="http://localhost:8280/services/Proxy2" format="soap11"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<filter xpath="not(get-property('FAULT'))">
<xslt/>
</filter>
<send />
</outSequence>
</target>
</proxy>
<proxy name="Proxy2">
<target>
<inSequence>
<xslt />
<property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
<send>
<endpoint key="Inbound" />
</send>
</inSequence>
<outSequence>
<filter xpath="get-property('FAULT')">
<then>
<sequence key="DefaultErrorSequence" />
<header name="To" action="remove" />
</then>
<else>
<property name="Content-Encoding" scope="transport" action="remove"/>
<xslt/>
</else>
</filter>
<send />
</outSequence>
</target>
</proxy>
In almost all calls, the flows works perfectly but, periodically, this error appears in the log when Proxy1 try to call Proxy2:
TID: [0] [ESB] TID: [0] [ESB] [2014-05-08 12:03:35,431] WARN {org.apache.synapse.transport.passthru.TargetHandler} - Receiving response while the handler is in an inconsistent state REQUEST_HEAD
TID: [0] [ESB] TID: [0] [ESB] [2014-05-08 12:03:35,432] ERROR {org.apache.synapse.transport.passthru.util.RelayUtils} - Error while building Passthrough stream
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
[...]
At the end of the error in the log:
TID: [0] [ESB] TID: [0] [ESB] [2014-05-08 12:04:35,435] WARN {org.apache.synapse.transport.passthru.TargetHandler} - Connection time out while in state: REQUEST_DONE
TID: [0] [ESB] TID: [0] [ESB] [2014-05-08 12:04:35,436] WARN {org.apache.synapse.FaultHandler} - ERROR_CODE : 101507
TID: [0] [ESB] TID: [0] [ESB] [2014-05-08 12:04:35,436] WARN {org.apache.synapse.FaultHandler} - ERROR_MESSAGE : Error in Sender
TID: [0] [ESB] TID: [0] [ESB] [2014-05-08 12:04:35,437] WARN {org.apache.synapse.FaultHandler} - ERROR_DETAIL : Error in Sender
TID: [0] [ESB] TID: [0] [ESB] [2014-05-08 12:04:35,437] WARN {org.apache.synapse.FaultHandler} - ERROR_EXCEPTION : null
According the WSO2 documentation, the error 101507 means Connection canceled.
The question is what the cause of this error? It's a problem with client or server?
UPDATE
Aparently, the cause of the error is the same described in this question: WSO2 ESB unknown error code 102511
Have you make Return Request Status checkbox enable at operation section while writing query? This may cause the problem..Try it..
To sum up the all comments so far, I think first achievement was that the problem was solved when instead of Proxy1->Proxy2 architecture, changing the Proxy2 to sequences and call them with Sequence mediator instead of invoking them with send mediator removes the errors previously has been shown.
That worked properly but since we need to have the Proxy1->Proxy2 architecture, I think defining the "outSequence" of Proxy1 as receiving sequence in "inSequence" of Proxy1 and sending it to Proxy2 using Send mediator with Proxy2 endpoint would be the solution.