2

我已按照JBoss EAP 7.0 - 21.3.7 的配置指南设置外部化 HttpSessions 到 JDG

步骤很简单,我的standalone.xml 有:

<subsystem xmlns="urn:jboss:domain:infinispan:4.0">
    <cache-container name="cacheContainer" default-cache="default-cache" module="org.jboss.as.clustering.web.infinispan" statistics-enabled="true">
        <transport lock-timeout="60000"/>
        <replicated-cache name="default-cache" mode="SYNC">
            <locking isolation="REPEATABLE_READ"/>
            <transaction mode="BATCH"/>
            <remote-store cache="default" socket-timeout="60000" remote-servers="remote-jdg-server1 remote-jdg-server2" passivation="false" preload="true" purge="false" shared="true"/>
        </replicated-cache>
    </cache-container>
...
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
    <outbound-socket-binding name="remote-jdg-server1">
        <remote-destination host="jdbserver1" port="11222"/>
    </outbound-socket-binding>
    <outbound-socket-binding name="remote-jdg-server2">
        <remote-destination host="jdgserver2" port="11222"/>
    </outbound-socket-binding>

然后我在应用程序的 WEB-INF 文件夹中添加了一个 jboss-web.xml 文件,引用缓存容器和远程存储缓存:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_10_0.xsd"
           version="10.0">
    <context-root>/myapp</context-root>
    <replication-config>
        <cache-name>cacheContainer.default-cache</cache-name>
        <replication-granularity>SESSION</replication-granularity>
    </replication-config>
</jboss-web>

但是,它似乎不起作用。我测试了将属性放入会话并重新启动服务器。然后我可以看到它创建了一个新的 httpsession,而不是重用前一个,因此缺少之前设置的参数。日志没有显示任何相关内容。

4

0 回答 0