NPE in WebSphere due to changing requests - nullpointerexception

I have a number of NPEs occuring when, implicitly, calling request.getAttribute("atg.parent.session.id"). The stack trace is below (wrapped between the trace log).
[2012/02/03 12:53:26:953 SAST] 00000162 srt 1 com.ibm.ws.webcontainer.srt.SRTServletRequest getHeader this->com.ibm.ws.webcontainer.srt.SRTServletRequest#14f314f3: name --> SOAPAction header --> "http://acme.com/services/pick/SubmitOrder2"
[2012/02/03 12:53:26:953 SAST] 00000162 http 1 com.ibm.ws.webcontainer.srt.http.HttpInputStream fill fill
[2012/02/03 12:53:26:960 SAST] 00000162 channel 1 com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream bufferIsGood buffer is good remaining --> 1635
[2012/02/03 12:53:26:960 SAST] 00000162 http 1 com.ibm.ws.webcontainer.srt.http.HttpInputStream read read length -->2048
[2012/02/03 12:53:26:960 SAST] 00000162 channel 1 com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream bufferIsGood buffer is good remaining --> 1123
[2012/02/03 12:53:26:960 SAST] 00000162 channel 1 com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream read Reset requested len --> 1574 to size remaining in current buffer --> 1123
[2012/02/03 12:53:26:960 SAST] 00000162 http 1 com.ibm.ws.webcontainer.srt.http.HttpInputStream read read returning -->1597, total=1635,limit=1635
[2012/02/03 12:53:26:961 SAST] 00000162 http 1 com.ibm.ws.webcontainer.srt.http.HttpInputStream read read length -->2048
[2012/02/03 12:53:26:962 SAST] 00000162 http 1 com.ibm.ws.webcontainer.srt.http.HttpInputStream read Over the limit: -1
[2012/02/03 12:53:26:962 SAST] 00000162 http > com.ibm.ws.webcontainer.srt.http.HttpInputStream close ENTRY total=1635,limit=1635
[2012/02/03 12:53:26:962 SAST] 00000162 http 1 com.ibm.ws.webcontainer.srt.http.HttpInputStream finish finish
[2012/02/03 12:53:26:962 SAST] 00000162 srt 1 com.ibm.ws.webcontainer.srt.SRTServletResponse isSkipInputStreamRead skipInputStreamRead = false
[2012/02/03 12:53:26:962 SAST] 00000162 http < com.ibm.ws.webcontainer.srt.http.HttpInputStream close RETURN total=1635,limit=1635
[2012/02/03 12:53:26:964 SAST] 00000162 PickingManage I com.acme.services.pick.PickingManagementHttpBindingImpl submitOrder2 Method: submitOrder2
[2012/02/03 12:53:26:967 SAST] 00000162 webapp 1 com.ibm.ws.webcontainer.webapp.WebAppDispatcherContextImpl isSecurityEnabledForApplication serverSecurityEnabled
[2012/02/03 12:53:26:967 SAST] 00000162 srt 1 com.ibm.ws.webcontainer.srt.SRTServletRequest getRemoteUser (security enabled)--> user XXXX
[2012/02/03 12:53:26:968 SAST] 00000162 PickingManage I com.acme.services.pick.PickingManagementHttpBindingImpl getUsername current user is: XXXX
[2012/02/03 12:53:26:971 SAST] 00000162 channel 1 com.ibm.ws.webcontainer.channel.WCCRequestImpl getHeader header --> Axis/1.4
[2012/02/03 12:53:26:971 SAST] 00000162 srt 1 com.ibm.ws.webcontainer.srt.SRTServletRequest getHeader this->com.ibm.ws.webcontainer.srt.SRTServletRequest#14f314f3: name --> user-agent
[2012/02/03 12:53:27:564 SAST] 00000162 srt 1 com.ibm.ws.webcontainer.srt.SRTServletRequest getAttribute this->com.ibm.ws.webcontainer.srt.SRTServletRequest#28e428e4: name --> atg.parent.session.id
[2012/02/03 12:53:27:565 SAST] 00000162 SystemOut O /com/acme/order/picking/PickingService An exception occurred: java.lang.NullPointerException java.lang.NullPointerException
at com.ibm.ws.webcontainer.srt.SRTServletRequest$SRTServletRequestHelper.access$200(SRTServletRequest.java:2629)
at com.ibm.ws.webcontainer.srt.SRTServletRequest.getAttribute(SRTServletRequest.java:276)
at atg.servlet.MutableHttpServletRequest.getAttribute(MutableHttpServletRequest.java:505)
at atg.servlet.MutableHttpServletRequest.getAttribute(MutableHttpServletRequest.java:470)
at atg.servlet.NameContextManager.getNameContextId(NameContextManager.java:320)
at atg.servlet.ServletUtil.getParentSessionId(ServletUtil.java:558)
at atg.commerce.messaging.CommerceMessageImpl.<init>(CommerceMessageImpl.java:230)
at com.acme.fulfillment.PickingMessage.<init>(PickingMessage.java:5)
at com.acme.order.picking.PickingService.submitOrder(PickingService.java:128)
at com.acme.services.pick.PickingManagementHttpBindingImpl.submitOrder2(PickingManagementHttpBindingImpl.java:177)
at com.acme.services.pick.PickingManagementHttpBindingSkeleton.submitOrder2(PickingManagementHttpBindingSkeleton.java:165)
at sun.reflect.GeneratedMethodAccessor1040.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:388)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:283)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
[2012/02/03 12:53:27:566 SAST] 00000162 SystemOut O
[2012/02/03 12:53:27:571 SAST] 00000162 PickingManage E com.acme.services.pick.PickingManagementHttpBindingImpl submitOrder2 An exception occurred: java.lang.NullPointerException
java.lang.NullPointerException
at com.ibm.ws.webcontainer.srt.SRTServletRequest$SRTServletRequestHelper.access$200(SRTServletRequest.java:2629)
at com.ibm.ws.webcontainer.srt.SRTServletRequest.getAttribute(SRTServletRequest.java:276)
at atg.servlet.MutableHttpServletRequest.getAttribute(MutableHttpServletRequest.java:505)
at atg.servlet.MutableHttpServletRequest.getAttribute(MutableHttpServletRequest.java:470)
at atg.servlet.NameContextManager.getNameContextId(NameContextManager.java:320)
at atg.servlet.ServletUtil.getParentSessionId(ServletUtil.java:558)
at atg.commerce.messaging.CommerceMessageImpl.<init>(CommerceMessageImpl.java:230)
at com.acme.fulfillment.PickingMessage.<init>(PickingMessage.java:5)
at com.acme.order.picking.PickingService.submitOrder(PickingService.java:128)
at com.acme.services.pick.PickingManagementHttpBindingImpl.submitOrder2(PickingManagementHttpBindingImpl.java:177)
at com.acme.services.pick.PickingManagementHttpBindingSkeleton.submitOrder2(PickingManagementHttpBindingSkeleton.java:165)
at sun.reflect.GeneratedMethodAccessor1040.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:388)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:283)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1595)
[2012/02/03 12:53:27:586 SAST] 00000162 srt > com.ibm.ws.webcontainer.srt.SRTServletResponse setStatus ENTRY status --> 500 [com.ibm.ws.webcontainer.srt.SRTServletResponse#15651565]
[2012/02/03 12:53:27:586 SAST] 00000162 srt 1 com.ibm.ws.webcontainer.srt.SRTServletResponse getRequest request=com.ibm.ws.webcontainer.srt.SRTServletRequest#14f314f3
[2012/02/03 12:53:27:587 SAST] 00000162 srt 1 com.ibm.ws.webcontainer.srt.SRTServletRequest getWebAppDispatcherContext
So initially, the thread was happily using request #14f314f3. Then, for an unknown reason it tries to retieve the atg.parent.session.id from a different request (#28e428e4) and after it all goes wrong it returns to the original request (#14f314f3).
When this exception occurs, it will, almost always, repeat itself until the instance on which the EAR is deployed is restarted. It seems as if there is some stale data on the request and it gets held on to in some way but I am unable to track this down.
The scope of the PickingService component is 'global' but it appears to be threadsafe. The PickingMessage extension of CommerceMessageImpl is overriding a method that has no impact on the request.
Is there any way for me to work out why/how the request suddenly changes? This problem doesn't happen consistently on all instances nor for all requests. It is however causing a problem within our production environment. Any help appreciated.

Related

Server-side Blazor loses authentication state occassionally

I'm working on an server-side Blazor application which supports the "normal" build-in Identity login as well as AzureAD authentication (where the authenticated user is then mapped to a local one).
The authentication and authorization themselves work fine.
Logged in via build-in Identity I get an authentication cookie.
Logged in via AzureAD I get the Azure cookies and the Identity cookie:
Authentication cookies
But occassionally the applications seems to hang, all cookies are removed and the authentication state is gone. I've got logged out. And I have no idea why this happens.
The DevTools console then shows:
blazor.server.js:1 [2020-05-14T19:46:43.201Z] Information: Normalizing '_blazor' to 'https://wwwxxx/xxx/_blazor'.
blazor.server.js:1 [2020-05-14T19:56:56.047Z] Warning: Timeout from HTTP request.
blazor.server.js:1 GET https://wwwxxx/xxx/_blazor?id=cV_9FcIQ1C1raoggiSYzVg&_=1589486216048 404
blazor.server.js:1 [2020-05-14T19:56:56.559Z] Error: Connection disconnected with error 'Error'.
blazor.server.js:1 [2020-05-14T19:56:59.565Z] Information: Normalizing '_blazor' to 'https://wwwxxx/xxx/_blazor'.
Startup.cs looks as follows:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection")));
services.AddDefaultIdentity<AppUser>(options =>
{
options.SignIn.RequireConfirmedAccount = true;
options.User.RequireUniqueEmail = true;
})
.AddRoles<IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.AddHttpContextAccessor();
services.AddRazorPages().AddRazorPagesOptions(options =>
{
options.Conventions.AuthorizeFolder("/");
}).AddMvcOptions(options =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
options.Filters.Add(new AuthorizeFilter(policy));
}); ;
services.AddServerSideBlazor();
services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<AppUser>>();
services.AddAuthentication()
.AddAzureAD(options => Configuration.Bind("AzureAd", options));
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
//Localization
app.UseRequestLocalization(app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>().Value);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
}
Does anyone know this problem? Any suggestions?
Thank you in advance!
Update:
It seems that the WebSocket connection breaks... I don't know why:
Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher: Debug: Received hub invocation: InvocationMessage { InvocationId: "", Target: "EndInvokeJSFromDotNet", Arguments: [ 1230, True, [1230,true,null] ], StreamIds: [ ] }.
Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher: Trace: InvocationId (null): Sending result of type 'System.Void'.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 2919 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 2919 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 23565 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 238 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 196 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 178 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 279 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 279 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 279 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 279 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 174 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 543 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 174 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 543 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 174 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 543 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 543 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 104 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 104 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 104 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 104 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 104 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 104 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 104 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 104 bytes.
Exception thrown: 'Microsoft.AspNetCore.Connections.ConnectionResetException' in Microsoft.AspNetCore.Server.IIS.dll
Exception thrown: 'Microsoft.AspNetCore.Connections.ConnectionResetException' in System.Private.CoreLib.dll
Exception thrown: 'Microsoft.AspNetCore.Connections.ConnectionResetException' in System.Private.CoreLib.dll
Exception thrown: 'Microsoft.AspNetCore.Connections.ConnectionResetException' in System.Private.CoreLib.dll
Exception thrown: 'Microsoft.AspNetCore.Connections.ConnectionResetException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.WebSockets.WebSocketException' in System.Net.WebSockets.dll
Exception thrown: 'System.Net.WebSockets.WebSocketException' in System.Private.CoreLib.dll
'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Diagnostics.StackTrace.dll'.
'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Reflection.Metadata.dll'.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Debug: Socket connection closed prematurely.
System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
---> Microsoft.AspNetCore.Connections.ConnectionResetException: The client has disconnected
---> System.Runtime.InteropServices.COMException (0x800704CD): Es wurde versucht, auf eine nicht vorhandene Netzwerkverbindung zuzugreifen. (0x800704CD)
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Server.IIS.Core.IO.AsyncIOOperation.GetResult(Int16 token)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.ReadBody()
at System.IO.Pipelines.PipeCompletion.ThrowLatchedException()
at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)
at System.IO.Pipelines.Pipe.GetReadAsyncResult()
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.ReadAsync(Memory`1 memory, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.IIS.Core.HttpRequestStream.ReadAsyncInternal(Memory`1 buffer, CancellationToken cancellationToken)
at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken, Boolean throwOnPrematureClosure)
at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TWebSocketReceiveResultGetter,TWebSocketReceiveResult](Memory`1 payloadBuffer, CancellationToken cancellationToken, TWebSocketReceiveResultGetter resultGetter)
at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TWebSocketReceiveResultGetter,TWebSocketReceiveResult](Memory`1 payloadBuffer, CancellationToken cancellationToken, TWebSocketReceiveResultGetter resultGetter)
at Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsServerTransport.StartReceiving(WebSocket socket)
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Debug: Waiting for the application to finish sending data.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Debug: Socket closed.
Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext: Trace: Disposing connection 8FE-SmJEB1D0RUWx8dXjLA.
Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext: Trace: Waiting for application to complete.
Microsoft.AspNetCore.SignalR.HubConnectionHandler: Debug: OnConnectedAsync ending.
Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext: Trace: Application complete.
Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionManager: Debug: Removing connection qSMJEL5tNU3rTLk5nrX_xw from the list of connections.
Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionManager: Debug: New connection es3QXXbAgihjUVXi211hVw created.
Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionDispatcher: Debug: Sending negotiation response.
Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionDispatcher: Debug: Establishing new connection.
Microsoft.AspNetCore.SignalR.HubConnectionHandler: Debug: OnConnectedAsync started.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Debug: Socket opened using Sub-Protocol: '(null)'.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Message received. Type: Text, size: 38, EndOfMessage: True.
Microsoft.AspNetCore.SignalR.Internal.DefaultHubProtocolResolver: Debug: Found protocol implementation for requested protocol: blazorpack.
Microsoft.AspNetCore.SignalR.HubConnectionContext: Debug: Completed connection handshake. Using HubProtocol 'blazorpack'.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 3 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Message received. Type: Binary, size: 245, EndOfMessage: True.
Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher: Debug: Received hub invocation: InvocationMessage { InvocationId: "0", Target: "ConnectCircuit", Arguments: [ CfDJ8Hy6nGrT4bRAtvHZDDv3QE4idYpgvocWjooUF0ypIU4d2QFQXnLVnBfBIzseKV-LRhC60wxVjdqZkcUdFGKUASZUiIU4a5mWs2TYam17ichgx6gxoM5ueM7_v9JuiXbr91zEbuiw0MHdHeCb6U_QPCA_36siQCR0h3BfgEwTdqEjdB0PwG7CROaiqdapc-obGR9-vIeRtB0GjsLrNSJy2N0 ], StreamIds: [ ] }.
Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Private.CoreLib.dll
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 18869 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 2919 bytes.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Trace: Sending payload: 48272 bytes.
Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher: Trace: InvocationId 0: Sending result of type 'System.Boolean'.

