WSO2 ESB DataMapper mediator - wso2

I'm getting the below error when trying to transform a JSON input to another JSON format using WSO2 ESB DataMapper mediator.
Here, I'm trying to do a very basic level transformation & appreciate if someone could help me to figure out the issue.
[2016-12-22 10:20:15,674] ERROR - ResvsAPI DataMapper mediator : mapping failed
Error while reading input stream. Script engine unable to execute the script javax.script.ScriptException: ReferenceError: "map_S_root_S_root" is not defined in <eval> at line number 1
at org.wso2.carbon.mediator.datamapper.engine.input.readers.JSONInputReader.read(JSONInputReader.java:62)
at org.wso2.carbon.mediator.datamapper.engine.input.InputBuilder.buildInputModel(InputBuilder.java:59)
at org.wso2.carbon.mediator.datamapper.engine.core.mapper.MappingHandler.doMap(MappingHandler.java:67)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.transform(DataMapperMediator.java:306)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.mediate(DataMapperMediator.java:256)
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.rest.Resource.process(Resource.java:343)
at org.apache.synapse.rest.API.process(API.java:399)
at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:123)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:101)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:69)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:304)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:75)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:325)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:371)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

This can be due to an error in the input-output mapping configuration. Can you please provide a screenshot of the mapping UI view and the contents of the mapping configuration file (.dmc file)
*You can find the mapping configuration inside Registry viewer tab in WSO2 ESB Management Console.

Related

WSO2 org.apache.axis2.AxisFault: Transport error: 412 Error: Precondition Failed

I'm using WSO2 ESB and I created a custom proxy service with a WSDL. I defined the InSequence in line as a log mediator defined the endpoint as a Address endpoint and defined the OutSequence as Send mediator when I try the service I got this error:
<TryitProxyError xmlns:h="http://wso2.org/ns/TryitProxy" h:status="SOAP envelope error">org.apache.axis2.AxisFault: Transport error: 412 Error: Precondition Failed</TryitProxyError>
How can I fix this error please? I have no idea. Thanks :)
org.apache.axis2.AxisFault
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at consultardatosmaestros.CU677ConsultarDatosMaestrosServiceMessageReceiverInOut.fromOM(CU677ConsultarDatosMaestrosServiceMessageReceiverInOut.java:599)
at consultardatosmaestros.CU677ConsultarDatosMaestrosServiceMessageReceiverInOut.invokeBusinessLogic(CU677ConsultarDatosMaestrosServiceMessageReceiverInOut.java:44)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:403)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at consultardatosmaestros.CU677ConsultarDatosMaestrosServiceMessageReceiverInOut.fromOM(CU677ConsultarDatosMaestrosServiceMessageReceiverInOut.java:472)

WSO2 APIM GW error message for not able to publish throttle event

Running WSO2 APIM v2.0 as 2 nodes clustered and a WSO2 DAS as separate node.
Every time throttling happens in WSO2 APIM, I am seeing following error message in Gateway error log
2016-11-04 06:23:59,927 [-] [PassThroughMessageProcessor-27] ERROR APIMgtThrottleUsageHandler Cannot publish throttling event. null
java.lang.NullPointerException
at org.wso2.carbon.utils.multitenancy.MultitenantUtils.getTenantDomain(MultitenantUtils.java:90)
at org.wso2.carbon.apimgt.usage.publisher.APIMgtThrottleUsageHandler.mediate(APIMgtThrottleUsageHandler.java:71)
at org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:84)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:95)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:57)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.wso2.carbon.apimgt.gateway.handlers.throttling.ThrottleHandler.handleThrottleOut(ThrottleHandler.java:612)
at org.wso2.carbon.apimgt.gateway.handlers.throttling.ThrottleHandler.doThrottle(ThrottleHandler.java:504)
at org.wso2.carbon.apimgt.gateway.handlers.throttling.ThrottleHandler.handleRequest(ThrottleHandler.java:445)
at org.apache.synapse.rest.API.process(API.java:325)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:90)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:69)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:300)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:75)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:319)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:152)
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)
I also not able to see API Throttled Out Requests report from WSO2 APIM statistics.
Please advice.
This is a known issue when you have Authentication:none for resources. It's reported here, and will be fixed in a future release.

