2

I have a JSF-Spring integrated application. The application works good in my non-cluster environment. When deploy the application in a clustered[wildfly 8.0.0] environment, I face different issues around serialization. Some of the examples are the DTO classes were not implemented Serializable, tries to serialize the Logger class which I don’t want to etc.

The application deployed in clustered environment has the < distributable /> tag in my web.xml so it tries the session replication across nodes and which fails on non-serializable cases.

All developers may not follow the guidelines in these lines, which causes some of these instances.

So my question is what is the best option to see all these serialization issues in my test server[wildfly 8.0.0] which is a non-clustered environment.

Adding one exception details for more clarity:

Caused by: java.lang.RuntimeException: Failure to marshal argument(s)
at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:333)
at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.processSingleCall(CommandAwareRpcDispatcher.java:352)
at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:167)
... 76 more
Caused by: org.infinispan.commons.marshall.NotSerializableException: com.org.account.service.AccountExpServiceImpl
Caused by: an exception which occurred:
in field accountExpService
in field m
in object java.util.HashMap@85b67fbe
in object org.jboss.as.clustering.marshalling.SimpleMarshalledValue@85b67fbe
in object org.infinispan.commands.write.ReplaceCommand@ec0c12ad
in object org.infinispan.commands.tx.PrepareCommand@ce32eb5a
Sam
  • 554
  • 1
  • 12
  • 23
  • Read the logs, find these exceptions, and either make the class concerned `Serializable` or find out why it's being serialized if you don't expect that. – user207421 Jan 30 '15 at 05:50
  • Thank you for the comment. I am addressing these issues one by one, the challenge I face here is, these exceptions will trigger only on a cluster when it tries to replicate the session. So what is the option to see all these issues in a non cluster environment? – Sam Jan 30 '15 at 05:58
  • 1
    Try to serialize all your beans yourself, or indeed try to serialize a Session. – user207421 Jan 30 '15 at 08:41
  • Looking for other suggestions – Sam Jan 30 '15 at 13:28
  • One option is, use some static code analyzer like SonarQube. These tools can report all similar cases and you can address one by one in your development box. Rules like findbugs:SE_BAD_FIELD or pmd:BeanMembersShouldSerialize can help you. – Sam Mar 05 '15 at 03:58

2 Answers2

4

We use the following utility to check whether Infinispan can serialise a given object or not:

org.infinispan.manager.DefaultCacheManager.getCacheManagerConfiguration().serialization().marshaller().isMarshallable(objectToCheck);

This is actually part of our tests.

Vladimir Dzhuvinov
  • 772
  • 1
  • 6
  • 13
1

You can have different profiles for running the application locally using web.xml without <distributable/> and one for deployment which is cluster ready and therefore with <distributable/> tag. If you are building using Maven, war plugin and profiles are what you need to look at. See this answer for providing profile dependant web.xml

However this solution alters the behavior of the system drastically between the dev and production environments. Discovering serialization issues only once deployed could be costly (in terms of time and effort).

Therefore sorting the serialization issues one by one is the way to go.

Community
  • 1
  • 1
diginoise
  • 7,352
  • 2
  • 31
  • 39