SONOS SMAPI playback URI fails

We're having trouble with playback for our SMAPI implementation. When try to play a track the transport immediately returns to pause, as if the track was 0 seconds long. Accessing the URI of the track with cURL at our CDN returns 200 OK and the body.
:~$ curl -v -s -o /dev/null https://tracks.cdn.247e.com/thr/assets/mp4-320kbps/00/11/2E/5D56A973F81DF472E050040A2018AE3E.mp4?wxOllzkODJfur46u1oKXw1_cpUJ4534zUZFsSmBkNmQB5P18qAaiXY35793Mct
HEE_e0sTvctyB6sT4JkeA9xI5icthHfKIyZSF2p-tpn_ov8zulVWUVKWa588tHPUNlRVq5lv5uGbyyLdGz9s8-9ckwaWcl-bmEv1Dgsl-WMNYKdytTJGxWYPho-dERduu-uf6hw60kKKI&t=184451257&u=91399964&p=1739&c=247-web&s=PcEscMiBD7kj1_cz4
76yy5eVSA3KSEqfAU70cm43cIo&sid=2946359606&d=2
> GET /thr/assets/mp4-320kbps/00/11/2E/5D56A973F81DF472E050040A2018AE3E.mp4?wxOllzkODJfur46u1oKXw1_cpUJ4534zUZFsSmBkNmQB5P18qAaiXY35793MctHEE_e0sTvctyB6sT4JkeA9xI5icthHfKIyZSF2p-tpn_ov8zulVWUVKWa588tHPUNlRVq5lv5uGbyyLdGz9s8-9ckwaWcl-bmEv1Dgsl-WMNYKdytTJGxWYPho-dERduu-uf6hw60kKKI HTTP/1.1
> Host: tracks.cdn.247e.com
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Cache-Control: s-maxage=172800
< Content-Type: audio/mp4
< Date: Thu, 16 Nov 2017 10:14:54 GMT
< Last-Modified: Mon, 06 Nov 2017 20:43:56 GMT
< Server: ECAcc (lha/8D51)
< X-Cache: HIT
< Content-Length: 12341273
Here is the /status/opt/log/anacapa.trace log:
[1970-01-01 11:38:52.440] <chsrc,3> handling req while stopped: 2
[1970-01-01 11:38:52.441] <chsrc,3> recording state as 1 STOPPED (0.000000) w/ itemId = n/a [0]
[1970-01-01 11:38:52.466] <chsrc,3> handling req while stopped: 8
[1970-01-01 11:38:52.467] <chsrc,3> recording state as 1 STOPPED (0.000000) w/ itemId = n/a [0]
[1970-01-01 11:38:52.507] <chsrc,2> starting to execute the queue
[1970-01-01 11:38:52.507] <chsrc,4> resetSegmentFetchErrors
[1970-01-01 11:38:52.507] <chsrc,3> getTrackURIAndFramer() rslt 0x75a6fbc8 [f:0|u:1|m:0((null))] cld:0 [x-sonos-http:ExternalTrack%3a184451257.mp3?sid=255&flags=8224&sn=8]
[1970-01-01 11:38:52.507] <chsrc,4> resetSegmentFetchErrors
[1970-01-01 11:38:52.508] <chsrc,3> Streaming enqueued x-sonos-http:ExternalTrack%3a184451257.mp3?sid=255&flags=8224&sn=8
[1970-01-01 11:38:52.508] <chsrc,2> Start streaming mp3 track (2/2) x-sonos-http:ExternalTrack%3a184451257.mp3?sid=255&flags=8224&sn=8; origin is 41926.927777 (0 samples since)
[1970-01-01 11:38:52.508] <chsrc,3> recording state as 6 TRANSITIONING (-1.000000) w/ itemId = n/a [9]
[1970-01-01 11:38:52.508] <chsrc,2> starting at location 0 s 0 us, offset 0 (00:)
[1970-01-01 11:38:52.508] <chsrc,3> FC: allowing caching
[1970-01-01 11:38:52.989] <sonoscp,3> dereferenced to: https://tracks.cdn.247e.com/thr/assets/mp4-320kbps/00/11/2E/5D56A973F81DF472E050040A2018AE3E.mp4?wxOllzkODJfur46u1oKXw1_cpUJ4534zUZFsSmBkNmQB5P18qAaiXY35793MctHEE_e0sTvctyB6sT4JkeA9xI5icthHfKIyZSF2p-tpn_ov8zulVWUVKWa588tHPUNlRVq5lv5uGbyyLdGz9s8-9ckwaWcl-bmEv1Dgsl-WMNYKdytTJGxWYPho-dERduu-uf6hw60kKKI&t=184451257&u=91399964&p=1739&c=247-web&s=PcEscMiBD7kj1_cz476yy5eVSA3KSEqfAU70cm43cIo&sid=2946359606&d=2
[1970-01-01 11:38:52.989] <chsrc,3> oob metadata cache reset
[1970-01-01 11:38:52.989] <chsrc,3> oob metadata disabled
[1970-01-01 11:38:52.989] <chsrc,2> Downloading https://tracks.cdn.247e.com/thr/assets/mp4-320kbps/00/11/2E/5D56A973F81DF472E050040A2018AE3E.mp4?wxOllzkODJfur46u1oKXw1_cpUJ4534zUZFsSmBkNmQB5P18qAaiXY35793MctHEE_e0sTvctyB6sT4JkeA9xI5icthHfKIyZSF2p-tpn_ov8zulVWUVKWa588tHPUNlRVq5lv5uGbyyLdGz9s8-9ckwaWcl-bmEv1Dgsl-WMNYKdytTJGxWYPho-dERduu-uf6hw60kKKI&t=184451257&u=91399964&p=1739&c=247-web&s=PcEscMiBD7kj1_cz476yy5eVSA3KSEqfAU70cm43cIo&sid=2946359606&d=2
[1970-01-01 11:38:53.692] <chsrc,3> mp3: time to first byte 704
[1970-01-01 11:38:53.693] <chsrc,3> recording state as 5 PLAYING (0.000000) w/ itemId = n/a [9]
[1970-01-01 11:38:53.832] <chsrc,2> Stopped playing x-sonos-http:ExternalTrack%3a184451257.mp3?sid=255&flags=8224&sn=8
[1970-01-01 11:38:53.834] <chsrc,2> running queueCompletionRoutine
[1970-01-01 11:38:54.136] <chsrc,3> recording state as 1 STOPPED (0.000000) w/ itemId = n/a [0]
[1970-01-01 11:38:54.136] <chsrc,2> running stopRoutine
Here's the getMediaMetadata request and response as requested:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<credentials xmlns="http://www.sonos.com/Services/1.1">
<deviceId>94-9F-3E-8A-B8-2A:1</deviceId>
<deviceProvider>Sonos</deviceProvider>
<sessionId>ifEX22xaa8lUFYB0QigH7g</sessionId>
</credentials>
</s:Header>
<s:Body>
<getMediaMetadata xmlns="http://www.sonos.com/Services/1.1">
<id>ExternalTrack:181562676</id>
</getMediaMetadata>
</s:Body>
</s:Envelope>
Response:
<soap:Envelope xmlns="http://www.sonos.com/Services/1.1" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getMediaMetadataResponse xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://www.sonos.com/Services/1.1">
<getMediaMetadataResult>
<id>ExternalTrack:181562676</id>
<itemType>track</itemType>
<title>Havana (feat. Young Thug)</title>
<mimeType>audio/mp3</mimeType>
<trackMetadata>
<albumId>ExternalAlbum:181562675</albumId>
<album>Havana (feat. Young Thug)</album>
<albumArtistId>ExternalArtist:31559059</albumArtistId>
<artist>Camila Cabello</artist>
<albumArtURI>http://artwork.cdn.247e.com/covers/181562675/64x64</albumArtURI>
<canPlay>true</canPlay>
<canSkip>true</canSkip>
<canAddToFavorites>true</canAddToFavorites>
</trackMetadata>
</getMediaMetadataResult>
</getMediaMetadataResponse>
</soap:Body>
</soap:Envelope>

