首页 > 解决方案 > org.apache.catalina.ha.tcp.ReplicationValve.sendReplicationMessage 无法在 kind 集群中执行复制请求

问题描述

我正在使用 Kubernetes 集群(使用 kind)并尝试“提升和转移”基于 jsf 的应用程序。我已经设法将应用程序部署到一个容器中,目前,我正在尝试在 kubernetes 中实现一个 Tomee 集群。

我已经成功创建了用于 DNS 查找的 Tomcat 服务 ingress-nginix,并使用 CloudMembershipService 配置了 tomee:

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="6">
       <Channel className="org.apache.catalina.tribes.group.GroupChannel">
         <Membership className="org.apache.catalina.tribes.membership.cloud.CloudMembershipService"
            membershipProviderClassName="org.apache.catalina.tribes.membership.cloud.DNSMembershipProvider"
             />
         <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
             filter=".*\.gif|.*\.js|.*\.jpeg|.*\.jpg|.*\.png|.*\.htm|.*\.html|.*\.css|.*\.txt"/>    
       </Channel>
     </Cluster>

当我启动一个节点时,一切都很好,应用程序响应并且我看不到任何相关问题。此时(节点 1 已打开会话)我尝试扩展添加节点:我可以看到 pod 即将启动,正在部署的应用程序以及集群内的通信开始并使用集群成员资格,但随后我得到了 NullPointerException并且没有堆栈跟踪:

10-Jun-2021 07:53:33.928 WARNING [Catalina-utility-2] org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.performBasicCheck Member added, even though we weren't notified:[org.apache.catalina.tribes.membership.MemberImpl[tcp://10.244.2.9:4000,10.244.2.9,4000, alive=-1, securePort=-1, UDP Port=-1, id={58 104 -44 123 25 105 84 -23 -90 79 -106 -99 108 93 -3 -70 }, payload={}, command={}, domain={}]]
10-Jun-2021 07:53:33.928 INFO [Catalina-utility-2] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Replication member added:[org.apache.catalina.tribes.membership.MemberImpl[tcp://10.244.2.9:4000,10.244.2.9,4000, alive=-1, securePort=-1, UDP Port=-1, id={58 104 -44 123 25 105 84 -23 -90 79 -106 -99 108 93 -3 -70 }, payload={}, command={}, domain={}]]
10-Jun-2021 07:53:33.951 INFO [Tribes-Task-Receiver[Catalina-Channel]-1] org.apache.catalina.tribes.io.BufferPool.getBufferPool Created a buffer pool with max size:[104857600] bytes of type: [org.apache.catalina.tribes.io.BufferPool15Impl]
10-Jun-2021 07:53:35.497 INFO [main] org.primefaces.webapp.PostConstructApplicationEventListener.processEvent Running on PrimeFaces 7.0
10-Jun-2021 07:53:35.499 INFO [main] org.primefaces.extensions.application.PostConstructApplicationEventListener.processEvent Running on PrimeFaces Extensions 7.0
10-Jun-2021 07:53:35.519 INFO [main] org.apache.catalina.ha.session.DeltaManager.startInternal Register manager [localhost#/mui] to cluster element [Engine] with name [Catalina]
10-Jun-2021 07:53:35.519 INFO [main] org.apache.catalina.ha.session.DeltaManager.startInternal Starting clustering manager at [localhost#/mui]
10-Jun-2021 07:53:35.528 INFO [main] org.apache.catalina.ha.session.DeltaManager.getAllClusterSessions Manager [localhost#/mui], requesting session state from [org.apache.catalina.tribes.membership.MemberImpl[tcp://10.244.1.9:4000,10.244.1.9,4000, alive=-1, securePort=-1, UDP Port=-1, id={1 65 7 100 58 23 -51 120 37 88 125 110 -115 -21 -20 -43 }, payload={}, command={}, domain={}]]. This operation will timeout if no session state has been received within [60] seconds.
10-Jun-2021 07:53:35.542 SEVERE [Tribes-Task-Receiver[Catalina-Channel]-4] org.apache.catalina.ha.session.DeltaManager.messageReceived Manager [localhost#/mui]: Unable to receive message through TCP channel
        java.lang.NullPointerException

起初,我认为问题在于节点端口未公开,但我的配置是

...
    ports:
    - containerPort: 8080
    - containerPort: 4000
...

谁能指出我正确的方向?

标签: kubernetestomcat9tomee-8

解决方案


推荐阅读