有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java识别非集群环境中的序列化问题

我有一个JSF-Spring集成应用程序。该应用程序在我的非集群环境中运行良好。在集群[wildfly 8.0.0]环境中部署应用程序时,我会遇到与序列化有关的不同问题。其中一些例子是DTO类没有实现可序列化,尝试序列化我不想序列化的Logger类等等

部署在集群环境中的应用程序具有<;可分配/>在我的网页中添加标签。因此它会尝试跨节点进行会话复制,但在不可序列化的情况下会失败

所有开发人员可能都没有遵循这些行中的指导原则,这导致了其中一些实例

所以我的问题是,在我的测试服务器[wildfly 8.0.0]中看到所有这些序列化问题的最佳选项是什么,它是一个非集群环境

为更清晰起见,添加了一个例外详细信息:

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

共 (1) 个答案

  1. # 1 楼答案

    使用web.xml本地运行应用程序时,可以使用不同的配置文件,而不使用<distributable/>,还有一个配置文件用于部署,它是集群就绪的,因此带有<distributable/>标记。如果您正在使用Maven进行构建,那么您需要查看war插件和配置文件。见this answer for providing profile dependant web.xml

    然而此解决方案在开发生产环境之间极大地改变了系统的行为。仅在部署一次后发现序列化问题可能代价高昂(在时间和精力方面)

    因此,一个接一个地对序列化问题进行排序是可行的