Mule - Connect timeout

I have a problem with setting Connection Timeout on HTTP Request Connector (not to confuse with Response Timeout) with Mule 3.7.
Configuration I'm using is not changing this arbitrary ~5 second delay between initiating connection and throwing "java.net.ConnectException: Connect timeout", even if https://docs.mulesoft.com/mule-user-guide/v/3.7/tcp-transport-reference suggests that setting connectionTimeout attribute should do the trick.
What am I missing? Is there any other way to specify this timeout? Or is this dependent on the OS?
Flow ilustrating the problem:
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:tcp="http://www.mulesoft.org/schema/mule/tcp" xmlns:tls="http://www.mulesoft.org/schema/mule/tls" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz" 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"
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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.xsd
http://www.mulesoft.org/schema/mule/tls http://www.mulesoft.org/schema/mule/tls/current/mule-tls.xsd
http://www.mulesoft.org/schema/mule/tcp http://www.mulesoft.org/schema/mule/tcp/current/mule-tcp.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<http:request-config name="HTTP_Request_Configuration" host="123.123.123.123" port="4444" doc:name="HTTP Request Configuration" responseTimeout="30000" usePersistentConnections="false" >
<tcp:client-socket-properties connectionTimeout="30000" timeout="30000"/>
</http:request-config>
<flow name="connectionTimeoutTestFlow">
<quartz:inbound-endpoint jobName="Knock" repeatInterval="60000" responseTimeout="100000" doc:name="Quartz">
<quartz:event-generator-job/>
</quartz:inbound-endpoint>
<logger message="Start Request" level="INFO" doc:name="Logger"/>
<http:request config-ref="HTTP_Request_Configuration" path="/debug/index.jsp" method="GET" doc:name="HTTP"/>
</flow>
</mule>
Output:
INFO 2016-02-10 12:53:55,736 [[connectionTimeoutTest].connectionTimeoutTestFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Start Request
ERROR 2016-02-10 12:54:01,321 [[connectionTimeoutTest].connectionTimeoutTestFlow.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Error sending HTTP request. Message payload is of type: NullPayload
Type : org.mule.api.MessagingException
Code : MULE_ERROR--2
Payload : {NullPayload}
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html
********************************************************************************
Exception stack is:
1. Connect timeout (java.net.ConnectException)
org.glassfish.grizzly.connectionpool.SingleEndpointPool$ConnectCompletionHandler:1283 (null)
2. java.net.ConnectException: Connect timeout (java.util.concurrent.ExecutionException)
org.glassfish.grizzly.impl.SafeFutureImpl$Sync:349 (null)
3. java.util.concurrent.ExecutionException: java.net.ConnectException: Connect timeout (java.io.IOException)
org.mule.module.http.internal.request.grizzly.GrizzlyHttpClient:234 (null)
4. Error sending HTTP request. Message payload is of type: NullPayload (org.mule.api.MessagingException)
org.mule.module.http.internal.request.DefaultHttpRequester:287 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
********************************************************************************
Root Exception stack trace:
java.net.ConnectException: Connect timeout
at org.glassfish.grizzly.connectionpool.SingleEndpointPool$ConnectCompletionHandler.cancelled(SingleEndpointPool.java:1283)
at org.glassfish.grizzly.impl.SafeFutureImpl.notifyCompletionHandlers(SafeFutureImpl.java:185)
at org.glassfish.grizzly.impl.SafeFutureImpl.done(SafeFutureImpl.java:277)
at org.glassfish.grizzly.impl.SafeFutureImpl$Sync.innerCancel(SafeFutureImpl.java:389)
at org.glassfish.grizzly.impl.SafeFutureImpl.cancel(SafeFutureImpl.java:247)
at org.glassfish.grizzly.connectionpool.SingleEndpointPool$ConnectTimeoutWorker.doWork(SingleEndpointPool.java:1351)
at org.glassfish.grizzly.connectionpool.SingleEndpointPool$ConnectTimeoutWorker.doWork(SingleEndpointPool.java:1343)
at org.glassfish.grizzly.utils.DelayedExecutor$DelayedRunnable.run(DelayedExecutor.java:158)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:744)
********************************************************************************
you can use a global configuration, defined at the top of your .xml, in which you specify Timeout for all your services, in example:
<configuration defaultTransactionTimeout="300000" defaultResponseTimeout="300000" doc:name="Configuration">
<default-threading-profile poolExhaustedAction="RUN"/>
</configuration>
I hope this helps.
Try to increase the http timeout in the http global config, you can do something like below:
<https:connector
name="HTTP_HTTPS"
cookieSpec="netscape"
validateConnections="false"
sendBufferSize="0"
receiveBufferSize="0"
receiveBacklog="0"
clientSoTimeout="1000"
serverSoTimeout="1000"
socketSoLinger="1000"
doc:name="HTTP-HTTPS"
socketMaxWait="1000"
connectionTimeout="1000"
keepAlive="true">

How to expose Proxy SOAP webservice in Mule with JMS queue

I have a requirement of hosting a SOAP web service and hosting a Proxy web service to that main web service...
So I have the following :-
A SOAP web service exposed to perform a CRUD operation.
A Proxy web service to that main web service
Now I have created the SOAP web service which is exposed and perform CRUD operation and it's working fine .. Now the issue is with Proxy web service .. Following is my Proxy web service config :-
<flow name="ProxyFlow" doc:name="ProxyFlow">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8086" path="proxy/mainData" doc:name="HTTP" />
<cxf:proxy-service port="MainDataPort" namespace="http://services.test.com/schema/MainData/V1" service="MainDataService" payload="body" wsdlLocation="MainData.wsdl" doc:name="SOAP"/>
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
<jms:outbound-endpoint queue="ProxyQueue" connector-ref="Active_MQ" doc:name="JMS" exchange-pattern="request-response"/>
</flow>
<flow name="ClientProxy" doc:name="ClientProxy">
<jms:inbound-endpoint connector-ref="Active_MQ" address="jms://tcp:ProxyQueue" doc:name="JMS" exchange-pattern="request-response" disableTemporaryReplyToDestinations="true" responseTimeout="90000"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<cxf:proxy-client payload="body" doc:name="SOAP" />
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="mainData" method="POST" doc:name="HTTP" />
</flow>
Now as you can see the the proxy web service is using JMS queue .. When I trigger the Proxy web service from SOAPUI ..I get the following exception :-
INFO 2014-09-11 21:16:46,475 [ActiveMQ Session Task-1] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.jms.transformers.ObjectToJMSMessage
ERROR 2014-09-11 21:16:46,483 [ActiveMQ Session Task-1] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Source was not of a supported type. Valid types are Message, String, Map, InputStream, List, byte[], Serializable or OutputHandler, but was DepthXMLStreamReader (javax.jms.JMSException)
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Source was not of a supported type. Valid types are Message, String, Map, InputStream, List, byte[], Serializable or OutputHandler, but was DepthXMLStreamReader(JMS Code: null) (javax.jms.JMSException)
org.mule.transport.jms.JmsMessageUtils:144 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/JMSException.html)
2. Source was not of a supported type. Valid types are Message, String, Map, InputStream, List, byte[], Serializable or OutputHandler, but was DepthXMLStreamReader (javax.jms.JMSException) (org.mule.api.transformer.TransformerException)
org.mule.transport.jms.transformers.AbstractJmsTransformer:79 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
javax.jms.JMSException: Source was not of a supported type. Valid types are Message, String, Map, InputStream, List, byte[], Serializable or OutputHandler, but was DepthXMLStreamReader
at org.mule.transport.jms.JmsMessageUtils.toMessage(JmsMessageUtils.java:144)
at org.mule.transport.jms.transformers.AbstractJmsTransformer.transformToMessage(AbstractJmsTransformer.java:66)
at org.mule.transport.jms.transformers.ObjectToJMSMessage.transformMessage(ObjectToJMSMessage.java:54)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
ERROR 2014-09-11 21:16:47,522 [ActiveMQ Session Task-2] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : "Message with id "ID:ANIRBAN-PC-49972-1410450386406-1:1:14:1:1" has been redelivered 1 times on endpoint "jms://tcp:ProxyQueue", which exceeds the maxRedelivery setting of 0 on the connector "Active_MQ". Message payload is of type: ActiveMQTextMessage
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. "Message with id "ID:ANIRBAN-PC-49972-1410450386406-1:1:14:1:1" has been redelivered 1 times on endpoint "jms://tcp:ProxyQueue", which exceeds the maxRedelivery setting of 0 on the connector "Active_MQ". Message payload is of type: ActiveMQTextMessage (org.mule.transport.jms.redelivery.MessageRedeliveredException)
org.mule.transport.jms.redelivery.JmsXRedeliveryHandler:81 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/transport/jms/redelivery/MessageRedeliveredException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.transport.jms.redelivery.MessageRedeliveredException: "Message with id "ID:ANIRBAN-PC-49972-1410450386406-1:1:14:1:1" has been redelivered 1 times on endpoint "jms://tcp:ProxyQueue", which exceeds the maxRedelivery setting of 0 on the connector "Active_MQ". Message payload is of type: ActiveMQTextMessage
at org.mule.transport.jms.redelivery.JmsXRedeliveryHandler.handleRedelivery(JmsXRedeliveryHandler.java:81)
at org.mule.transport.jms.MultiConsumerJmsMessageReceiver$JmsWorker.preProcessMessage(MultiConsumerJmsMessageReceiver.java:512)
at org.mule.transport.AbstractReceiverWorker$1$1.process(AbstractReceiverWorker.java:117)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
WARN 2014-09-11 21:16:56,369 [[Dummysimpleclientwebservice].connector.http.mule.default.receiver.03] org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://services.vertu.com/schema/MainData/V1}MainDataService has thrown exception, unwinding now
java.lang.NullPointerException
at org.apache.cxf.databinding.stax.StaxDataBinding$XMLStreamDataWriter.write(StaxDataBinding.java:147)
at org.apache.cxf.databinding.stax.StaxDataBinding$XMLStreamDataWriter.write(StaxDataBinding.java:135)
at org.apache.cxf.databinding.stax.StaxDataBinding$XMLStreamDataWriter.write(StaxDataBinding.java:131)
at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:119)
at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:232)
at org.mule.module.cxf.CxfInboundMessageProcessor$1.write(CxfInboundMessageProcessor.java:426)
at org.mule.transport.http.HttpServerConnection.writeResponse(HttpServerConnection.java:353)
at org.mule.transport.http.HttpMessageProcessTemplate.sendResponseToClient(HttpMessageProcessTemplate.java:137)
at org.mule.execution.FlowProcessingPhase.sendResponseIfNeccessary(FlowProcessingPhase.java:153)
at org.mule.execution.FlowProcessingPhase.access$000(FlowProcessingPhase.java:29)
at org.mule.execution.FlowProcessingPhase$1$1.process(FlowProcessingPhase.java:78)
at org.mule.execution.FlowProcessingPhase$1$1.process(FlowProcessingPhase.java:63)
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.FlowProcessingPhase$1.run(FlowProcessingPhase.java:62)
at org.mule.transport.TrackingWorkManager$TrackeableWork.run(TrackingWorkManager.java:267)
at org.mule.work.WorkerContext.run(WorkerContext.java:286)
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)
Now I can find that the main webservice is called internally and the Data are created in DB.. But I guess it's unable to transform the response back to the Proxy client .. any suggestion ..
Try using the proxy client in the following way.
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="mainData" method="POST" doc:name="HTTP" >
<cxf:proxy-client payload="body" doc:name="SOAP" />
</http:outbound-endpoint>
<logger level="INFO" message="#[message.payloadAs(java.lang.String)]" />
The HTTP outbound is retruning the response in the format of DepthXMLStreamReader. The above format of Proxy-client should help. The logger will read the response from the StreamReader so it is in a serializable format.
Hope this helps.
I realized that the payload after the Http outbound is stream so, it need to be converted into String or else will be getting the exception.
So, the solution that worked me is :-
<logger level="INFO" message="#[message.payloadAs(java.lang.String)]" />
Alternately I realized that putting a <byte-array-to-string-transformer> will also work

