serialization,spring-integration , Serialization error using a jdbc-message-channel


Serialization error using a jdbc-message-channel

Question:

Tag: serialization,spring-integration

I'm using a channel backed by a jdbc-message-store but I'm having a serialization error when storing the message. The message payload is a simple String.

Here's my config and stacktrace:

<bean id="auditMessageStoreQueryProviderBean" class="org.springframework.integration.jdbc.store.channel.MySqlChannelMessageStoreQueryProvider" />

    <bean id="auditMessageStore" class="org.springframework.integration.jdbc.store.JdbcChannelMessageStore">
        <property name="dataSource" ref="auditMessageStoreDataSource" />
        <property name="channelMessageStoreQueryProvider" ref="auditMessageStoreQueryProviderBean" />
        <property name="region" value="auditmessages" />
    </bean>

    <bean id="auditMessageStoreDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="dataSourceName" value="AuditMessageStoreDataSource" />
        <property name="driverClass" value="com.mysql.jdbc.Driver" />
        <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/audit_message_store" />
        <property name="user" value="..." />
        <property name="password" value="..." />
        <property name="initialPoolSize" value="10" />
        <property name="minPoolSize" value="10" />
        <property name="maxPoolSize" value="20" />
        <property name="maxStatements" value="10" />
        <property name="maxIdleTime" value="120000" />
        <property name="testConnectionOnCheckout" value="true" />
        <property name="preferredTestQuery" value="select * from INT_CHANNEL_MESSAGE limit 1" />
        <property name="acquireRetryAttempts" value="5"/>
        <property name="acquireRetryDelay" value="1000"/>
    </bean>

Here's the stacktrace:

2015-06-10 21:35:54,911 [email protected] ERROR LoggingHandler:145 - org.springframework.messaging.MessageDeliveryException: failed to send Message to channel 'auditRequestMessagesChannel'; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: sun.nio.cs.ext.Big5
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:305)
    at org.springframework.integration.channel.interceptor.WireTap.preSend(WireTap.java:129)
    at org.springframework.integration.channel.AbstractMessageChannel$ChannelInterceptorList.preSend(AbstractMessageChannel.java:382)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:281)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:245)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
    at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:95)
    at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:231)
    at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:154)
    at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:102)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:105)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
    at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:101)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:286)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:150)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:45)
    at org.springframework.messaging.core.AbstractMessagingTemplate.sendAndReceive(AbstractMessagingTemplate.java:42)
    at org.springframework.integration.gateway.MessagingGatewaySupport.doSendAndReceive(MessagingGatewaySupport.java:331)
    at org.springframework.integration.gateway.MessagingGatewaySupport.sendAndReceiveMessage(MessagingGatewaySupport.java:302)
    at org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupport.actualDoHandleRequest(HttpRequestHandlingEndpointSupport.java:492)
    at org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupport.doHandleRequest(HttpRequestHandlingEndpointSupport.java:389)
    at org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway.handleRequest(HttpRequestHandlingMessagingGateway.java:103)
    at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:168)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:213)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: sun.nio.cs.ext.Big5
    at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:67)
    at org.springframework.integration.jdbc.store.JdbcChannelMessageStore.addMessageToGroup(JdbcChannelMessageStore.java:420)
    at org.springframework.integration.store.MessageGroupQueue.doOffer(MessageGroupQueue.java:329)
    at org.springframework.integration.store.MessageGroupQueue.offer(MessageGroupQueue.java:229)
    at org.springframework.integration.store.MessageGroupQueue.offer(MessageGroupQueue.java:48)
    at org.springframework.integration.channel.QueueChannel.doSend(QueueChannel.java:90)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:286)
    ... 79 more
Caused by: java.io.NotSerializableException: sun.nio.cs.ext.Big5
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
    at java.util.ArrayList.writeObject(ArrayList.java:742)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
    at java.util.HashMap.writeObject(HashMap.java:1133)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
    at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:440)
    at org.springframework.messaging.MessageHeaders.writeObject(MessageHeaders.java:284)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
    at org.springframework.core.serializer.DefaultSerializer.serialize(DefaultSerializer.java:44)
    at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:62)
    ... 85 more

