java - 在 Weblogic(以及 Tomcat)上应用程序停止后,Hazelcast 继续运行

标签 java tomcat weblogic hazelcast

我一直在尝试获得 Hazelcast 提供的功能。在应用程序中使用 Hazelcast 的东西很少。

在 Weblogic 服务器 10.3.6 上,我看到其中一个 map 出现问题。它一直给出关于没有类定义错误的异常,即使它已经运行了几天以上没有问题。然后我停止了在 Oracle Weblogic 上运行 8 个节点的应用程序。我假设 Hazelcast 集群/实例也会关闭,但即使应用程序在 Weblogic 的所有节点上停止,我在日志中看到 Hazelcast 合并异常(继续抛出)。

我还在 Tomcat 7 上测试了基于 spring 的应用程序,即使我关闭了该应用程序,Hazelcast 仍以某种方式拒绝关闭。

这是正常行为吗?即使在关闭应用程序后,我们如何关闭所有 Hazelcast 实例?

请注意,我在应用程序启动时调用了 Hazelcast,没有特殊的客户端,只有 8 个 Weblogic 服务器节点。

编辑:这是迁移问题的堆栈跟踪

    SEVERE: Problem while reading DataSerializable, namespace: 0, id: 0, class: 'com.hazelcast.partition.impl.MigrationRequestOperation', exception: com.hazelcast.partition.impl.MigrationRequestOperation
com.hazelcast.nio.serialization.HazelcastSerializationException: Problem while reading DataSerializable, namespace: 0, id: 0, class: 'com.hazelcast.partition.impl.MigrationRequestOperation', exception: com.hazelcast.partition.impl.MigrationRequestOperatio

 at com.hazelcast.nio.serialization.DataSerializer.read(DataSerializer.java:120)
 at com.hazelcast.nio.serialization.DataSerializer.read(DataSerializer.java:39)
 at com.hazelcast.nio.serialization.StreamSerializerAdapter.toObject(StreamSerializerAdapter.java:65)
 at com.hazelcast.nio.serialization.SerializationServiceImpl.toObject(SerializationServiceImpl.java:260)
 at com.hazelcast.spi.impl.NodeEngineImpl.toObject(NodeEngineImpl.java:186)
 at com.hazelcast.spi.impl.BasicOperationService$OperationPacketHandler.loadOperation(BasicOperationService.java:638)
 at com.hazelcast.spi.impl.BasicOperationService$OperationPacketHandler.handle(BasicOperationService.java:621)
 at com.hazelcast.spi.impl.BasicOperationService$OperationPacketHandler.access$1500(BasicOperationService.java:614)
 at com.hazelcast.spi.impl.BasicOperationService$BasicDispatcherImpl.dispatch(BasicOperationService.java:566)
 at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.process(BasicOperationScheduler.java:466)
 at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.processPriorityMessages(BasicOperationScheduler.java:480)
 at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.doRun(BasicOperationScheduler.java:457)
 at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.run(BasicOperationScheduler.java:432)
Caused by: java.lang.ClassNotFoundException: com.hazelcast.partition.impl.MigrationRequestOperation
 at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
 at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
 at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
 at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
 at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
 at com.hazelcast.nio.ClassLoaderUtil.tryLoadClass(ClassLoaderUtil.java:124)
 at com.hazelcast.nio.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:113)
 at com.hazelcast.nio.ClassLoaderUtil.newInstance(ClassLoaderUtil.java:66)
 at com.hazelcast.nio.serialization.DataSerializer.read(DataSerializer.java:109)
 ... 12 more
Mar 16, 2015 5:31:29 PM com.hazelcast.spi.OperationService

最佳答案

可信Hazelcast docs说:

As a final step, if you are done with your client, you can shut it down as shown below. This will release all the used resources and will close connections to the cluster.

  client.shutdown();

应该在您的 bean 的 destroy() 方法中调用:

 public class ExampleBean implements DisposableBean {
    public void destroy() {
      client.shutdown();
    }
 }

您粘贴的异常是由于您的应用程序类加载器在您的应用程序关闭时被销毁。

关于java - 在 Weblogic(以及 Tomcat)上应用程序停止后,Hazelcast 继续运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29101284/

相关文章:

weblogic - 如何访问 osb 中受密码保护的 Web 服务?

java - 部署(发布)后出现 Weblogic 错误 : Error 503--Service Unavailable

java - 在 eclipse 3.7.2 上更新 swt 插件

java - Tomcat Server 6 无法在 Eclipse 上启动

java - JSP 的 <% %> 与 <? ?> 对于 PHP?

tomcat - 使用批处理删除/安装Windows服务

java - 通过Java,调用联网设备上的Javascript函数?

java - Spring 批处理 : Invalid Content was found starting with element 'batch:job'

security - 在tomcat中配置内容安全策略

java - 在 Oracle ADF 上使用 row.setAttribute 获取 NullPointerException