How to get the SOAP request from an ActiveMQ queue and implement it in the webservice

I have a requirement in Mule in which I need to expose a SOAP web service ..
Now I am implementing it in 2 flows :-
<flow name="ServiceFlow" doc:name="ServiceFlow">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="mainData" doc:name="HTTP" />
<cxf:jaxws-service serviceClass="com.test.services.schema.maindata.v1.MainData" doc:name="SOAP" />
<object-to-string-transformer doc:name="Object to String"/>
<jms:outbound-endpoint queue="NewQueue" connector-ref="Active_MQ" doc:name="JMS"/>
</flow>
<flow name="Flow2" doc:name="Flow2" >
<jms:inbound-endpoint connector-ref="Active_MQ" address="jms://tcp:NewQueue" doc:name="JMS" exchange-pattern="request-response"/>
<component class="com.test.services.schema.maindata.v1.Impl.MainDataImpl" doc:name="JavaMain_ServiceImpl" >
<method-entry-point-resolver>
<include-entry-point method="retrieveDataOperation"/>
<include-entry-point method="insertDataOperation"/>
<include-entry-point method="updateDataOperation"/>
<include-entry-point method="deleteDataOperation"/>
</method-entry-point-resolver>
</component>
<logger level="INFO" message="payload :-#[message.payload]" doc:name="Logger"/>
</flow>
In the first flow (ServiceFlow) I am trying to send the SOAP request in an ActiveMQ queue and in second flow (Flow2) ..I am trying to consume the request in MainDataImpl class .. But I am getting an exception while consuming the request :-
Exception stack is:
1. "Message with id "ID:ANIRBAN-PC-49419-1407595657591-1:1:6:1:1" has been redelivered 1 times on endpoint "jms://tcp:NewQueue", which exceeds the maxRedelivery setting of 0 on the connector "Active_MQ". Message payload is of type: ActiveMQTextMessage (org.mule.transport.jms.redelivery.MessageRedeliveredException)
org.mule.transport.jms.redelivery.JmsXRedeliveryHandler:81 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/transport/jms/redelivery/MessageRedeliveredException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.transport.jms.redelivery.MessageRedeliveredException: "Message with id "ID:ANIRBAN-PC-49419-1407595657591-1:1:6:1:1" has been redelivered 1 times on endpoint "jms://tcp:NewQueue", which exceeds the maxRedelivery setting of 0 on the connector "Active_MQ". Message payload is of type: ActiveMQTextMessage
at org.mule.transport.jms.redelivery.JmsXRedeliveryHandler.handleRedelivery(JmsXRedeliveryHandler.java:81)
at org.mule.transport.jms.MultiConsumerJmsMessageReceiver$JmsWorker.preProcessMessage(MultiConsumerJmsMessageReceiver.java:512)
at org.mule.transport.AbstractReceiverWorker$1$1.process(AbstractReceiverWorker.java:117)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
Now I want to know how can I resolve the issue as I guess MainDataImpl is expecting the message as object type .. but there is no way to convert the String message into Object ... Any solution for the above issue ??? Please Help
UPDATE AFTER ADDING OBJECT TO XML:-
<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
<flow name="ServiceFlow" doc:name="ServiceFlow">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="mainData" doc:name="HTTP" />
<cxf:jaxws-service serviceClass="com.test.services.schema.maindata.v1.MainData" doc:name="SOAP" />
<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
<!-- <vm:outbound-endpoint exchange-pattern="request-response" path="Flow1-WT-Main" doc:name="VM"/> -->
<jms:outbound-endpoint queue="NewQueue" connector-ref="Active_MQ" doc:name="JMS"/>
</flow>
<flow name="Flow2" doc:name="Flow2" >
<!-- <vm:inbound-endpoint exchange-pattern="request-response" path="Flow1-WT-Main" doc:name="VM"/> -->
<jms:inbound-endpoint connector-ref="Active_MQ" address="jms://tcp:NewQueue" doc:name="JMS" exchange-pattern="request-response"/>
<mulexml:xml-to-object-transformer doc:name="XML to Object"/>
<async doc:name="Async">
<logger message="Payload :-#[message.payload]" level="INFO" doc:name="Logger"/>
</async>
<component class="com.test.services.schema.maindata.v1.Impl.MainDataImpl" doc:name="JavaMain_ServiceImpl" >
<method-entry-point-resolver>
<include-entry-point method="retrieveDataOperation"/>
<include-entry-point method="insertDataOperation"/>
<include-entry-point method="updateDataOperation"/>
<include-entry-point method="deleteDataOperation"/>
</method-entry-point-resolver>
</component>
<logger level="INFO" message="ccccccc :-#[message.payload]" doc:name="Logger"/>
</flow>
Now the exception is :-
INFO 2014-08-09 21:10:33,426 [ActiveMQ Session Task-1] org.mule.api.processor.LoggerMessageProcessor: ccccccc :-com.test.services.schema.maindata.v1.DataResponse#1ca5a88a
INFO 2014-08-09 21:10:33,426 [[Dummysimpleclientwebservice].Flow2.1.02] org.mule.api.processor.LoggerMessageProcessor: Payload :-com.test.services.schema.maindata.v1.DataRequest#3fdc0ab7
ERROR 2014-08-09 21:10:33,433 [ActiveMQ Session Task-1] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Source was not of a supported type. Valid types are Message, String, Map, InputStream, List, byte[], Serializable or OutputHandler, but was DataResponse (javax.jms.JMSException)
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Source was not of a supported type. Valid types are Message, String, Map, InputStream, List, byte[], Serializable or OutputHandler, but was DataResponse(JMS Code: null) (javax.jms.JMSException)
org.mule.transport.jms.JmsMessageUtils:144 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/JMSException.html)
2. Source was not of a supported type. Valid types are Message, String, Map, InputStream, List, byte[], Serializable or OutputHandler, but was DataResponse (javax.jms.JMSException) (org.mule.api.transformer.TransformerException)
org.mule.transport.jms.transformers.AbstractJmsTransformer:79 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
javax.jms.JMSException: Source was not of a supported type. Valid types are Message, String, Map, InputStream, List, byte[], Serializable or OutputHandler, but was DataResponse
at org.mule.transport.jms.JmsMessageUtils.toMessage(JmsMessageUtils.java:144)
at org.mule.transport.jms.transformers.AbstractJmsTransformer.transformToMessage(AbstractJmsTransformer.java:66)
at org.mule.transport.jms.transformers.ObjectToJMSMessage.transformMessage(ObjectToJMSMessage.java:54)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
ERROR 2014-08-09 21:10:34,488 [ActiveMQ Session Task-2] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : "Message with id "ID:ANIRBAN-PC-49768-1407598818233-1:1:6:1:1" has been redelivered 1 times on endpoint "jms://tcp:NewQueue", which exceeds the maxRedelivery setting of 0 on the connector "Active_MQ". Message payload is of type: ActiveMQTextMessage
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. "Message with id "ID:ANIRBAN-PC-49768-1407598818233-1:1:6:1:1" has been redelivered 1 times on endpoint "jms://tcp:NewQueue", which exceeds the maxRedelivery setting of 0 on the connector "Active_MQ". Message payload is of type: ActiveMQTextMessage (org.mule.transport.jms.redelivery.MessageRedeliveredException)
org.mule.transport.jms.redelivery.JmsXRedeliveryHandler:81 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/transport/jms/redelivery/MessageRedeliveredException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.transport.jms.redelivery.MessageRedeliveredException: "Message with id "ID:ANIRBAN-PC-49768-1407598818233-1:1:6:1:1" has been redelivered 1 times on endpoint "jms://tcp:NewQueue", which exceeds the maxRedelivery setting of 0 on the connector "Active_MQ". Message payload is of type: ActiveMQTextMessage
at org.mule.transport.jms.redelivery.JmsXRedeliveryHandler.handleRedelivery(JmsXRedeliveryHandler.java:81)
at org.mule.transport.jms.MultiConsumerJmsMessageReceiver$JmsWorker.preProcessMessage(MultiConsumerJmsMessageReceiver.java:512)
at org.mule.transport.AbstractReceiverWorker$1$1.process(AbstractReceiverWorker.java:117)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
As you guessed it, the problem is that you serialize the inbound message object to a String with object-to-string-transformer and, via a JMS queue, try to feed it to the MainDataImpl object, which takes objects as input parameters for its different operations.
The solution is to simply serialize the inbound object to XML, send it via JMS then deserialize it back to an object.
For this replace the object-to-string-transformer with an object-to-xml-transformer and add a xml-to-object-transformer right after the jms:inbound-endpoint.
EDIT
I didn't realize you're using NewQueue in request-response fashion, because you actually inconsistently declare it. On the jms:outbound-endpoint you do not provide an exchange-pattern which makes it one-way by default ; while on the jms:inbound-endpoint your set the exchange-pattern to request-response, which triggers the execution of the response phase of Flow2.
So: be consistent, use the same exchange-pattern on both JMS endpoints or, even better, declare a global JMS endpoint with the right exchange-pattern and ref-it from the jms:inbound and outbound endpoints.
If you decide to stay with request-response, then you need to do the same for the response, ie. serialize the result of calling MainDataImpl (a DataResponse object) back to XML and in ServiceFlow deserialize it back to object.
So, the working solution is (as per David's suggestion)
1. Need to add <mulexml:object-to-xml-transformer doc:name="Object to XML"/> before JMS outbound and <mulexml:xml-to-object-transformer doc:name="XML to Object"/> after JMS inbound
2. Need to use the same exchange-pattern on both JMS endpoints