WSO2 - ESB Pass through Proxy Post Request Failure - esb

Hi guys can you help me out with my WSO2 - ESB problem.
I am experiencing the following error in our UAT environment but not in my SIT environment. I need a hint on why this is happening so I can change my CAR file or add the proper configuration to our server if needed.
For some reason when the Client doing a Post request I am experiencing a timeout error. Upon checking the logs I see that their is an error that states that the Payload could not be written as JSON. This does not happen in a GET request so I am at a lost. I can also confirm that the request is being sent in the back end using either GET/POST.
Please note that the following servers does not exist so app03/app04 so failure to connect to those server is expected (We only have 2 UAT servers but 4 in our PRD environment).
What I do not understand is why this only happens in Post request and if i need to modify my code or set something in the WSO2-ESB server.
For any clarification or additional information please do not hesitate to ask.
Thanks for your help
Carbon Logs
TID: [-1234] [] [2017-09-22 09:12:03,608] INFO {org.apache.synapse.mediators.builtin.LogMediator} - Request: Target URL = /services/XXXX-ws_PS/payments/validate, Client IP = 172.22.222.156, Request ID = urn:uuid:0df0d876-6093-4479-9537-70bbbdf4d649 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [-1234] [] [2017-09-22 09:12:04,029] INFO {org.apache.synapse.mediators.builtin.LogMediator} - Response: To = /services/XXXX-ws_PS/payments/validate, IP = 172.22.222.156, RequestID = urn:uuid:0df0d876-6093-4479-9537-70bbbdf4d649 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [-1234] [] [2017-09-22 09:12:04,029] ERROR {org.apache.synapse.commons.json.JsonUtil} - #writeAsJson. Payload could not be written as JSON. MessageID: urn:uuid:3b69a0e3-f6b3-4e49-8d14-23d7596c2366 {org.apache.synapse.commons.json.JsonUtil}
TID: [-1234] [] [2017-09-22 09:12:04,029] ERROR {org.apache.synapse.transport.passthru.PassThroughHttpSSLSender} - Failed to submit the response {org.apache.synapse.transport.passthru.PassThroughHttpSSLSender}
org.apache.axis2.AxisFault: Payload could not be written as JSON.
at org.apache.synapse.commons.json.JsonUtil.writeAsJson(JsonUtil.java:263)
at org.apache.synapse.commons.json.JsonStreamFormatter.writeTo(JsonStreamFormatter.java:61)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:555)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:264)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:222)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:531)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:118)
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.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:337)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:261)
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-09-22 09:12:04,042] ERROR {org.apache.synapse.core.axis2.Axis2Sender} - <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><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:613)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:266)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:222)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:531)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:118)
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.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:337)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:261)
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.axis2.AxisFault: Payload could not be written as JSON.
at org.apache.synapse.commons.json.JsonUtil.writeAsJson(JsonUtil.java:263)
at org.apache.synapse.commons.json.JsonStreamFormatter.writeTo(JsonStreamFormatter.java:61)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:555)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:264)
... 16 more
TID: [-1234] [] [2017-09-22 09:12:04,047] ERROR {org.apache.synapse.mediators.builtin.LogMediator} - Error: To = /services/XXXX-ws_PS/payments/validate, IP = 172.22.222.156, RequestID = urn:uuid:0df0d876-6093-4479-9537-70bbbdf4d649 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [-1234] [] [2017-09-22 09:12:20,541] INFO {org.apache.synapse.mediators.builtin.LogMediator} - Request: Target URL = /services/XXXX-ws_PS/institutions/details/00239, Client IP = 172.22.222.156, Request ID = urn:uuid:e5aca458-03a6-41b3-81b5-d409c5eaa66a {org.apache.synapse.mediators.builtin.LogMediator}
TID: [-1] [] [2017-09-22 09:12:20,542] WARN {org.apache.synapse.transport.passthru.ConnectCallback} - Connection refused or failed for : app03.XXXX.uat.XXX.com.ph:50209 {org.apache.synapse.transport.passthru.ConnectCallback}
TID: [-1234] [] [2017-09-22 09:12:20,542] WARN {org.apache.synapse.endpoints.EndpointContext} - Endpoint : AnonymousEndpoint with address https://app03.XXXX.uat.XXX.com.ph:50209/XXXX-ws/ will be marked SUSPENDED as it failed {org.apache.synapse.endpoints.EndpointContext}
TID: [-1234] [] [2017-09-22 09:12:20,542] WARN {org.apache.synapse.endpoints.EndpointContext} - Suspending endpoint : AnonymousEndpoint with address https://app03.XXXX.uat.XXX.com.ph:50209/XXXX-ws/ - last suspend duration was : 300000ms and current suspend duration is : 300000ms - Next retry after : Fri Sep 22 09:17:20 PHT 2017 {org.apache.synapse.endpoints.EndpointContext}
TID: [-1234] [] [2017-09-22 09:12:20,542] WARN {org.apache.synapse.endpoints.LoadbalanceEndpoint} - Endpoint [XXXX-ws_LBEP] Detect a Failure in a child endpoint : AnonymousEndpoint {org.apache.synapse.endpoints.LoadbalanceEndpoint}
TID: [-1] [] [2017-09-22 09:12:20,545] WARN {org.apache.synapse.transport.passthru.ConnectCallback} - Connection refused or failed for : app04.XXXX.uat.XXX.com.ph:50209 {org.apache.synapse.transport.passthru.ConnectCallback}
TID: [-1234] [] [2017-09-22 09:12:20,545] WARN {org.apache.synapse.endpoints.EndpointContext} - Endpoint : AnonymousEndpoint with address https://app04.XXXX.uat.XXX.com.ph:50209/XXXX-ws/ will be marked SUSPENDED as it failed {org.apache.synapse.endpoints.EndpointContext}
TID: [-1234] [] [2017-09-22 09:12:20,546] WARN {org.apache.synapse.endpoints.EndpointContext} - Suspending endpoint : AnonymousEndpoint with address https://app04.XXXX.uat.XXX.com.ph:50209/XXXX-ws/ - last suspend duration was : 300000ms and current suspend duration is : 300000ms - Next retry after : Fri Sep 22 09:17:20 PHT 2017 {org.apache.synapse.endpoints.EndpointContext}
TID: [-1234] [] [2017-09-22 09:12:20,546] WARN {org.apache.synapse.endpoints.LoadbalanceEndpoint} - Endpoint [XXXX-ws_LBEP] Detect a Failure in a child endpoint : AnonymousEndpoint {org.apache.synapse.endpoints.LoadbalanceEndpoint}
TID: [-1234] [] [2017-09-22 09:12:20,785] INFO {org.apache.synapse.mediators.builtin.LogMediator} - Response: To = /services/XXXX-ws_PS/institutions/details/00239, IP = 172.22.222.156, RequestID = urn:uuid:e5aca458-03a6-41b3-81b5-d409c5eaa66a {org.apache.synapse.mediators.builtin.LogMediator}
TID: [-1] [] [2017-09-22 09:15:03,802] WARN {org.apache.synapse.transport.passthru.SourceHandler} - Connection time out after request is read: http-incoming-49847 Socket Timeout : 180000 Remote Address : h02610a24.ho.ad.XXX/172.22.222.156:58409 {org.apache.synapse.transport.passthru.SourceHandler}
TID: [-1234] [] [2017-09-22 09:30:09,430] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /, MessageID: urn:uuid:d233e911-f717-4d42-a24c-eca0e7c32768, Direction: request, 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: [-1] [] [2017-09-22 09:47:24,248] ERROR {org.apache.synapse.transport.passthru.SourceHandler} - I/O error: Unrecognized SSL message, plaintext connection? {org.apache.synapse.transport.passthru.SourceHandler}
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.EngineInputRecord.bytesInCompletePacket(EngineInputRecord.java:156)
at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:868)
at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)
at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
at org.apache.http.nio.reactor.ssl.SSLIOSession.doUnwrap(SSLIOSession.java:245)
at org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(SSLIOSession.java:280)
at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(SSLIOSession.java:410)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:119)
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:159)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:338)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:316)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:277)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:105)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:586)
at java.lang.Thread.run(Thread.java:745)
TID: [-1234] [] [2017-09-22 10:00:14,936] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /, MessageID: urn:uuid:d5e87ee5-d83b-4ded-8110-b64dd01ce08f, Direction: request, 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}
Proxy Code
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="XXXX-ws_PS" startOnLoad="true" transports="https http" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<property description="targetURL" expression="get-property('To')" name="targetURL" scope="default" type="STRING"/>
<property description="clientIP" expression="get-property('axis2','REMOTE_ADDR')" name="clientIP" scope="default" type="STRING"/>
<property description="requestID" expression="get-property('MessageID')" name="requestID" scope="default" type="STRING"/>
<log description="requestLog" level="custom">
<property expression="get-property('targetURL')" name="Request: Target URL"/>
<property expression="get-property('clientIP')" name="Client IP"/>
<property expression="get-property('requestID')" name="Request ID"/>
</log>
<send description="">
<endpoint key="XXXX-ws_LBEP"/>
</send>
</inSequence>
<outSequence>
<log description="resposeLog" level="custom">
<property expression="get-property('targetURL')" name="Response: To"/>
<property expression="get-property('clientIP')" name="IP"/>
<property expression="get-property('requestID')" name="RequestID"/>
</log>
<send/>
</outSequence>
<faultSequence>
<log category="ERROR" description="errorLog" level="custom">
<property expression="get-property('targetURL')" name="Error: To"/>
<property expression="get-property('clientIP')" name="IP"/>
<property expression="get-property('requestID')" name="RequestID"/>
</log>
</faultSequence>
</target>
</proxy>
Endpoint Code
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="XXXX-ws_LBEP" xmlns="http://ws.apache.org/ns/synapse">
<loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
<endpoint>
<http uri-template="https://app01.XXXX.uat.XXX.com.ph:50209/XXXX-ws/">
<timeout>
<duration>600000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<initialDuration>300000</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>1800000</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>3</retriesBeforeSuspension>
<retryDelay>30000</retryDelay>
</markForSuspension>
</http>
</endpoint>
<endpoint>
<http uri-template="https://app02.XXXX.uat.XXX.com.ph:50209/XXXX-ws/">
<timeout>
<duration>600000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<initialDuration>300000</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>1800000</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>3</retriesBeforeSuspension>
<retryDelay>30000</retryDelay>
</markForSuspension>
</http>
</endpoint>
<endpoint>
<http uri-template="https://app03.XXXX.uat.XXX.com.ph:50209/XXXX-ws/">
<timeout>
<duration>600000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<initialDuration>300000</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>1800000</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>3</retriesBeforeSuspension>
<retryDelay>30000</retryDelay>
</markForSuspension>
</http>
</endpoint>
<endpoint>
<http uri-template="https://app04.XXXX.uat.XXX.com.ph:50209/XXXX-ws/">
<timeout>
<duration>600000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<initialDuration>300000</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>1800000</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>3</retriesBeforeSuspension>
<retryDelay>30000</retryDelay>
</markForSuspension>
</http>
</endpoint>
</loadbalance>
</endpoint>

