Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Glassfish会话复制不工作_Java_Jsp_Glassfish 3_Session Replication - Fatal编程技术网

Java Glassfish会话复制不工作

Java Glassfish会话复制不工作,java,jsp,glassfish-3,session-replication,Java,Jsp,Glassfish 3,Session Replication,我正在努力制作一个简单的应用程序复制it会话。事情很基本。起初,我已经设置了两个虚拟机来做这件事,但运气不好,所以我想也许我会在一台机器上做,所以我做了 我已经创建了一个集群,在同一台机器上有两个实例。在部署时标记了“可用性”复选框,以便它能够意外复制会话 我还对一些oracle man网页上给出的代码进行了更改: web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http:

我正在努力制作一个简单的应用程序复制it会话。事情很基本。起初,我已经设置了两个虚拟机来做这件事,但运气不好,所以我想也许我会在一台机器上做,所以我做了

我已经创建了一个集群,在同一台机器上有两个实例。在部署时标记了“可用性”复选框,以便它能够意外复制会话

我还对一些oracle man网页上给出的代码进行了更改:

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">
    <distributable id="sessionDistribute" />
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

30
index.jsp
sun-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 
Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">


<sun-web-app>
    <session-config>
        <session-manager persistence-type="replicated">
            <manager-properties>
                <property name="persistenceFrequency" value="web-method"/>
            </manager-properties>
            <store-properties>
                <property name="persistenceScope" value="session"/>
            </store-properties>
        </session-manager>
        <session-properties/>
        <cookie-properties/>
    </session-config>
</sun-web-app>

index.jsp

<%@page import="java.util.Enumeration"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
</head>
<body>
<h1>Session Form</h1>

<%
    if (request.getParameter("sessionName") != null && request.getParameter("sessionValue") != null) {
        HttpSession httpSession = request.getSession();
        httpSession.setAttribute(request.getParameter("sessionName"), request.getParameter("sessionValue"));
    }
%>

<form action="index.jsp" method="POST">

    your session name : <input type="text" name="sessionName" /> <br />
    your session value : <input type="text" name="sessionValue" /> <br />
    <input type="submit" />

</form>

<h1>Your Sessions</h1>

<%
    Enumeration sessionNames = session.getAttributeNames();
    while (sessionNames.hasMoreElements()) {
        String mySessionName = sessionNames.nextElement().toString();
        String mySession = request.getSession().getAttribute(mySessionName).toString();
        out.print(mySessionName+ " --> "+mySession + " <br />");
    }
%>

</body>
</html>

JSP页面
会议形式
您的会话名称:
您的会话值:
你的会议
当我将某些内容发布到会话中时,它不会出现在secon实例上。 第二天我就一直在和这件事抗争,我快没主意了


任何提示都是grea。

您好,您对此问题有任何更新吗?我正在与同样的问题作斗争。。谢谢我也有一些问题,如果它仍然有任何帮助,重新启动玻璃鱼是必要的。还要检查您的多播是否在两个节点之间工作。我也有同样的问题,每个请求中都会创建新的会话id!