2

I'm trying to deploy a Mule application which uses Hazelcast to cache the result of some methods that are frequently used. However, while deploying the application I got the following error:

java.lang.ClassCastException: Cannot cast com.hazelcast.client.txn.ClientTxnPortableHook to com.hazelcast.nio.serialization.PortableHook 
at java.lang.Class.cast(Class.java:3176) ~[?:1.7.0_79] 
at com.hazelcast.util.ServiceLoader$1.next(ServiceLoader.java:97) ~[hazelcast-3.1.6.jar:3.1.6] 
at com.hazelcast.nio.serialization.PortableHookLoader.load(PortableHookLoader.java:48) ~[hazelcast-3.1.6.jar:3.1.6] 
at com.hazelcast.nio.serialization.PortableHookLoader.(PortableHookLoader.java:41) ~[hazelcast-3.1.6.jar:3.1.6] 

I've tried to use the loader override function by placing the next setting in mule-deploy.properties:

loader.override=-com.hazelcast

The Mule application uses Hazelcast 3.5, and Mule 3.6.2 EE uses Hazelcast 3.1.6. Can you tell me a possible solution?

Enrique
  • 866
  • 2
  • 9
  • 20
Manuel Saucedo
  • 525
  • 3
  • 18
  • This might come helpful: http://stackoverflow.com/questions/826319/classcastexception-when-casting-to-the-same-class – Enrique Nov 03 '15 at 16:38

1 Answers1

3

I have reviewed the link provided by Enrique (ClassCastException when casting to the same class) and it was useful because there were two different classpaths, but there were other aspects to be considered in the solution of the problem:

  1. The Hazelcast versions were different. The Mule application used Hazelcast 3.5, and Mule 3.6.2 EE used Hazelcast 3.1.6.

  2. There was not log configuration for Hazelcast in the mule server.

Because I really need to use the Hazelcast 3.5, it was not a choice to downgrade the Hazelcast to 3.1.6. So, I had to replace the version of the Hazelcast in the mule server to 3.5 and remove this library from the Mule application. And then I had to made a lot of tests to discard possible incompatibility issues. The tests were successful.

For the log configuration for Hazelcast in the mule server, I had to add the next JVM parameter to the mule server wrapper:

wrapper.java.additional.44=-Dhazelcast.logging.type=log4j

I used "log4j" because I was using Log4j2. You can see more information about this configuration in the next link: http://docs.hazelcast.org/docs/3.5/manual/html/logging.html

Community
  • 1
  • 1
Manuel Saucedo
  • 525
  • 3
  • 18