The use of 'targetURL' is not correct. Instead define the endpoint in the <send> So something like
<send>
<endpoint key="XXXX-ws_LBEP" />
</send>

Related

WSO2 Couldn't save JSON payload

I use WSO2 EI 6.6.0 and Micro Integrator 4.0.0. I have an api to get data, but for this I need to authenticate and get a token to use in a further request. for authentication I use separately created api and call it from first flow. For authentication I need to create a payload and send it in the request body to the server, but I get an error. The problem is repeated on different servers and I do not understand what is the reason.
My Auth API looks like this:
<api context="/auth" name="AuthGateway" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/gateway">
<inSequence>
<payloadFactory media-type="json">
<format>{"username": "adm", "password": "admin"}</format>
<args/>
</payloadFactory>
<call>
<endpoint>
<http method="post" uri-template="https://1537-212-90-188-166.ngrok.io/auth/login">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
<log separator="
">
<property expression="json-eval($)" name="log_auth"/>
</log>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
My Data API looks like this:
<resource methods="GET" uri-template="/fieldCard?*">
<inSequence>
<propertyGroup>
<property name="uri.var.version" expression="$url:version" scope="default" type="STRING"/>
<property name="uri.var.size" expression="$url:size" scope="default" type="STRING"/>
<property name="uri.var.page" expression="$url:page" scope="default" type="STRING"/>
</propertyGroup>
<log level="full" separator="
">
<property name="version" expression="$ctx:uri.var.version"/>
<property name="size" expression="$ctx:uri.var.size"/>
<property name="page" expression="$ctx:uri.var.page"/>
</log>
<call>
<endpoint>
<http method="GET" uri-template="http://localhost:8290/auth/gateway"/>
</endpoint>
</call> .......
In the console I get messages:
[2022-05-02 19:16:12,962] ERROR {JsonStreamBuilder} - Error occurred while processing document for application/json java.lang.reflect.InvocationTargetException
Caused by: org.apache.axis2.AxisFault: #Can not parse stream. MessageID: urn:uuid:7ac6a4c9-0ed1-4973-87d4-69dad6d4a950. Error>>> #getNewJsonPayload. Could not save JSON payload. Invalid input stream found. Payload is not a JSON string.
org.apache.synapse.commons.json.JsonStreamBuilder.processDocument(JsonStreamBuilder.java:43)
... 21 more
Caused by: org.apache.axis2.AxisFault: #getNewJsonPayload. Could not save JSON payload. Invalid input stream found. Payload is not a JSON string.
[2022-05-02 19:16:12,963] ERROR {DeferredMessageBuilder} - Error building message org.apache.axis2.AxisFault
[2022-05-02 19:16:12,964] ERROR {RelayUtils} - Error while building Passthrough stream org.apache.axis2.AxisFault
[2022-05-02 19:16:12,964] ERROR {SequenceMediator} - {api:AuthGateway} Error while building message. Error while building Passthrough stream org.apache.axis2.AxisFault: Error while building Passthrough stream
I removed the detailed stack trace. If it is needed to understand the problem - I can add it.
P.S. When calling the auth API directly I get the token and the response is correct.
[2022-05-02 19:20:17,560] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: http://www.w3.org/2005/08/addressing/anonymous
WSAction:
SOAPAction:
MessageID: urn:uuid:817185a7-39a4-4418-a696-72473672997d
Direction: request
log_auth = {"access_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMyIsInVzZXJfbmFtZSI6Im...
Payload: {"access_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMyIsInVzZXJfbmFtZSI6Im...
Please help me understand the problem.
UPD: I reinstalled the server because I thought the error might be there or I broke the config files. created a new project and wrote a new same thread, but the error still repeats.
Good. The problem was that Postman has a Header Accept-Encoding option. When this parameter was disabled, the request became correct and the response began to come without errors!

WSO2, datamapper mediator fails with "[base64 string] is not defined in <eval> at line number 1"

On both Integration Studio 8.0.0 and Enterprise Integrator 6.6.0 i'm having an error when using a datamapper mediator to convert a JSON payload to another JSON payload.
The error has the base64 conversion of the datamapper .dmc file.
A full log mediator placed before the datamapper shows that I received a correct json response
TID: [-1234] [] [2021-09-08 13:43:01,076] DEBUG {org.apache.synapse.mediators.builtin.LogMediator} - Start : Log mediator
TID: [-1234] [] [2021-09-08 13:43:01,076] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:8f511c89-c468-4f24-a067-d0f476a63fb7, Direction: response, Payload: (the whole json response)
TID: [-1234] [] [2021-09-08 13:43:01,077] DEBUG {org.apache.synapse.mediators.builtin.LogMediator} - End : Log mediator
The full error is
TID: [-1234] [] [2021-09-08 13:43:01,077] DEBUG {org.apache.synapse.mediators.base.SequenceMediator} - Building message. Sequence <SequenceMediator> is content aware
TID: [-1234] [] [2021-09-08 13:43:01,078] DEBUG {org.apache.synapse.transport.passthru.util.RelayUtils} - Content Type is application/json; charset=UTF-8
TID: [-1234] [] [2021-09-08 13:43:01,078] INFO {org.wso2.carbon.mediation.dependency.mgt.DependencyTracker} - Local entry : gov:datamappers/ricercaUoDataMapper.dmc was added to the Synapse configuration successfully
TID: [-1234] [] [2021-09-08 13:43:01,082] INFO {org.wso2.carbon.mediation.dependency.mgt.DependencyTracker} - Local entry : gov:datamappers/ricercaUoDataMapper_inputSchema.json was added to the Synapse configuration successfully
TID: [-1234] [] [2021-09-08 13:43:01,084] INFO {org.wso2.carbon.mediation.dependency.mgt.DependencyTracker} - Local entry : gov:datamappers/ricercaUoDataMapper_outputSchema.json was added to the Synapse configuration successfully
TID: [-1234] [] [2021-09-08 13:43:01,100] DEBUG {org.apache.synapse.config.SynapsePropertiesLoader} - Retrieving synapse properties from the cache
TID: [-1234] [] [2021-09-08 13:43:01,102] DEBUG {org.apache.synapse.commons.json.JsonReadOnlyStream} - #close
TID: [-1234] [] [2021-09-08 13:43:01,580] ERROR {org.wso2.carbon.mediator.datamapper.DataMapperMediator} - DataMapper mediator : mapping failed Error while reading input stream. Script engine unable to execute the script javax.script.ScriptException: ReferenceError: "bWFwX1Nfcm9vdF9TX3Jvb3QgPSBmdW5jdGlvbigpeyAKdmFyIG91dHB1dHJvb3Q9e307Cgp2YXIgY291bnRfaV9VT18xMDI0NjFhMl9jMzVjXzQ2MTdfYTUwYV82MTFkNWNiOGE1ZGUgPSAwOwpvdXRwdXRyb290ID0gIHt9OwpvdXRwdXRyb290LmNvdW50ID0gaW5wdXRyb290LmZvdW5kVU9zLmNvdW50OwpvdXRwdXRyb290LnJlc3VsdCA9ICB7fTsKb3V0cHV0cm9vdC5yZXN1bHQudW9zID0gIFtdOwoKZm9yKGlfVU9fMTAyNDYxYTJfYzM1Y180NjE3X2E1MGFfNjExZDVjYjhhNWRlIGluIGlucHV0cm9vdC5mb3VuZFVPcy5pbnRlcm5hbFVPcy5VT3MuVU8pewpvdXRwdXRyb290LnJlc3VsdC51b3NbY291bnRfaV9VT18xMDI0NjFhMl9jMzVjXzQ2MTdfYTUwYV82MTFkNWNiOGE1ZGVdID0gIHt9OwpvdXRwdXRyb290LnJlc3VsdC51b3NbY291bnRfaV9VT18xMDI0NjFhMl9jMzVjXzQ2MTdfYTUwYV82MTFkNWNiOGE1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GVdLmRhdGFfaW5pemlvID0gaW5wdXRyb290LmZvdW5kVU9zLmludGVybmFsVU9zLlVPcy5VT1tpX1VPXzEwMjQ2MWEyX2MzNWNfNDYxN19hNTBhXzYxMWQ1Y2I4YTVkZV0uZGF0YV9pbml6aW87Cm91dHB1dHJvb3QucmVzdWx0LnVvc1tjb3VudF9pX1VPXzEwMjQ2MWEyX2MzNWNfNDYxN19hNTBhXzYxMWQ1Y2I4YTVkZV0uZGF0YV9maW5lID0gaW5wdXRyb290LmZvdW5kVU9zLmludGVybmFsVU9zLlVPcy5VT1tpX1VPXzEwMjQ2MWEyX2MzNWNfNDYxN19hNTBhXzYxMWQ1Y2I4YTVkZV0uZGF0YV9maW5lOwoKY291bnRfaV9VT18xMDI0NjFhMl9jMzVjXzQ2MTdfYTUwYV82MTFkNWNiOGE1ZGUrKzsKfQpyZXR1cm4gb3V0cHV0cm9vdDsKfTsKCgoKCgoKCgoKCgoKCgoK" 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:90)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.transform(DataMapperMediator.java:390)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.mediate(DataMapperMediator.java:301)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.rest.Resource.process(Resource.java:331)
at org.apache.synapse.rest.API.process(API.java:380)
at org.apache.synapse.rest.RESTRequestHandler.apiProcessNonDefaultStrategy(RESTRequestHandler.java:149)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:95)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:58)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:327)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:578)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:195)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:284)
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)
TID: [-1234] [] [2021-09-08 13:43:02,307] WARN {org.apache.synapse.FaultHandler} - ERROR_CODE : 0
TID: [-1234] [] [2021-09-08 13:43:02,308] WARN {org.apache.synapse.FaultHandler} - ERROR_MESSAGE : DataMapper mediator : mapping failed
TID: [-1234] [] [2021-09-08 13:43:02,308] WARN {org.apache.synapse.FaultHandler} - ERROR_DETAIL : org.apache.synapse.SynapseException: DataMapper mediator : mapping failed
at org.apache.synapse.mediators.AbstractMediator.handleException(AbstractMediator.java:367)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.transform(DataMapperMediator.java:444)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.mediate(DataMapperMediator.java:301)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.rest.Resource.process(Resource.java:331)
at org.apache.synapse.rest.API.process(API.java:380)
at org.apache.synapse.rest.RESTRequestHandler.apiProcessNonDefaultStrategy(RESTRequestHandler.java:149)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:95)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:58)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:327)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:578)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:195)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:284)
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)
Caused by: Error while reading input stream. Script engine unable to execute the script javax.script.ScriptException: ReferenceError: "bWFwX1Nfcm9vdF9TX3Jvb3QgPSBmdW5jdGlvbigpeyAKdmFyIG91dHB1dHJvb3Q9e307Cgp2YXIgY291bnRfaV9VT18xMDI0NjFhMl9jMzVjXzQ2MTdfYTUwYV82MTFkNWNiOGE1ZGUgPSAwOwpvdXRwdXRyb290ID0gIHt9OwpvdXRwdXRyb290LmNvdW50ID0gaW5wdXRyb290LmZvdW5kVU9zLmNvdW50OwpvdXRwdXRyb290LnJlc3VsdCA9ICB7fTsKb3V0cHV0cm9vdC5yZXN1bHQudW9zID0gIFtdOwoKZm9yKGlfVU9fMTAyNDYxYTJfYzM1Y180NjE3X2E1MGFfNjExZDVjYjhhNWRlIGluIGlucHV0cm9vdC5mb3VuZFVPcy5pbnRlcm5hbFVPcy5VT3MuVU8pewpvdXRwdXRyb290LnJlc3VsdC51b3NbY291bnRfaV9VT18xMDI0NjFhMl9jMzVjXzQ2MTdfYTUwYV82MTFkNWNiOGE1ZGVdID0gIHt9OwpvdXRwdXRyb290L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lc3VsdC51b3NbY291bnRfaV9VT18xMDI0NjFhMl9jMzVjXzQ2MTdfYTUwYV82MTFkNWNiOGE1ZGVdLmRhdGFfaW5pemlvID0gaW5wdXRyb290LmZvdW5kVU9zLmludGVybmFsVU9zLlVPcy5VT1tpX1VPXzEwMjQ2MWEyX2MzNWNfNDYxN19hNTBhXzYxMWQ1Y2I4YTVkZV0uZGF0YV9pbml6aW87Cm91dHB1dHJvb3QucmVzdWx0LnVvc1tjb3VudF9pX1VPXzEwMjQ2MWEyX2MzNWNfNDYxN19hNTBhXzYxMWQ1Y2I4YTVkZV0uZGF0YV9maW5lID0gaW5wdXRyb290LmZvdW5kVU9zLmludGVybmFsVU9zLlVPcy5VT1tpX1VPXzEwMjQ2MWEyX2MzNWNfNDYxN19hNTBhXzYxMWQ1Y2I4YTVkZV0uZGF0YV9maW5lOwoKY291bnRfaV9VT18xMDI0NjFhMl9jMzVjXzQ2MTdfYTUwYV82MTFkNWNiOGE1ZGUrKzsKfQpyZXR1cm4gb3V0cHV0cm9vdDsKfTsKCgoKCgoKCgoKCgoKCgoK" 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:90)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.transform(DataMapperMediator.java:390)
... 18 more
TID: [-1234] [] [2021-09-08 13:43:02,309] WARN {org.apache.synapse.FaultHandler} - ERROR_EXCEPTION : org.apache.synapse.SynapseException: DataMapper mediator : mapping failed
TID: [-1234] [] [2021-09-08 13:43:02,309] WARN {org.apache.synapse.FaultHandler} - FaultHandler : org.apache.synapse.mediators.MediatorFaultHandler#11271f01
TID: [-1234] [] [2021-09-08 13:43:02,309] WARN {org.apache.synapse.mediators.MediatorFaultHandler} - Executing fault handler mediator : org.apache.synapse.mediators.base.SequenceMediator
TID: [-1234] [] [2021-09-08 13:43:02,309] DEBUG {org.apache.synapse.mediators.base.SequenceMediator} - Start : Sequence <anonymous>
TID: [-1234] [] [2021-09-08 13:43:02,309] DEBUG {org.apache.synapse.mediators.base.SequenceMediator} - Sequence <SequenceMediator> :: mediate()
TID: [-1234] [] [2021-09-08 13:43:02,309] DEBUG {org.apache.synapse.mediators.base.SequenceMediator} - Mediation started from mediator position : 0
TID: [-1234] [] [2021-09-08 13:43:02,310] DEBUG {org.apache.synapse.mediators.base.SequenceMediator} - End : Sequence <anonymous>
The whole interaction happens with a Accept: application/json header, but it happens even with a xml -> json datamapping.
If the payload is json why are you using xml->json data mapping? should it not be json->json data mapping?
Accept:application/json header means it would be json so ideally you should use json->json mapping

