Spring jdbcSession : Not able to serialize JsonNode









up vote
5
down vote

favorite












I am trying to store a JsonNode to my spring jdbc session,

while when the data is set and ready to insert to database by spring, ConversionFailedException was throw.

I tried the same as mentioned in below, but is not working though.




No converter found capable of converting from type java.lang.Object to type byte in JdbcOperationsSessionRepository .




I also look into the JdbcHttpSessionConfiguration , and seem the same code is already there.



@EnableJdbcHttpSession(maxInactiveIntervalInSeconds = 1800)
public class MyConfiguration extends WebMvcConfigurerAdapter


// session class
@Component
@Scope(value = SCOPE_SESSION, proxyMode = TARGET_CLASS)
public class SessionForm implements Serializable
private String someOtherFeild;
private JsonNode custom;
....


org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.Object] to type [byte] for value 'com.rakuten.payment.step.app.step.model.session.SessionForm@e943f2d'; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: com.fasterxml.jackson.databind.node.ObjectNode
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:43)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:203)
at org.springframework.session.jdbc.JdbcOperationsSessionRepository.serialize(JdbcOperationsSessionRepository.java:627)
at org.springframework.session.jdbc.JdbcOperationsSessionRepository.access$400(JdbcOperationsSessionRepository.java:129)
at org.springframework.session.jdbc.JdbcOperationsSessionRepository$1$2.setValues(JdbcOperationsSessionRepository.java:403)
at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:960)
at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:950)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:662)
at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:950)
at org.springframework.session.jdbc.JdbcOperationsSessionRepository$1.doInTransactionWithoutResult(JdbcOperationsSessionRepository.java:395)
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.springframework.session.jdbc.JdbcOperationsSessionRepository.save(JdbcOperationsSessionRepository.java:377)
at org.springframework.session.jdbc.JdbcOperationsSessionRepository.save(JdbcOperationsSessionRepository.java:129)
at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.commitSession(SessionRepositoryFilter.java:245)
at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.access$100(SessionRepositoryFilter.java:217)
at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:170)
at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)









