我正在尝试将我的 JSF Web 应用程序部署在具有两个节点的“域”集群中。
我无法在节点之间复制 HTTP session 。
我已经配置了我的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<session-config>
<session-timeout>30</session-timeout>
<tracking-mode>URL</tracking-mode>
</session-config>
<distributable></distributable>
</web-app>
和jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>thumbzup-admin</context-root>
<!--replication-config>
<replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger>
<replication-granularity>SESSION</replication-granularity>
</replication-config-->
<replication-config>
<cache-name>custom-session-cache</cache-name>
<replication-trigger>SET</replication-trigger>
<replication-granularity>ATTRIBUTE</replication-granularity>
<!--replication-field-batch-mode>true</replication-field-batch-mode-->
<use-jk>false</use-jk>
<max-unreplicated-interval>30</max-unreplicated-interval>
<snapshot-mode>INSTANT</snapshot-mode>
<snapshot-interval>1000</snapshot-interval>
<replication-mode>SYNCHRONOUS</replication-mode>
<!--session-notification-policy>com.example.CustomSessionNotificationPolicy</session-notification-policy-->
</replication-config>
</jboss-web>
和 domain.xml 中的 Infinispan 缓存容器;
<cache-container name="web" aliases="standard-session-cache" default-cache="repl" module="org.jboss.as.clustering.web.infinispan">
<transport lock-timeout="60000"/>
<replicated-cache name="repl" mode="ASYNC" batching="true">
<file-store/>
</replicated-cache>
<replicated-cache name="sso" mode="SYNC" batching="true"/>
<distributed-cache name="dist" l1-lifespan="0" mode="ASYNC" batching="true">
<file-store/>
</distributed-cache>
</cache-container>
但在 NODE2 上使用相同的 SESSIONID 时,我无法检索在 NODE1 上创建的 session 。
有什么建议吗?
最佳答案
名字 “自定义 session 缓存” 您在 jboss-web.xml 中定义的似乎与domain.xml 中的任何缓存都不匹配。完全删除“cache-name”属性以使用“web”容器的“default-cache”属性的值或添加具有该名称的缓存条目
关于jboss7.x - JBoss EAP 6.1 中的 HTTP session 复制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18831848/