Answer:

Spring Messaging (and hence Spring Integration) only looks at top level header values for non-serializable headers (and removes them before serializing - which means such headers are lost).

for (Map.Entry<String, Object> entry : this.headers.entrySet()) {
    if (!(entry.getValue() instanceof Serializable)) {
        keysToRemove.add(entry.getKey());
    }
}

Scanning the entire header tree (i.e. examine every element of a header that's a container of some kind and its child elements) would be prohibitively expensive.

In this case, you have a header containing a sun.nio.cs.ext.Big5 in an ArrayList which itself is in a header that has a HashMap in its value. (See the stack trace to follow the serialization call stack).

Big5 is a subclass of Charset and it's not Serializable.

You need to figure out which header has the offending object and remove it (perhaps with a <header-filter/>) prior to sending the message to the channel.

Alternatively, figure out who is creating the header and tell him not to.


Related:


spring integration vs spring batch [on hold]


spring-batch,spring-integration
We have application where we are receiving file every day and it needs to be parsed and persist in db. File has 5000 record. Should we use spring batch or spring integration? And why? we do need to skip bad record and audit them....

Is there any workaround for using channel name with dash character using spring integration 4 without xml?


spring-integration
I upgraded my spring integration 3.x to 4.x. And I removed all xml configuration and replace to java annotation in pojo files. But the problem is.. I want to use the channel name with '-' character. It is very good to recognize and distinguish each words in name. Besides, if...

Serialize/Deserialize class containing byte array property into XML


c#,.net,xml,serialization,.net-4.0
My data class that will be serialized into XML look like this: [XmlType(TypeName = "SPCFileInfo")] [Serializable] public class SPCFileInfoProtocol { [XmlElement("CompanyCode")] public string CompanyCode { get; set; } [XmlElement("FileName")] public string FileName { get; set; } [XmlElement("FileVer")] public int FileVer { get; set; } [XmlElement("FileSize")] public long FileSize { get;...

Prevent GSON from serializing JSON string


java,json,serialization,gson
I'm new to gson, and have newby question which I have not found an answer to, so please bear with me. StackOverflow and google were not my friend :( I have a java class "User", and one of its properties, "externalProfile" is a Java String containing already serialized JSON. When...

Save GoogleApiClient on Activity restart in Bundle


android,serialization,parcelable,google-cast
My application has a function of theme change (i.e. Activity is restarting). Is it possible to save somehow GoogleApiClient with its all callbacks state and parameters into Bundle in onSaveInstanceState() so that I don't need to rebuild it every time? I'm using Google Cast Api Client (for Chromecast devices). mApiClient...

What elements does jQuery serialize affect?


jquery,serialization
I'm digging through the jquery production file and it doesn't seem that there's a definitive list of elements jquery will serialize. IE how does it know to serialize inputs and selects? I am curious because I have a common function to serialize my forms, that first does some checkbox value...

Performance degradation of fast-serialization


java,performance,serialization
This question is particular to the Fast-Serialization library. https://github.com/RuedigerMoeller/fast-serialization I am using FSTLongOffheapMap (version 2.29) on windows 7, jdk 1.7 to store some objects. I tested the latency of storing an object and the 99.99 percentile comes to about 100 micros. This is excellent considering I ran it on windows...

TypeError: object is not JSON serializable in DJango 1.8 Python 3.4


python,json,django,python-3.x,serialization
I'm using DJango 1.8 and Python 3.4 When the below view is being ran, Django throws Type Error - Object is not JSON Serializable Views.py from django.http import HttpRequest,HttpResponse from django.http import JsonResponse from json import dumps def get_stats(request): if request.method == "POST": srch_dropV = request.POST['srch_dropAJ'] else: srch_dropV = ''...

Failure to remove a file using an outbound-gateway


spring-integration,jsch
Im trying to use an sftp outbound gateway to delete a specific log file on a remote sftp. <int-sftp:outbound-gateway id="removeSourceGateway" session-factory="sftpCachingSessionFactory" reply-channel="outputChannel" request-channel="afterSuccessBackupChannel" requires-reply="false" command="ls" expression="'/export/logs/'" remote-directory="${sftp.remote.dir}"> </int-sftp:outbound-gateway> If I execute a LS or PUT command in the configuration above, then I get the expected content - see below for...

How can I create a txt file that holds the contents of an array in JavaScript?


node.js,matlab,serialization,ar.drone
I have several arrays that contain data that I would like to export, each array to a txt file, in order to be analyzed using MATLAB. Let's say my array is: var xPosition = []; // some algorithm that adds content to xPosition // TODO: export array into a txt...

Error during deserializing XML


c#,xml,serialization,deserialization
Class that I am serializing: public class StyleProperties { [XmlAttribute] public string Name; [XmlAttribute] public string Description; [XmlAttribute] public StyleType Type; public ShapeStyleProperties ShapeStyle; public TextStyleProperties TextStyle; } Part that is responsible for serializing data: XmlSerializer serializer = new XmlSerializer(typeof(StyleProperties)); PPT.Presentation pres = Globals.ThisAddIn.Application.ActivePresentation; CustomXMLParts parts = pres.CustomXMLParts; //var serializer...

spring integration java dsl: how to expand a uri-variable in a Simp destination header


spring-integration
I use a mix of spring-mvc websocket support and spring-integration java dsl. I have an integration flow responsible to send messages to websocket-stomp subscribers using AbstractBrokerMessageHandler. The destination is /topic/notifications/{tenantId} where tenantId is a member of the payload I want to send to subscribers. In spring-integration xml dsl uri-variable subElement....

Why do I need to specify an xml namespace when I do serialization?


c#,asp.net,.net,wcf,serialization
I do not quite understand the reason why I need to specify an xml namespace for an object when I serialize the object to the wire. By default, the xml namespace for this object will be the CLR namespace of this object, this is enough for us to differentiate two...

Partial deserialization of a huge binary file - Java


java,serialization
This is my first question to StackOverflow. Please let me know if the question is not clear and need any more details. I have a class which has three attributes like this: class SampleClass { long [] field1; float[] field2; float[] field3; } A huge SampleClass object is built(with about...

Invalid cast when passing serializable object to activity


java,android,serialization
I have a complex object (which includes further objects and hashmaps). All objects implement Serializable. In the first activity I do: public void secondActivity(MyObject o) { Intent intent = new Intent(this, SecondActivity.class); intent.putExtra("myobject", o); startActivity(intent); finish(); } Then, in the second activity I'm doing: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);...

Which bean can I use as a alternative one of http-outbound-gateway?


spring-integration
I am changing spring-integration 3.x to 4.x. And I should change every xml configuration to the java file. But, I can't find the bean that can be replaced in place of the followings. <int-http:outbound-gateway url="http://www.google.com/ig/api?weather={city}" http-method="GET" expected-response-type="java.lang.String" request-factory="requestFactory" request-channel="requestChannel" reply-channel="replyChannel"> <int-http:uri-variable name="city" expression="payload"/> </int-http:outbound-gateway> <bean...

deserialize a list of Guid c#


c#,list,serialization,guid
Can anyone help me to deserialize this xml file into a list of Guid ? <?xml version="1.0" encoding="UTF-8"?> <content> <0>124179e5-82b9-c551-1e88-515ec3bbe4e3</0> <1>5c8246d3-5b9f-16bb-89dc-515ec4674170</1> <2>9d7f4701-81e3-3c90-c743-515ec9580852</2> <3>ea8d97bd-243b-b917-bc15-51764c2b2f34</3> </content> Thanks in advance....

Jersey serializing null values to json : How to skip


java,json,spring,serialization,jersey-2.0
I am using Jersey 2.4 with spring. When I am returning a response from a method with an annotation @Produces(MediaType.APPLICATION_JSON) on it, it also serialize the null values to json. I don't want to serialize the fields that contains the null values. Is there any solution for the same?...

Deserializing Json data to c# for use in GridView - Error Data source is an invalid type


c#,json,gridview,serialization,.net-4.5
I am relatively new to working with C# (v5.0) and Json data (Newtonsoft.Json v6.0) and am seeking assistance in resolving an error when attempting to populate a .Net 4.5 GridView control. My sample Json data as returned by a web service is: { PersonDetails: [ { Book: "10 ", FirstName:...

C# Protobuf .NET Using Preexisting Byte Array


c#,networking,serialization,protobuf-net,objectpool
So I am working with Protobufs in .NET and I am trying to incorporate them with a buffer pool and AsyncSocketEventArgs pool. The buffer pool assigns sections of a huge byte array to the event args. So, the problem, I can't figure out a way to have Protobufs serialize directly...

Need help to understand deserialization with ArrayList in Java


java,serialization,arraylist,casting,deserialization
I want write an ArrayList to a file and then read it back again. The list is going to hold Integer objects. Serialization seems to be working fine but I'm having trouble deserilaizing. More specifically I can'get the casting right. The serialization: ObjectOutputStream ou = new ObjectOutputStream(new FileOutputStream(new File("load.dat"))); ArrayList<Integer>...

Getting Class cast exception after upgrading Spring Integration version


java,spring,spring-integration
I have a Spring Integration Application which polls for data from AS400 DB picks it and then after some modification transmit it to MQ. It was running fine until I decided to upgrade Spring Integration version. I am getting below error after upgrading from version - spring-integration-core-2.2.3.RELEASE to spring-integration-core-3.0.1.RELEASE. Caused...

Spring Integration, change udp-outbound-channel port


java,spring,spring-integration
I'm using spring integration to send line of files in UDP. Here is what I'm doing: <int-file:inbound-channel-adapter prevent-duplicates="false" id="filesIn" directory="file:input" channel="inputFiles"> <int:poller default="true" fixed-rate="1000" /> </int-file:inbound-channel-adapter> <int:splitter input-channel="inputFiles" output-channel="output"> <bean class="fr.spring.demo.FileSplitter"> <property name="commentPrefix" value="#" /> </bean> </int:splitter> <int:transformer...

Serialize byte array in JSON.NET without $type


c#,json,serialization,json.net
I would like to serialize all my contract with $type reference using TypeNameHandling.Objects. However when using this flag, all byte arrays (byte[]) are serialized using $value+$type. I still want Base64 encoding but without $type. For example, for the following contract: class MyClass { public byte[] MyBinaryProperty {get;set;} } I get:...

How to catch socket exceptions on TcpInboundGateway?


java,spring,sockets,spring-integration
I'm using TcpInboundGateway from spring-integration for a socket client. In TcpInboundGateway.doOnMessage() the stream is send via the socket connection. If an exception occurs eg because the socket is closed, there is just a spring error log "Failed to send reply". BUT I'd like to handle those socket errors explicit. How...

WCF singleton service with multiple endpoints?


wcf,serialization,singleton,wcf-endpoint
I have a singleton wcf service (InstanceContextMode.Single) i.e MyService with multiple endpoints namely netmsmq and http. The call to netmsmq works fine but when I call it as : Binding bin = new BasicHttpBinding(); EndpointAddress end = new EndpointAddress("http://localhost/WcfService1/MyService.svc"); var obje = new ChannelFactory<IMyService>(bin, end); obje.Open(); var factory = obje.CreateChannel();...

Spring integration Splitter task execution


java,spring-integration,splitter
I'm working on a Spring Integration application. I have an inbound channel adapter that read a directory Then a splitter that split the File into lines Finally an udp outbound channel adapter that sends the lines <int-file:inbound-channel-adapter prevent-duplicates="false" id="filesIn" directory="file:input" channel="inputFiles" /> <int:splitter input-channel="inputFiles" output-channel="udpChannel_11111" expression="T(org.apache.commons.io.FileUtils).lineIterator(payload)" /> <!-- Define UDP...

Spring-integration scripting with Python


python,spring-integration,jython
I'm trying to use Python with spring-integration and jython-standalone-2.7.0: Here is my application context: <int:inbound-channel-adapter id="in" channel="exampleChannel" > <int:poller fixed-rate="1000" /> <int-script:script lang="python" location="script/message.py" /> </int:inbound-channel-adapter> <int:channel id="exampleChannel" /> <int-ip:udp-outbound-channel-adapter id="udpOut" channel="exampleChannel" host="192.168.0.1" port="11111" /> Here is my script in Python: print "Python"...

Serialize data-attributes


jquery,arrays,serialization,multidimensional-array
I have a drag and drop system, and each dropped item receives three data-attributes. data-id data-order data-content Now I should put these attributes into a multidimensional array. It should look like this: data-order = "0" [data-id = "1", data-content = "blabla"]; data-order = "1" [data-id = "2", data-content = "another...

how should a message look like to be a response


java,tcp,spring-integration
I have read and followed the example in http://docs.spring.io/spring-integration/reference/html/ip.html#ip-correlation I have a spring-integration server <int-ip:tcp-connection-factory id="socketserver" type="server" port="30124" using-nio="true" mapper="mapper" deserializer="jsonSerializer" serializer="jsonSerializer" single-use="false"/> with this mapper from above link: <bean id="mapper" class="org.springframework.integration.ip.tcp.connection.MessageConvertingTcpMessageMapper"> <constructor-arg...

Send Mail using Spring MVC


spring,spring-mvc,spring-integration
I have a custom MailDto object in which I set the to,cc, bCc field and send it using RestTemplate to Spring MVC controller as below @RequestMapping(value = "/SendMail" ) public ResponseEntity<String> SendMail( @RequestBody MailMessageDto mailDto) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException From the controller I invoke the Gateway (Spring integration). The...

Spring integration FileTailingMessageProducer: Remember current line when restarting


java,spring,spring-integration
We are using the Spring integration FileTailingMessageProducer (Apache Commons) for remotely tailing files and sending messages to rabbitmq. Obviously when the java process that contains the file tailer is restarted, the information which lines have already been processed is lost. We would like to be able to restart the process...

Python: Serializing/de-serializing huge amount of data


python,serialization
I have a (very large) dataset. Something in the order of 250,000 binary vectors, each of size 800. The dataset resides in a (.txt ascii coding) file, in 'compressed representation'. Meaning, every line in that file represents how a vector looks, rather than 800 characters of zeroes and ones. For...

Which Spring Integration Channel should be used for MQTT


spring-integration,mqtt
I am trying a demo app where we send commands over a UI which then goes through spring integration to deliver a command to a device and gives a command status back to UI, this is my first time using Spring Integration and am a bit unsure of the various...

reconstruct python method with kwargs with marshal and types?


python,serialization,deserialization,marshalling,unmarshalling
I am using the marshal module to serialize some Python methods, and reconstruct them using types module (Is there an easy way to pickle a python function (or otherwise serialize its code)?). I am having trouble getting it to work with optional kwargs. E.g. import marshal import types def test_func(x,...

Produce different serialized JSON for a given class in different scenarios


c#,json,serialization,asp.net-mvc-5,json.net
Update 1: for reasons I won't go into, I want to avoid having anything other than the properties to be persisted in my entity objects. This means no extra properties or methods... I have an entity called Entity1 with (say) 10 public properties. In one place in my code I...

Continuing with Spring integration flow after SoapFault


web-services,spring-integration,soapfault
Our application integration flow is defined as splitter -> ws gateway -> aggregator The splitter splits request into a list of account numbers; so that for each account number a web service call is initiated and the responses from multiple web service calls are aggregated in the aggregator.The channel between...

jdbc backed channel on a cluster mode


jdbc,cluster-computing,spring-integration
I want to use the jdbc backed message channel. Reading the doc says that it is supported but after that I found a thread in the forum that explicitly says don't. Could you please clarify me if it's supported? In this case, could you guide me to do so? thanks...

XML writer with repeating elements in node.js


javascript,json,xml,node.js,serialization
I'm trying to serialize an XML from a given object in node.js. I would like to serialize an array as some elements with the same name, i.e. the same element should be repeated. Example: var objectToSerialize = { SomeElement: { Data: [3, 5, 2] } }; serialize(objectToSerialize); Requested result: <RootElement>...

Gson not deserializing JSON data


java,json,serialization,gson
I am trying to get some weather information from Yahoo APIs. This is my JSON: JSON This is my DTO: public class forecast implements Serializable { private static final long serialVersionUID = -520652416977871134L; private String text; private String high; private String day; private String code; private String low; private String...

Python - Load multiple Pickle objects into a single dictionary


python,serialization,pickle
So my problem is this... I have multiple Pickle object files (which are Pickled Dictionaries) and i want to load them all back up, but essentially merge each dictionary into a single larger dictionary. E.g. I have pickle_file1 and pickle_file2 both contain dictionaries. I would like the contents of pickle_file1...

Delete File after successful persist to MongoDB in Spring Integration


spring,mongodb,spring-integration
I have a Spring Integration flow that reads a csv file from a directory, splits the lines, then processes each line and extracts 2 objects from each line. These two objects are then send to two seperate int-mongodb:outbound-channel-adapter. I want to delete the incoming file after all of the lines...

Serialization - not working


java,serialization
I create class with methods like a How to serialize an object into a string and it every say error "java.lang.ClassCastException: java.lang.String cannot be cast to Myclass" My codes: 1) import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import javax.xml.bind.DatatypeConverter; public class Serialization { public static...

Remove '@class' in XStream for Java primitive types


java,serialization,restlet,xstream
I have this field in a POJO that is serialized into JSON: @XStreamAlias("tags") List<String> tags; My problem is that the output looks like this: "tags": [ { "@class": "linked-list", "string": [ "test", "test2" ] } ], In what way that the output would look like this: "tags": [ "test", "test2"...

Include a method when object is serialized in JMS


symfony2,serialization,jmsserializerbundle
I have a method that returns a value: /** * @ORM\Table() * @ORM\Entity(repositoryClass="PersonRepository") */ class Person { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; public function getFoo(){ return $this->id + 1; } //setters & getters } I would like to include the...

How to serialize only a very few properties in a Java class


java,serialization
Recently in an interview I was asked a question: There are 100 properties in a Java class and I should be able to serialize only 2 of the properties. How is this possible? Marking all the 98 properties was not the answer as it is not efficient. My answer was...

Unable to extract values from object array, to which javascript array was deserialized


c#,arrays,object,serialization
var serializedArray = new JavaScriptSerializer().Deserialize<object[]>(filter); The content of the variable filter is [["Title","contains","foo"],"and",["Name","contains","foo"]]. Content of serializedArray is "object[3]","and","object[3]". Content of serializedArray[0] is object[3] which are "Title", "contains", "foo". serializedArray can be used with index operator, and foreach is applicable. But not for serializedArray[0]. Funny enough, both the serializedArray and serializedArray[0]...

Need help converting JSON to C# Objects


c#,asp.net,json,object,serialization
I'm currently trying to convert a JSON string into C# objects and currently am experiencing trouble during my debugging. Below is a sample of the JSON along with my classes. Classes public class Timeline_RootObject { public List<Timeline_Frame> frames { get; set; } public int frameInterval { get; set; } }...

Read nested json objects that have been serialized via gson library


java,json,serialization,gson,deserialization
I am storing an object in shared preferences. To do this I am serializing the object using the gson library and a typeadapter before storing them. Here's what my object looks like in json: { "id": 0, "name": "Sensor 2D:D3:5C", "address": "00:07:80:2D:D3:5C", "device": { "mAddress": "00:07:80:2D:D3:5C" }, "temp": "31342e37" }...

JSON parsing using .NET deserialize() with nested “list”


javascript,c#,json,parsing,serialization
EDIT: Simplified the classes { "name": "Final Five", "bio": null, "noPlayers": "0", "roster": { "players0": { "playerId": "3516", "name": "Gate", "role": "Mid Lane", "isStarter": 1 }, "players1": { "playerId": "3826", "name": "Veritas", "role": "AD Carry", "isStarter": 1 }, "players2": { "playerId": "4054", "name": "Novel", "role": "Support", "isStarter": 1 }, "players3":...