I'm trying to use MuleSoft's decryption on HTTP requests. I'm doing this also on GET requests.
I get the following error:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ERROR 2015-05-17 13:00:35,630
[[broker1-secure].HTTP_Listener_Configuration.worker.01]
org.mule.exception.DefaultMessagingExceptionStrategy:
******************************************************************************** Message : Failed to invoke decrypt. Message payload is
of type: NullPayload Code : MULE_ERROR-29999
-------------------------------------------------------------------------------- Exception stack is:
1. Could not decrypt the input. The input has to be a byte array,Input Stream or String (java.lang.RuntimeException)
org.mule.modules.security.encryption.encrypters.JCEEncrypterModule:59
(null)
2. Failed to invoke decrypt. Message payload is of type: NullPayload (org.mule.api.MessagingException)
org.mule.devkit.processor.DevkitBasedMessageProcessor:128
(http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
-------------------------------------------------------------------------------- Root Exception stack trace: java.lang.RuntimeException: Could not
decrypt the input. The input has to be a byte array,Input Stream or
String at
org.mule.modules.security.encryption.encrypters.JCEEncrypterModule.decrypt(JCEEncrypterModule.java:59)
at
org.mule.modules.security.encryption.EncryptionModule.decrypt(EncryptionModule.java:213)
at
org.mule.modules.security.encryption.processors.DecryptMessageProcessor$1.process(DecryptMessageProcessor.java:165)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
Shouldn't it be possible? Try to decrypt payload, and if nothing to decrypt then continue?
It would be better to only decrypt if the payload is not null: it's better to avoid raising exceptions if you can.
For this, you can use a choice router to decrypt only if the payload is not null.
Related
I am getting below dataweave exception while executing a mule flow :
"
INFO 2016-11-06 09:02:42,097 [[abc].HTTP_Listener_Configuration.worker.01] com.mulesoft.weave.mule.utils.MuleWeaveFactory$: MimeType was not resolved '*/*' delegating to Java.
ERROR 2016-11-06 09:02:42,290 [[abc].HTTP_Listener_Configuration.worker.01] org.mule.exception.CatchMessagingExceptionStrategy:
Message : Exception while executing:
"Response": {
^
Unexpected character '\u000a' at index 25 (line 2, position 24), expected '"'
Payload : test
Payload Type : java.lang.String
Element : /Process11/processors/9/1/9 # abc:def.xml:331 (TM_F1)
Element XML : <dw:transform-message doc:name="TM_F1">
<dw:set-payload>%dw 1.0%output application/json---{Data: [{// in_id : flowVars.instanceId,pd: '{AmIds:[{AmId:' ++ flowVars.AmId ++ '}]}'}]}</dw:set-payload>
</dw:transform-message>
Root Exception stack trace:
com.mulesoft.weave.reader.json.JsonReaderException: Unexpected character '\u000a' at index 25 (line 2, position 24), expected '"'
at com.mulesoft.weave.reader.json.JsonTokenizer.fail(JsonTokenizer.scala:193)
at com.mulesoft.weave.reader.json.JsonTokenizer.require(JsonTokenizer.scala:190)
at com.mulesoft.weave.reader.json.JsonTokenizer.readString(JsonTokenizer.scala:80)
"
Is there any possibility to enable more debug options to get more information about this particular exception so that it will be easy to find out the root cause.
The problem here is, even though i am not using the payload in transform message i am getting error because of the payload returned by the previous http call in muleflow.
Mule version is : studio 6.1 and runtime 3.8.
Please help me to solve this issue.
Thanks
sdg
This is not dataweave question. Exception what you have is from JsonReaderException:
com.mulesoft.weave.reader.json.JsonReaderException: Unexpected character '\u000a' at index 25 (line 2, position 24), expected '"'
It means that JSON what you provide has new line (\u000a) ate line 2 position 24. I imagine it is something like this:
"Response": {
"Message" : "67890123
456 the end"
}
Use special characters to represent new line in JSON.
"Response": {
"Message" : "67890123\n456 the end"
}
Enable info logs in log4j and enable debug logs at cloudhub if its an on cloud deployment.
Please Try validating the json as well
Debug is the best option to figure out these kind of errors. Also you may use the logger feature of dataweave to log specific values on console and see whats wrong with the value.
async scope is not working in Clustering in mule 3.4.2. we are getting below exception.
Message : Interrupted while queueing event for "SEDA Stage Main_Flow.async1". Message payload is of type: ConfirmReceiveMessageResponse
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. com.sample.client.ReceiveMessageResponse (java.io.NotSerializableException)
java.io.ObjectOutputStream:1183 (null)
2. java.io.NotSerializableException: com.elexon.bmrs.ecp.client.ReceiveMessageResponse (org.apache.commons.lang.SerializationException)
org.apache.commons.lang.SerializationUtils:111 (null)
3. Interrupted while queueing event for "SEDA Stage Main_Flow.async1". Message payload is of type: ConfirmReceiveMessageResponse (org.mule.api.service.FailedToQueueEventException)
org.mule.processor.SedaStageInterceptingMessageProcessor:92 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/service/FailedToQueueEventException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.io.NotSerializableException: com.sample.client.ReceiveMessageResponse
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
at org.apache.commons.collections.map.AbstractHashedMap.doWriteObject(AbstractHashedMap.java:1182)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
After removing the async scope we are able to test the application. Could please help us how to make the application works with async in cluster env?
If the flow ref is using an async processing strategy it will try and persist the event in a cluster I believe. And your object is not Serializable.
You can make com.sample.client.ReceiveMessageResponse implement java.io.Serializable if you want the message to be persisted.
Or you can try forcing the flow that you are flow-ref'ing processingStrategy="synchronous" maybe.
I get this error randomly in the expression. Not able to find the root cause.
Here payload.SupplierId is always null. I'm setting it with a flowvariable field value.
Exception stack is:
1. object is not an instance of declaring class (java.lang.IllegalArgumentException)
sun.reflect.NativeMethodAccessorImpl:-2 (null)
2. unable to bind property (java.lang.RuntimeException)
org.mvel2.optimizers.impl.refl.nodes.SetterAccessor:43 (null)
3. Execution of the expression "payload.SupplierId = flowVars.SupplierRequestData.SupplierId" failed. (org.mule.api.expression.ExpressionRuntimeException)
org.mule.el.mvel.MVELExpressionLanguage:213 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
4. Execution of the expression "payload.SupplierId = flowVars.SupplierRequestData.SupplierId" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: SupplierResponse (org.mule.api.MessagingException)
org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:35 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
In my <catch-exception-strategy>, I write error payload to file. But sometimes when flow involves web-service calls and host is unavailable or unknown (for e.g. java.net.UnknownHostException is thrown), payload is not anymore an instance of InputStream or String. If I try to log error then to file, following exception is thrown:
exception.AbstractExceptionListener (AbstractExceptionListener.java:299) -
********************************************************************************
Message : Could not find a transformer to transform "SimpleDataType{type=org.apache.commons.httpclient.methods.PostMethod, mimeType='*/*'}" to "SimpleDataType{type=java.io.InputStream, mimeType='*/*'}".
Code : MULE_ERROR-65237
--------------------------------------------------------------------------------
Exception stack is:
1. Could not find a transformer to transform "SimpleDataType{type=org.apache.commons.httpclient.methods.PostMethod, mimeType='*/*'}" to "SimpleDataType{type=java.io.InputStream, mimeType='*/*'}". (org.mule.api.transformer.TransformerException)
org.mule.registry.MuleRegistryHelper:252 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.api.transformer.TransformerException: Could not find a transformer to transform "SimpleDataType{type=org.apache.commons.httpclient.methods.PostMethod, mimeType='*/*'}" to "SimpleDataType{type=java.io.InputStream, mimeType='*/*'}".
at org.mule.registry.MuleRegistryHelper.lookupTransformer(MuleRegistryHelper.java:252)
at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:355)
at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:313)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
I am thinking of doing a choice block before writing to file to make sure payload is writable. Shall I do something like #[payload instanceof java.io.InputStream]? But then how about cases where payload is DOM or something else? Please advise.
I would use a transformer inside the catch exception strategy and encapsulate there the logic that would consider the input and produce a writable payload.
If you want to check whether there is a transformer available for a specific payload type and output type, I guess you could look up the available transformers from the registry. In Groovy:
transformers = message.getMuleContext().getRegistry().lookupTransformers(
new org.mule.transformer.types.SimpleDataType(payload.getClass()),
new org.mule.transformer.types.SimpleDataType(java.io.InputStream))
if (transformers.size() == 0) {
//set some variable or whatever
}
I would just know where I'm wrong with this route.
I'm trying to return a messsage via a web socket route, but I'm unable to set camel connection key:
from("jms:queue:subscriptionValidationError").log("Receiving error message: ${body} ${in.headers.websocket.connectionKey}")
.setHeader(WebsocketConstants.CONNECTION_KEY, simple("${in.headers.websocket.connectionKey}"))
.log("Sending error message: ${body} ${out.headers.websocket.connectionKey}")
.to("websocket://0.0.0.0:9292/subscribeErrors?staticResources=classpath:webapp");
This gives me a log without the connection key on the second log operation:
Receiving error message: doit suivre "[-a-zA-Z0-9]+\#[-a-zA-Z0-9]+\.[a-zA-Z]+" 60f7cc44-9d9b-4bde-905a-d7d51be7661a
Sending error message: doit suivre "[-a-zA-Z0-9]+\#[-a-zA-Z0-9]+\.[a-zA-Z]+"
Can you please tell me where I'm wrong?
Thanks in advance
your log() references the out.header...but setHeader() is setting the in.header
see http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html