WSO2 does not catching exception from Smooks

I am using WSO2 ESB 4.8.1 and i am using Smooks 1.5 to read a fixed length file and then parse it in raw XML. It is working fine but i have to also implement its exceptional flow.
Problem:
The problem is that if i mess up smooks config file it is throwing an exception but it is not being catched by WSO2. For all the other errors and exception WSO2 initiates the fault sequence where you can get ERROR_MESSAGE, ERROR_DETAIL properties, but in this case it just terminates the flow and the service does not goes into fault sequence. So i can't do anything about it unless service goes into fault sequence.
Sample File:
John Lock
Smooks-config File that i am using to create an exception:
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:fl="http://www.milyn.org/xsd/smooks/fixed-length-1.3.xsd">
<fl:reader fields="FNAME[4],$ignore$[4],LNAME">
</fl:reader>
</smooks-resource-list>
Exception in wso2 log file:
org.milyn.cdr.SmooksConfigurationException: Error invoking #Initialize method 'initialize' on class 'org.milyn.fixedlength.FixedLengthReader'.
at org.milyn.cdr.annotation.Configurator.invoke(Configurator.java:457)
at org.milyn.cdr.annotation.Configurator.initialise(Configurator.java:439)
at org.milyn.cdr.annotation.Configurator.configure(Configurator.java:91)
at org.milyn.cdr.annotation.Configurator.configure(Configurator.java:66)
at org.milyn.delivery.JavaContentHandlerFactory.create(JavaContentHandlerFactory.java:63)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.addCDU(ContentDeliveryConfigBuilder.java:623)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyCDUStrategy(ContentDeliveryConfigBuilder.java:548)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyStrategy(ContentDeliveryConfigBuilder.java:536)
at org.milyn.delivery.ContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.iterate(ContentDeliveryConfigBuilder.java:711)
at org.milyn.delivery.ContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.access$300(ContentDeliveryConfigBuilder.java:690)
at org.milyn.delivery.ContentDeliveryConfigBuilder.extractContentHandlers(ContentDeliveryConfigBuilder.java:484)
at org.milyn.delivery.ContentDeliveryConfigBuilder.load(ContentDeliveryConfigBuilder.java:349)
at org.milyn.delivery.ContentDeliveryConfigBuilder.getConfig(ContentDeliveryConfigBuilder.java:146)
at org.milyn.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:91)
at org.milyn.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:65)
at org.milyn.Smooks.createExecutionContext(Smooks.java:411)
at org.milyn.Smooks.createExecutionContext(Smooks.java:374)
at org.wso2.carbon.mediator.transform.SmooksMediator.mediate(SmooksMediator.java:103)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:196)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
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:597)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:328)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:158)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:107)
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:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1911)
at org.milyn.fixedlength.FixedLengthReader.buildFields(FixedLengthReader.java:455)
at org.milyn.fixedlength.FixedLengthReader.initialize(FixedLengthReader.java:277)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.milyn.cdr.annotation.Configurator.invoke(Configurator.java:453)
Note:
Smooks is giving the correct exception but what i don't understand is that why does not WSO2 esb service goes into fault sequence and just terminated ...? Is it some behavior by smooks..?
I think it is expected behavior of WSO2 ESB. Recently, we were working on project where we used smooks to convert fixed length data to XML in WSO2 ESB using VFS transport. we have faced same kind of issue. After contacting with WSO2 Official support, we found that it is expected behavior of WSO2 ESB. Fault sequence will be only execute, when synapse exception occurs.

BAM mediator not working with WSO2ESB

