1

We have a web application with Vaadin 8, Spring Boot 2.1.3 and Open Feign.

Now Hazelcast should be integrated for session replication. I was following this article.

The Problem: with Open Feign an exception is thrown in the InvocationHandler: NotSerializableException, so I implemented my own InvocationHandlerFactory setting my own InvocationHandler that is implementing the Serializable interface.

Now in the InvocationHandler the same exception is thrown:

com.hazelcast.nio.serialization.HazelcastSerializationException: Failed to serialize 'org.springframework.session.MapSession'**
    com.hazelcast.nio.serialization.HazelcastSerializationException: Failed to serialize 'org.springframework.session.MapSession'
Caused by: java.io.NotSerializableException: java.lang.reflect.Method

The problem is: java.io.NotSerializableException: java.lang.reflect.Method

Method is final so it cannot be made serializable.

Is there a way to tell Hazelcast not to try to serialize certain classes? Any workaround?

I already tried to use the ApplicationContext to avoid serialization of open feign classes but it´s not possible because the open feign clients need to be session scoped.

Smajl
  • 7,555
  • 29
  • 108
  • 179
Mylgor
  • 11
  • 2

1 Answers1

0

You are probably injecting a Feign client in a UI component, right? If so, the same happened to me when I implemented that example and I solved it by creating the Services class you can see in the article. Instead of directly injecting beans that are Feign clients or that have references to them, you can call the static methods in the Services class.

Alejandro Duarte
  • 1,365
  • 8
  • 15
  • Thanks for your fast answer. I will give it a try if it will return the right instances of the feign clients because our rest backend is stateless so we need to keep the feign clients in the session scope (maybe not the best approach). – Mylgor Apr 04 '19 at 13:17
  • Good. Please share your findings with the community. I'm also interested in the topic. – Alejandro Duarte Apr 09 '19 at 13:40
  • I tried it without feign client but ran into similar issues like in this post: https://stackoverflow.com/questions/55611815/how-to-run-hazelcast-session-replication-using-vaadin4spring – Mylgor Apr 18 '19 at 12:18