share|improve this question



























    up vote
    5
    down vote

    favorite












    I am trying to store a JsonNode to my spring jdbc session,

    while when the data is set and ready to insert to database by spring, ConversionFailedException was throw.

    I tried the same as mentioned in below, but is not working though.




    No converter found capable of converting from type java.lang.Object to type byte in JdbcOperationsSessionRepository .




    I also look into the JdbcHttpSessionConfiguration , and seem the same code is already there.



    @EnableJdbcHttpSession(maxInactiveIntervalInSeconds = 1800)
    public class MyConfiguration extends WebMvcConfigurerAdapter


    // session class
    @Component
    @Scope(value = SCOPE_SESSION, proxyMode = TARGET_CLASS)
    public class SessionForm implements Serializable
    private String someOtherFeild;
    private JsonNode custom;
    ....


    org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.Object] to type [byte] for value 'com.rakuten.payment.step.app.step.model.session.SessionForm@e943f2d'; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: com.fasterxml.jackson.databind.node.ObjectNode
    at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:43)
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:203)
    at org.springframework.session.jdbc.JdbcOperationsSessionRepository.serialize(JdbcOperationsSessionRepository.java:627)
    at org.springframework.session.jdbc.JdbcOperationsSessionRepository.access$400(JdbcOperationsSessionRepository.java:129)
    at org.springframework.session.jdbc.JdbcOperationsSessionRepository$1$2.setValues(JdbcOperationsSessionRepository.java:403)
    at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:960)
    at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:950)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:662)
    at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:950)
    at org.springframework.session.jdbc.JdbcOperationsSessionRepository$1.doInTransactionWithoutResult(JdbcOperationsSessionRepository.java:395)
    at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    at org.springframework.session.jdbc.JdbcOperationsSessionRepository.save(JdbcOperationsSessionRepository.java:377)
    at org.springframework.session.jdbc.JdbcOperationsSessionRepository.save(JdbcOperationsSessionRepository.java:129)
    at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.commitSession(SessionRepositoryFilter.java:245)
    at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.access$100(SessionRepositoryFilter.java:217)
    at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:170)
    at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)









    share|improve this question

























      up vote
      5
      down vote

      favorite









      up vote
      5
      down vote

      favorite











      I am trying to store a JsonNode to my spring jdbc session,

      while when the data is set and ready to insert to database by spring, ConversionFailedException was throw.

      I tried the same as mentioned in below, but is not working though.




      No converter found capable of converting from type java.lang.Object to type byte in JdbcOperationsSessionRepository .




      I also look into the JdbcHttpSessionConfiguration , and seem the same code is already there.



      @EnableJdbcHttpSession(maxInactiveIntervalInSeconds = 1800)
      public class MyConfiguration extends WebMvcConfigurerAdapter


      // session class
      @Component
      @Scope(value = SCOPE_SESSION, proxyMode = TARGET_CLASS)
      public class SessionForm implements Serializable
      private String someOtherFeild;
      private JsonNode custom;
      ....


      org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.Object] to type [byte] for value 'com.rakuten.payment.step.app.step.model.session.SessionForm@e943f2d'; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: com.fasterxml.jackson.databind.node.ObjectNode
      at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:43)
      at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:203)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository.serialize(JdbcOperationsSessionRepository.java:627)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository.access$400(JdbcOperationsSessionRepository.java:129)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository$1$2.setValues(JdbcOperationsSessionRepository.java:403)
      at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:960)
      at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:950)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:662)
      at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:950)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository$1.doInTransactionWithoutResult(JdbcOperationsSessionRepository.java:395)
      at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository.save(JdbcOperationsSessionRepository.java:377)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository.save(JdbcOperationsSessionRepository.java:129)
      at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.commitSession(SessionRepositoryFilter.java:245)
      at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.access$100(SessionRepositoryFilter.java:217)
      at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:170)
      at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:748)









      share|improve this question















      I am trying to store a JsonNode to my spring jdbc session,

      while when the data is set and ready to insert to database by spring, ConversionFailedException was throw.

      I tried the same as mentioned in below, but is not working though.




      No converter found capable of converting from type java.lang.Object to type byte in JdbcOperationsSessionRepository .




      I also look into the JdbcHttpSessionConfiguration , and seem the same code is already there.



      @EnableJdbcHttpSession(maxInactiveIntervalInSeconds = 1800)
      public class MyConfiguration extends WebMvcConfigurerAdapter


      // session class
      @Component
      @Scope(value = SCOPE_SESSION, proxyMode = TARGET_CLASS)
      public class SessionForm implements Serializable
      private String someOtherFeild;
      private JsonNode custom;
      ....


      org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.Object] to type [byte] for value 'com.rakuten.payment.step.app.step.model.session.SessionForm@e943f2d'; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: com.fasterxml.jackson.databind.node.ObjectNode
      at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:43)
      at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:203)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository.serialize(JdbcOperationsSessionRepository.java:627)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository.access$400(JdbcOperationsSessionRepository.java:129)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository$1$2.setValues(JdbcOperationsSessionRepository.java:403)
      at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:960)
      at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:950)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:662)
      at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:950)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository$1.doInTransactionWithoutResult(JdbcOperationsSessionRepository.java:395)
      at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository.save(JdbcOperationsSessionRepository.java:377)
      at org.springframework.session.jdbc.JdbcOperationsSessionRepository.save(JdbcOperationsSessionRepository.java:129)
      at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.commitSession(SessionRepositoryFilter.java:245)
      at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.access$100(SessionRepositoryFilter.java:217)
      at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:170)
      at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:748)






      spring-session






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 8 at 1:07

























      asked Nov 7 at 7:36









      brian661

      1311417




      1311417






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          Try changing your component to:



          @Component
          @Scope(value = SCOPE_SESSION, proxyMode = TARGET_CLASS)
          public class SessionForm implements Serializable
          private String someOtherFeild;
          private JsonNode custom;

          private void writeObject(ObjectOutputStream out) throws IOException
          out.defaultWriteObject();
          if(custom== null)
          out.writeBoolean(false);
          else
          out.writeBoolean(true);
          new ObjectMapper().configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false).writeValue(out, custom);



          private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
          in.defaultReadObject();
          if(in.readBoolean())
          this.custom = new ObjectMapper().configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false).readValue(in, JsonNode.class);





          This will change the default serialization, allowing you to override the default behaviour and work around this error



          Reference






          share|improve this answer




















          • Sorry but I am still getting the exactly same exception at the out.defaultWriteObject();. And seem writeValue require DataOutput /DataInput, it is safe to cast it?
            – brian661
            Nov 15 at 1:42










          • @brian661, yes in recent versions of Jackson, ObjectOutputStream has to be cast to an OutputStream, due to a signature conflict between an overloaded method that takes a DataOutput
            – Sven Hakvoort
            Nov 15 at 10:34










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185189%2fspring-jdbcsession-not-able-to-serialize-jsonnode%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          Try changing your component to:



          @Component
          @Scope(value = SCOPE_SESSION, proxyMode = TARGET_CLASS)
          public class SessionForm implements Serializable
          private String someOtherFeild;
          private JsonNode custom;

          private void writeObject(ObjectOutputStream out) throws IOException
          out.defaultWriteObject();
          if(custom== null)
          out.writeBoolean(false);
          else
          out.writeBoolean(true);
          new ObjectMapper().configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false).writeValue(out, custom);



          private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
          in.defaultReadObject();
          if(in.readBoolean())
          this.custom = new ObjectMapper().configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false).readValue(in, JsonNode.class);





          This will change the default serialization, allowing you to override the default behaviour and work around this error



          Reference






          share|improve this answer




















          • Sorry but I am still getting the exactly same exception at the out.defaultWriteObject();. And seem writeValue require DataOutput /DataInput, it is safe to cast it?
            – brian661
            Nov 15 at 1:42










          • @brian661, yes in recent versions of Jackson, ObjectOutputStream has to be cast to an OutputStream, due to a signature conflict between an overloaded method that takes a DataOutput
            – Sven Hakvoort
            Nov 15 at 10:34














          up vote
          1
          down vote













          Try changing your component to:



          @Component
          @Scope(value = SCOPE_SESSION, proxyMode = TARGET_CLASS)
          public class SessionForm implements Serializable
          private String someOtherFeild;
          private JsonNode custom;

          private void writeObject(ObjectOutputStream out) throws IOException
          out.defaultWriteObject();
          if(custom== null)
          out.writeBoolean(false);
          else
          out.writeBoolean(true);
          new ObjectMapper().configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false).writeValue(out, custom);



          private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
          in.defaultReadObject();
          if(in.readBoolean())
          this.custom = new ObjectMapper().configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false).readValue(in, JsonNode.class);





          This will change the default serialization, allowing you to override the default behaviour and work around this error



          Reference






          share|improve this answer




















          • Sorry but I am still getting the exactly same exception at the out.defaultWriteObject();. And seem writeValue require DataOutput /DataInput, it is safe to cast it?
            – brian661
            Nov 15 at 1:42










          • @brian661, yes in recent versions of Jackson, ObjectOutputStream has to be cast to an OutputStream, due to a signature conflict between an overloaded method that takes a DataOutput
            – Sven Hakvoort
            Nov 15 at 10:34












          up vote
          1
          down vote










          up vote
          1
          down vote









          Try changing your component to:



          @Component
          @Scope(value = SCOPE_SESSION, proxyMode = TARGET_CLASS)
          public class SessionForm implements Serializable
          private String someOtherFeild;
          private JsonNode custom;

          private void writeObject(ObjectOutputStream out) throws IOException
          out.defaultWriteObject();
          if(custom== null)
          out.writeBoolean(false);
          else
          out.writeBoolean(true);
          new ObjectMapper().configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false).writeValue(out, custom);



          private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
          in.defaultReadObject();
          if(in.readBoolean())
          this.custom = new ObjectMapper().configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false).readValue(in, JsonNode.class);





          This will change the default serialization, allowing you to override the default behaviour and work around this error



          Reference






          share|improve this answer












          Try changing your component to:



          @Component
          @Scope(value = SCOPE_SESSION, proxyMode = TARGET_CLASS)
          public class SessionForm implements Serializable
          private String someOtherFeild;
          private JsonNode custom;

          private void writeObject(ObjectOutputStream out) throws IOException
          out.defaultWriteObject();
          if(custom== null)
          out.writeBoolean(false);
          else
          out.writeBoolean(true);
          new ObjectMapper().configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false).writeValue(out, custom);



          private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
          in.defaultReadObject();
          if(in.readBoolean())
          this.custom = new ObjectMapper().configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false).readValue(in, JsonNode.class);





          This will change the default serialization, allowing you to override the default behaviour and work around this error



          Reference







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 at 9:26









          Sven Hakvoort

          1,790519




          1,790519











          • Sorry but I am still getting the exactly same exception at the out.defaultWriteObject();. And seem writeValue require DataOutput /DataInput, it is safe to cast it?
            – brian661
            Nov 15 at 1:42










          • @brian661, yes in recent versions of Jackson, ObjectOutputStream has to be cast to an OutputStream, due to a signature conflict between an overloaded method that takes a DataOutput
            – Sven Hakvoort
            Nov 15 at 10:34
















          • Sorry but I am still getting the exactly same exception at the out.defaultWriteObject();. And seem writeValue require DataOutput /DataInput, it is safe to cast it?
            – brian661
            Nov 15 at 1:42










          • @brian661, yes in recent versions of Jackson, ObjectOutputStream has to be cast to an OutputStream, due to a signature conflict between an overloaded method that takes a DataOutput
            – Sven Hakvoort
            Nov 15 at 10:34















          Sorry but I am still getting the exactly same exception at the out.defaultWriteObject();. And seem writeValue require DataOutput /DataInput, it is safe to cast it?
          – brian661
          Nov 15 at 1:42




          Sorry but I am still getting the exactly same exception at the out.defaultWriteObject();. And seem writeValue require DataOutput /DataInput, it is safe to cast it?
          – brian661
          Nov 15 at 1:42












          @brian661, yes in recent versions of Jackson, ObjectOutputStream has to be cast to an OutputStream, due to a signature conflict between an overloaded method that takes a DataOutput
          – Sven Hakvoort
          Nov 15 at 10:34




          @brian661, yes in recent versions of Jackson, ObjectOutputStream has to be cast to an OutputStream, due to a signature conflict between an overloaded method that takes a DataOutput
          – Sven Hakvoort
          Nov 15 at 10:34

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185189%2fspring-jdbcsession-not-able-to-serialize-jsonnode%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

          How do I collapse sections of code in Visual Studio Code for Windows?

          ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