I have installed the latest version of WSO2 BAM (2.4.1) and WSO2 ESB (4.8.1). The BAM Mediator in the ESB is not working. It keeps throwing the below exception everytime it tries to send a message to BAM.
Can you please help?
[2014-09-15 05:54:58,833] ERROR - AsyncDataPublisher Error occurred while finding | defining the event org.wso2.carbon.databridge.agent.thrift.exception.AgentException: Cannot define type {"streamId":"TestStream:1.0.0","name":"TestsStream","version":"1.0.0","nickName":"TestStream","description":"TestStream","metaData":[{"name":"tenant_id","type":"INT"},{"name":"http_method","type":"STRING"},{"name":"character_set_encoding","type":"STRING"},{"name":"remote_address","type":"STRING"},{"name":"transport_in_url","type":"STRING"},{"name":"message_type","type":"STRING"},{"name":"remote_host","type":"STRING"},{"name":"service_prefix","type":"STRING"},{"name":"host","type":"STRING"}],"correlationData":[{"name":"activity_id","type":"STRING"}],"payloadData":
[{"name":"message_direction","type":"STRING"},{"name":"service_name","type":"STRING"},{"name":"operation_name","type":"STRING"},{"name":"message_id","type":"STRING"},{"name":"timestamp","type":"LONG"}]}
at org.wso2.carbon.databridge.agent.thrift.internal.publisher.client.EventPublisher.defineStream(EventPublisher.java:234)
at org.wso2.carbon.databridge.agent.thrift.DataPublisher.defineStream(DataPublisher.java:295)
at org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher$DataPublishWorker.run(AsyncDataPublisher.java:690)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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)
Caused by: org.wso2.carbon.databridge.agent.thrift.exception.EventPublisherException: TException
at org.wso2.carbon.databridge.agent.thrift.internal.publisher.client.ThriftEventPublisher.defineStream(ThriftEventPublisher.java:120)
at org.wso2.carbon.databridge.agent.thrift.internal.publisher.client.EventPublisher.defineStream(EventPublisher.java:222)
... 7 more
Caused by: org.apache.thrift.transport.TTransportException
at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
at org.apache.thrift.protocol.TBinaryProtocol.readStringBody(TBinaryProtocol.java:354)
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:215)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
at org.wso2.carbon.databridge.commons.thrift.service.general.ThriftEventTransmissionService$Client.recv_defineStream(ThriftEventTransmissionService.java:80)
at org.wso2.carbon.databridge.commons.thrift.service.general.ThriftEventTransmissionService$Client.defineStream(ThriftEventTransmissionService.java:66)
at org.wso2.carbon.databridge.agent.thrift.internal.publisher.client.ThriftEventPublisher.defineStream(ThriftEventPublisher.java:109)
... 8 more
Thank you !
-Sarf.
Can you specify how you created the BAM server profile? If i'm not mistaken you can not specify metadata, correlation data and payload data in the BAM mediator stream.
Please refer https://docs.wso2.com/display/BAM241/Setting+up+BAM+Mediator

wso2 getting org.apache.rampart.RampartException: Unsupported SignedSupportingToken

We are trying to do a poc in wso2 esb to invoke our BE service which is ws-security enabled. We have setup a pass thru proxy in wso2 and configured the endpoint according to www.soasecurity.org. However, we keep getting the below error when trying to use the pass thru proxy. Please advise if we are doing anything wrong...
ERROR - Axis2Sender Unexpected error during sending message out
rg.apache.axis2.AxisFault: Unsupported SignedSupportingToken : "{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}IssuedToken"
at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:76)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:426)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:185)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:167)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:481)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:342)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:329)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:173)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:404)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:184)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
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:724)
Caused by: org.apache.rampart.RampartException: Unsupported SignedSupportingToken : "{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}IssuedToken"
at org.apache.rampart.builder.TransportBindingBuilder.build(TransportBindingBuilder.java:103)
at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:140)
at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
... 20 more
What is the security policy you are using to secure the BE service?
Seems like the ESB cannot understand the security policy that is being used for the BE service.
Follow the blog and you will be able to resolve your concern.
Manisha