camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karts <kartiksan...@gmail.com>
Subject Stream Cache / spool file deletion when marshaling to JSON with Jackson
Date Tue, 21 Jul 2015 19:50:28 GMT
Hi,

We're using Camel 2.15.2/Rest DSL/Restlet deployed as a war in a Jetty 9
container. Stream caching is enabled.

For one of our routes, we retrieve and transform XML to an
ArrayList<Map&lt;String, String>> and then marshal to JSON. A cleaned up
sample route is as follows:

public void configure() throws Exception {
rest("data")
	.get("json-arraylist")
	.route()
	.policy("user")
	.to("bean:dapRequest") //body is retrieved xml
	.to("file:logs/xml?fileName=${header.breadcrumbId}-reply.xml")
	.bean(Translator.class, "getListMap") //converts to
ArrayList<Map&lt;String, String>> 
	.marshal().json(JsonLibrary.Jackson);
}

For larger XMLs (~400kb on disk) , we're getting the stack below:

java.io.FileNotFoundException:
/tmp/camel/camel-tmp-c47151eb-854b-4f5c-bcff-752d2a81a30b/cos4570286139547325900.tmp
(No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:146)
        at
org.apache.camel.converter.stream.FileInputStreamCache.createInputStream(FileInputStreamCache.java:133)
        at
org.apache.camel.converter.stream.FileInputStreamCache.getInputStream(FileInputStreamCache.java:127)
        at
org.apache.camel.converter.stream.FileInputStreamCache.read(FileInputStreamCache.java:122)
        at java.io.InputStream.read(InputStream.java:170)
        at java.io.InputStream.read(InputStream.java:101)
        at org.restlet.engine.io.IoUtils.copy(IoUtils.java:106)
        at
org.restlet.representation.InputRepresentation.write(InputRepresentation.java:148)
        at
org.restlet.engine.adapter.ServerCall.writeResponseBody(ServerCall.java:519)
        at
org.restlet.engine.adapter.ServerCall.sendResponse(ServerCall.java:463)
        at
org.restlet.ext.servlet.internal.ServletCall.sendResponse(ServletCall.java:430)
        at
org.restlet.engine.adapter.ServerAdapter.commit(ServerAdapter.java:196)
        at
org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:153)
        at
org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
        at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at
org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
        at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
        at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
        at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
        at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
        at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
        at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
        at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
        at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
        at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
        at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
        at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
        at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
        at org.eclipse.jetty.server.Server.handle(Server.java:497)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
        at
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
        at
org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
        at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
        at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
        at java.lang.Thread.run(Thread.java:744)

If we remove .marshal().json(JsonLibrary.Jackson) , no such exception is
thrown.

As a workaround for now, we have disabled the spool file with:
<properties>
    	<property key="CamelCachedOutputStreamThreshold" value="-1"/>
</properties>

We would like to use this though as we may get much larger XML files upwards
of 10 MB.

Can anyone advise on the exception?

Thanks




--
View this message in context: http://camel.465427.n5.nabble.com/Stream-Cache-spool-file-deletion-when-marshaling-to-JSON-with-Jackson-tp5769699.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message