Continue the exception from one camel route and handle it in another camel route

I have an Apache Camel route which invokes restlet component and would like to use the redelivery mechanism from the exception handler which performs some processing on every failure to update my database record which should be done on generic route. So, I'm trying to continue the exception in one route and handle the same exception in another route through direct component. But exception is not continuing to generic route.
1st route:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<!-- CXF Rest Endpoint Declaration -->
<cxf:rsServer address="http://localhost:9092/rest/corp"
id="FetchCDFRestRequest" serviceClass="com.tcl.Service.Service" />
<bean class="com.tcl.ExceptionOccurredRefProcessor" id="exProc" />
<bean class="org.apache.camel.builder.DeadLetterChannelBuilder"
id="DLCErrorHandler">
<property name="deadLetterUri"
value="activemq:queue:DMS.FAILURES.DLQ" />
<property name="redeliveryPolicy" ref="redeliveryPolicy" />
</bean>
<bean class="org.apache.camel.processor.RedeliveryPolicy"
id="redeliveryPolicy">
<property name="maximumRedeliveries"
value="3" />
<property name="maximumRedeliveryDelay" value="2000" />
<property name="retryAttemptedLogLevel" value="WARN" />
</bean>
<camelContext id="Corp"
xmlns="http://camel.apache.org/schema/spring">
<errorHandler id="eh" onExceptionOccurredRef="exProc">
<redeliveryPolicy id="redeliveryPolicy" />
</errorHandler>
<route id="MainRouteOppIDFolder" streamCache="true">
<from id="_CreateOppIDFolder"
uri="restlet:http://localhost:9092/rest/corp/createOppIDFolder?restletMethod=POST" />
----------
<to uri="restlet:http://localhost:9902/CreateOppIDFolder?restletMethod=POST" />
------------
<onException id="_onException1" useOriginalMessage="true">
<exception>java.lang.Exception</exception>
<handled>
<simple>false</simple>
</handled>
<log id="_log1" message="Cont... ex >>>>> ${exception.message} "/>
<to uri="direct:ExceptionHandle"/>
</onException>
</route>
</camelContext>
</beans>
2nd route:
<route errorHandlerRef="DLCErrorHandler" >
<from id="_from2" uri="direct:ExceptionHandle"/>
<log id="_log4" message="Req>>>>> ${body}"/>
<onException id="_onException2"
onExceptionOccurredRef="exProc" redeliveryPolicyRef="redeliveryPolicy">
<exception>java.lang.Exception</exception>
<handled>
<simple>true</simple>
</handled>
<log id="_log3" loggingLevel="INFO" message="Handled ex >>>>> ${exception.message} "/>
<choice id="_choice1">
<when id="_when1">
<simple>${header.errorMessage} contains 'Could not send Message' || ${header.errorMessage} contains 'Connection timed out'</simple>
<to id="_to1" pattern="OutOnly" uri="activemq:queue:DMS.FAILURES"/>
</when>
<otherwise id="_otherwise1">
<log id="_log5" loggingLevel="ERROR" message="Exception occured in otherwise block >>>>>> ${exception.stacktrace} "/>
</otherwise>
</choice>
</onException>
</route>
12:11:24.384 [Restlet-781390346] WARN o.a.c.processor.DeadLetterChannel - Failed delivery for (MessageId: ID-DESKTOP-P2DBOO5-1580280046927-0-8 on ExchangeId: ID-DESKTOP-P2DBOO5-1580280046927-0-7).On delivery attempt: 0 caught: org.apache.camel.component.restlet.RestletOperationException: Restlet operation failed invoking http://localhost:9902/CreateOppIDFolder with statusCode: 500 /n responseBody:org.apache.cxf.interceptor.Fault: Could not send Message.
Caused by: java.net.ConnectException: ConnectException invoking http://172.16.18.113:7001/services/TCLDMSSFDCService/TCLDMSSFDCService: Connection timed out: connect
Caused by: java.net.ConnectException: Connection timed out: connect
12:11:24.392 [Restlet-781390346] INFO MainRouteOppIDFolder - Cont... ex >>>>> Restlet operation failed invoking http://localhost:9902/CreateOppIDFolder with statusCode: 500 /n responseBody:org.apache.cxf.interceptor.Fault: Could not send Message.
Caused by: java.net.ConnectException: ConnectException invoking http://172.16.18.113:7001/services/TCLDMSSFDCService/TCLDMSSFDCService: Connection timed out: connect
Caused by: java.net.ConnectException: Connection timed out: connect
12:11:24.396 [Restlet-781390346] INFO _route1 - Req>>>>> {
"oppID" : "10268216",
"salesOrganization" : "Commerical Finance",
"salesVertical" : "CEQ",
"productName" : "Construction Equipment Finance",
"applicantName" : "SGS INFRASTRUCTURE",
"docName" : null,
"appNature" : null,
"docType" : null,
"base64Content" : null
}
12:11:24.405 [Restlet-781390346] ERROR o.a.c.processor.DeadLetterChannel - Failed delivery for (MessageId: ID-DESKTOP-P2DBOO5-1580280046927-0-8 on ExchangeId: ID-DESKTOP-P2DBOO5-1580280046927-0-7). Exhausted after delivery attempt: 1 caught: org.apache.camel.component.restlet.RestletOperationException: Restlet operation failed invoking http://localhost:9902/CreateOppIDFolder with statusCode: 500 /n responseBody:org.apache.cxf.interceptor.Fault: Could not send Message.
Caused by: java.net.ConnectException: ConnectException invoking http://172.16.18.113:7001/services/TCLDMSSFDCService/TCLDMSSFDCService: Connection timed out: connect
Caused by: java.net.ConnectException: Connection timed out: connect
. Processed by failure processor: FatalFallbackErrorHandler[Pipeline[[Channel[Log(MainRouteOppIDFolder)[Cont... ex >>>>> ${exception.message} ]], Channel[sendTo(direct://ExceptionHandle)], Channel[Log(MainRouteOppIDFolder)]]]]
Message History
RouteId ProcessorId Processor Elapsed (ms)
[MainRouteOppIDFold] [MainRouteOppIDFold] [restlet://http://localhost:9092/rest/corp/createOppIDFolder?restletMethod=POST] [ 21608]
[MainRouteOppIDFold] [_CreateOppIDFolder] [restlet:http://localhost:9902/CreateOppIDFolder?restletMethod=POST ] [ 21319]
[MainRouteOppIDFold] [_to2 ] [direct:ExceptionHandle ] [ 1]
[_route1 ] [_log4 ] [log ] [ 1]
Stacktrace
org.apache.camel.component.restlet.RestletOperationException: Restlet operation failed invoking http://localhost:9902/CreateOppIDFolder with statusCode: 500 /n responseBody:org.apache.cxf.interceptor.Fault: Could not send Message.
Caused by: java.net.ConnectException: ConnectException invoking http://172.16.18.113:7001/services/TCLDMSSFDCService/TCLDMSSFDCService: Connection timed out: connect
Caused by: java.net.ConnectException: Connection timed out: connect```
**Any suggestions please?**
To be honest: I don't see your problem.
Your exception block does
<log id="_log1" message="Cont... ex >>>>> ${exception.message} "/>
<to uri="direct:ExceptionHandle"/>
The direct route does
<log id="_log4" message="Req>>>>> ${body}"/>
And your log shows
Cont... ex >>>>> [error message]
Req>>>>> [message body]
So everything works as you expect. Am I missing something?
Update due to comment
The onException block of the second route is NOT called as long as no Exception occurs in the second route. The second route normally receives a message and processes it.
You can still access the exception information on the message with ${exception}.

Why does a mule rollback exception propagate to the flow that called it?

I have a mule project where a flow with a rollback exception is causing an exception to be thrown in the flow that references it. Is this normal behaviour?
Here is the code:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file"xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.5.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd">
<file:connector name="File" autoDelete="true" streaming="false" validateConnections="true" doc:name="File"/>
<flow name="rollbacktestFlow2" doc:name="rollbacktestFlow2">
<file:inbound-endpoint path="C:\RollbackTEst\In" responseTimeout="10000" doc:name="File" connector-ref="File"/>
<logger message="File Rx" level="INFO" doc:name="FileRx"/>
<flow-ref name="rollbacktestFlow1" doc:name="Flow Reference"/>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<logger message="Rollbacktestflow 2" level="INFO" doc:name="Rollbacktestflow2"/>
</catch-exception-strategy>
</flow>
<flow name="rollbacktestFlow1" doc:name="rollbacktestFlow1" >
<logger message="Rollback trigger" level="INFO" doc:name="RollbackTrigger"/>
<expression-component doc:name="Expression"><![CDATA[forceException]]></expression-component>
<rollback-exception-strategy maxRedeliveryAttempts="4" doc:name="Rollback Exception Strategy">
<logger message="retry" level="INFO" doc:name="retry"/>
<expression-component doc:name="Copy_of_Expression"><![CDATA[forceException]]></expression-component>
<on-redelivery-attempts-exceeded doc:name="Redelivery exhausted">
<logger message="exhausted" level="INFO" doc:name="exhausted"/>
</on-redelivery-attempts-exceeded>
</rollback-exception-strategy>
</flow>
Should the rollback section of the exception not be executed 4 times and then the redelivery exhausted exception be thrown?
Here is the log:
INFO 2014-11-12 15:36:40,529 [main] org.mule.module.launcher.MuleDeploymentService:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'rollbacktest' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2014-11-12 15:36:40,544 [main] org.mule.module.launcher.DeploymentDirectoryWatcher:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Mule is up and kicking (every 5000ms) +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2014-11-12 15:37:18,031 [[rollbacktest].File.receiver.01] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\RollbackTEst\In\New Text Document.txt
INFO 2014-11-12 15:37:18,048 [[rollbacktest].rollbacktestFlow2.stage1.02] org.mule.api.processor.LoggerMessageProcessor: File Rx
INFO 2014-11-12 15:37:18,048 [[rollbacktest].rollbacktestFlow2.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Rollback trigger
ERROR 2014-11-12 15:37:18,079 [[rollbacktest].rollbacktestFlow2.stage1.02] org.mule.exception.RollbackMessagingExceptionStrategy:
********************************************************************************
Message : Execution of the expression "forceException" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: byte[]
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. [Error: unresolvable property or identifier: forceException]
[Near : {... forceException ....}]
^
[Line: 1, Column: 1] (org.mule.mvel2.PropertyAccessException)
org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:692 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/mvel2/PropertyAccessException.html)
2. Execution of the expression "forceException" failed. (org.mule.api.expression.ExpressionRuntimeException)
org.mule.el.mvel.MVELExpressionLanguage:202 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
3. Execution of the expression "forceException" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: byte[] (org.mule.api.MessagingException)
org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
[Error: unresolvable property or identifier: forceException]
[Near : {... forceException ....}]
^
[Line: 1, Column: 1]
at org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:692)
at org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:337)
at org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:140)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
INFO 2014-11-12 15:37:18,079 [[rollbacktest].rollbacktestFlow2.stage1.02] org.mule.api.processor.LoggerMessageProcessor: retry
ERROR 2014-11-12 15:37:18,079 [[rollbacktest].rollbacktestFlow2.stage1.02] org.mule.exception.RollbackMessagingExceptionStrategy: Failed to dispatch message to error queue after it failed to process. This may cause message loss.Logging Message here:
org.mule.DefaultMuleMessage
{
id=c8cf45f1-6a81-11e4-887d-005056b6086b
payload=[B
correlationId=<not set>
correlationGroup=-1
correlationSeq=-1
encoding=UTF-8
exceptionPayload=org.mule.message.DefaultExceptionPayload#1975a694
Message properties:
INVOCATION scoped properties:
originalFilename=New Text Document.txt
INBOUND scoped properties:
MULE_ORIGINATING_ENDPOINT=endpoint..C.Users.mik119.Desktop.RollbackTEst.In
directory=C:\RollbackTEst\In
fileSize=0
originalFilename=New Text Document.txt
timestamp=1415806637595
OUTBOUND scoped properties:
MULE_ENCODING=UTF-8
SESSION scoped properties:
}
org.mule.api.MessagingException: Execution of the expression "forceException" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: byte[]
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:32)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:94)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:67)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:50)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:67)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:22)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:66)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:61)
at org.mule.exception.TemplateMessagingExceptionStrategy.route(TemplateMessagingExceptionStrategy.java:139)
at org.mule.exception.RollbackMessagingExceptionStrategy.route(RollbackMessagingExceptionStrategy.java:104)
at org.mule.exception.TemplateMessagingExceptionStrategy.handleException(TemplateMessagingExceptionStrategy.java:45)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:37)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:54)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13)
at org.mule.execution.ErrorHandlingExecutionTemplate.execute(ErrorHandlingExecutionTemplate.java:59)
at org.mule.execution.ErrorHandlingExecutionTemplate.execute(ErrorHandlingExecutionTemplate.java:30)
at org.mule.construct.Flow.process(Flow.java:76)
at org.mule.config.spring.factories.FlowRefFactoryBean$2.process(FlowRefFactoryBean.java:145)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:94)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:67)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:102)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:51)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:118)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:189)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:182)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:16)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:30)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:54)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:44)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:40)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:41)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:48)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:109)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:30)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:181)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:39)
at org.mule.work.WorkerContext.run(WorkerContext.java:286)
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: org.mule.api.expression.ExpressionRuntimeException: Execution of the expression "forceException" failed.
at org.mule.el.mvel.MVELExpressionLanguage.evaluateInternal(MVELExpressionLanguage.java:202)
at org.mule.el.mvel.MVELExpressionLanguage.evaluate(MVELExpressionLanguage.java:154)
at org.mule.el.mvel.MVELExpressionLanguage.evaluate(MVELExpressionLanguage.java:133)
at org.mule.el.ExpressionLanguageComponent.process(ExpressionLanguageComponent.java:51)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
... 56 more
Caused by: [Error: unresolvable property or identifier: forceException]
[Near : {... forceException ....}]
^
[Line: 1, Column: 1]
at org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:692)
at org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:337)
at org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:140)
at org.mule.mvel2.ast.ASTNode.optimize(ASTNode.java:159)
at org.mule.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115)
at org.mule.mvel2.MVELRuntime.execute(MVELRuntime.java:86)
at org.mule.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
at org.mule.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
at org.mule.mvel2.MVEL.executeExpression(MVEL.java:943)
at org.mule.el.mvel.MVELExpressionExecutor.execute(MVELExpressionExecutor.java:72)
at org.mule.el.mvel.MVELExpressionLanguage.evaluateInternal(MVELExpressionLanguage.java:198)
... 60 more
ERROR 2014-11-12 15:37:18,095 [[rollbacktest].rollbacktestFlow2.stage1.02] org.mule.exception.CatchMessagingExceptionStrategy:
********************************************************************************
Message : Execution of the expression "forceException" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: byte[]
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. [Error: unresolvable property or identifier: forceException]
[Near : {... forceException ....}]
^
[Line: 1, Column: 1] (org.mule.mvel2.PropertyAccessException)
org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:692 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/mvel2/PropertyAccessException.html)
2. Execution of the expression "forceException" failed. (org.mule.api.expression.ExpressionRuntimeException)
org.mule.el.mvel.MVELExpressionLanguage:202 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
3. Execution of the expression "forceException" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: byte[] (org.mule.api.MessagingException)
org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
[Error: unresolvable property or identifier: forceException]
[Near : {... forceException ....}]
^
[Line: 1, Column: 1]
at org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:692)
at org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:337)
at org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:140)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
INFO 2014-11-12 15:37:18,095 [[rollbacktest].rollbacktestFlow2.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Rollbacktestflow 2
The exhausted logger is not getting called, instead the Rollbacktestflow2 logger in the initial flow is called.
Can anyone explain why? Thanks
Why the rollback-exception-strategy doesn't retry?:
The rollback-exception-strategy behaves differently depending on if the flow has a transaction or not, and on the kind of inbound connector ( transactional or reliable ).
To be able to reprocess the message, you need an inbound transport, so the rollback-exception-strategy can either rollback the transaction ( transactional transport with an open transaction ) or discard the message and try again ( reliable transport )
In your example you don't have an inbound connector on the second flow, so the rollback-exception-strategybehaves as section "Use Rollback Exception Strategy for Unhandled Exceptions" on the mule doc describes: "When the flow exchange pattern is request-response, rollback exception strategy changes the payload of a message and returns it to the client"
Although the doc is not explicit, when the flow doesn't have an inbound connector the rollback-exception-strategy doesn't retry.
If you want to implement a flow that retries, you can use a vm transport between the two flows.
Example:
<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:https="http://www.mulesoft.org/schema/mule/https"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.5.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd">
<file:connector name="File" autoDelete="true" streaming="false" validateConnections="true" doc:name="File"/>
<flow name="pickFiles" >
<file:inbound-endpoint path="/Users/ramiro/tmp/rollback/in" responseTimeout="10000" doc:name="File" connector-ref="File"/>
<logger message="File Rx" level="INFO" doc:name="FileRx"/>
<vm:outbound-endpoint path="buffer" exchange-pattern="one-way" doc:name="VM"/>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<logger message="Rollbacktestflow 2" level="INFO" doc:name="Rollbacktestflow2"/>
</catch-exception-strategy>
</flow>
<flow name="processQueue" >
<vm:inbound-endpoint path="buffer" exchange-pattern="one-way" doc:name="VM">
<vm:transaction action="ALWAYS_BEGIN" />
</vm:inbound-endpoint>
<logger message="about to throw Exception..." level="INFO" doc:name="RollbackTrigger"/>
<scripting:component doc:name="throw Exception">
<scripting:script engine="Groovy"><![CDATA[
throw new Exception('some very bad error')
]]></scripting:script>
</scripting:component>
<!-- we never get here -->
<file:outbound-endpoint path="/Users/ramiro/tmp/rollback/success " doc:name="dlq" connector-ref="File"/>
<rollback-exception-strategy maxRedeliveryAttempts="4" doc:name="Rollback Exception Strategy">
<logger message="retry" level="INFO" doc:name="retry"/>
<on-redelivery-attempts-exceeded >
<logger message="exhausted" level="INFO" doc:name="exhausted"/>
<file:outbound-endpoint path="/Users/ramiro/tmp/rollback/dlq" doc:name="dlq" connector-ref="File"/>
</on-redelivery-attempts-exceeded>
</rollback-exception-strategy>
</flow>
</mule>
Here we get a file and send it via a vm transport. The second flow picks the message from the vm and if there's an exception ( always in the example ), will abort the transaction and try to process again the message, and if it fails 4 times then send it to a DLQ.
About until-successful
You say that you used until-successful as a workaround. In my opinion using rollback-exception-strategy is more appropriate when you have a unit of work that you need to handle as a transaction ( maybe a flow with several transformations and enrichments ), and until-successful when you just need to retry a step that may fail ( like calling a REST service that may fail because of a temporary network condition )

Without internet PrimeFaces 4.0 is not working

Technologies are
spring-web-flow2.3.0.
jsf2.0
springsecurity3.0
primefaces4.0
I am getting below Error.
please suggest me....
Error:
18:15:47,076 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-5) Context initialization failed: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [webmvc-config.xml]
Offending resource: ServletContext resource [/WEB-INF/config/web-application-config.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/config/webmvc-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 21; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'faces:resources'.
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_03]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/config/webmvc-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 21; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'faces:resources'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:255) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
... 27 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 21; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'faces:resources'.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:285)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
... 30 more
18:15:47,096 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/eSociety-web]] (MSC service thread 1-5) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [webmvc-config.xml]
Offending resource: ServletContext resource [/WEB-INF/config/web-application-config.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/config/webmvc-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 21; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'faces:resources'.
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) [spring-web-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_03]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/config/webmvc-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 21; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'faces:resources'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:255) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
... 27 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 21; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'faces:resources'.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:390)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:322)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:285)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) [spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE]
... 30 more
18:15:47,249 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-5) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401) for context '/eSociety-web'
18:15:50,509 INFO [org.primefaces.webapp.PostConstructApplicationEventListener] (MSC service thread 1-5) Running on PrimeFaces 4.0
18:15:50,527 INFO [org.primefaces.extensions.application.PostConstructApplicationEventListener] (MSC service thread 1-5) Running on PrimeFaces Extensions 0.6.3
18:15:50,588 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-5) Error listenerStart
18:15:50,588 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-5) Context [/eSociety-web] startup failed due to previous errors
18:15:50,589 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/eSociety-web]] (MSC service thread 1-5) Closing Spring root WebApplicationContext
18:15:50,589 INFO [org.springframework.web.context.support.XmlWebApplicationContext] (MSC service thread 1-5) Closing Root WebApplicationContext: startup date [Fri Jan 31 18:14:22 IST 2014]; root of context hierarchy
18:15:50,591 WARN [org.springframework.web.context.support.XmlWebApplicationContext] (MSC service thread 1-5) Exception thrown from ApplicationListener handling ContextClosedEvent: java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Fri Jan 31 18:14:22 IST 2014]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:347) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1049) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_03]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]
18:15:50,596 WARN [org.springframework.web.context.support.XmlWebApplicationContext] (MSC service thread 1-5) Exception thrown from LifecycleProcessor on context close: java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Fri Jan 31 18:14:22 IST 2014]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_03]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]
18:15:50,600 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/eSociety-web]] (MSC service thread 1-5) Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_03]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]
18:15:50,616 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.web.deployment.default-host./eSociety-web: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./eSociety-web: JBAS018040: Failed to start context
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:95)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
]
This is my webmvc-flow.xml
please suggest me.....
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:faces="http://www.springframework.org/schema/faces"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/faces http://www.springframework.org/schema/faces/spring-faces-2.4.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
<faces:resources />
<!-- Maps request URIs to controllers. Here we have two kinds of flows one is login flow and another is main flow -->
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>
/main=flowController
/login=loginController
</value>
</property>
<property name="defaultHandler">
<!-- Selects view names to render based on the request URI: e.g. /main selects "main" -->
<bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
</property>
</bean>
<!-- it is used to handle the flow control Adaptor in 2.3.0. This will come from spring framework.web.servlet3.2.1 -->
<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
<!-- it trigers to the loginFlowController -->
<bean id="loginController" class="com.LoginFlowController">
<property name="flowExecutor" ref="flowExecutor"/>
</bean>
<!-- Handles requests mapped to the Spring Web Flow system and ajaxHandler.
after security we need to enable the ajax for that we need to write one property i.e ajaxHandler -->
<bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
<property name="flowExecutor" ref="flowExecutor" />
<property name="ajaxHandler">
<bean class="org.springframework.faces.webflow.JsfAjaxHandler"/>
</property>
</bean>
<!-- Maps logical view names to Facelet templates in /WEB-INF (e.g. 'search' to '/WEB-INF/search.xhtml' -->
<bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
<property name="prefix" value="/WEB-INF/" />
<property name="suffix" value=".xhtml" />
</bean>
<bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener" />
<!-- ========================= MESSAGE SOURCE DEFINITION ========================= -->
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages" />
</bean>
</beans>
Had the same issue!
Using the schema location
http://www.springframework.org/schema/faces/spring-faces-2.2.xsd
instead of
http://www.springframework.org/schema/faces/spring-faces-2.4.xsd
(as proposed in the official documentation) worked like a charm!