2012-11-29 2 views
0

세션 복제를 작동 시키려고합니다 ... 두 개의 노드가 있습니다. 다음 JSP 코드를 node1에서 시작하고 카운터가 올라가는 것을 봅니다. 그런 다음 노드를 종료합니다JBoss EAP에서 세션 복제가 작동하지 않습니다.

<% /* 
This is an example that shows sessions in use within a JSP. 

It's the simplest possible demo - a visit counter, but a 
counter for the number of times that the current user has 
visited during the current session. 
*/ 

/* Get value, or set to zero if this is a new session */ 

String val = (String) session.getAttribute("previouses"); 
if (val == null) val = "0"; 

/* Convert to number, increment, save back into session */ 
int n = Integer.parseInt(val); 
n++; 
session.setAttribute("previouses",Integer.toString(n)); 

/* Also pick up the hosts so that we can echo this in the 
reply page (great for testing load balancer and sticky 
session algorithms on our training courses! */ 
String hostipr = request.getRemoteHost(); 
String hostipl = request.getServerName(); 

/* ------------------------------------------------- */ 

%> 
<html> 
<head> 
<title>Sessions using a JSP</title> 
</head> 
<body> 
<h1>Sessions in a JSP</h1> 
This example program shows the use of a session within a 
Java Server page (JSP). It's the simplest possible example, 
counting the number of times that the user has visited in 
the current session.<br /><br /> 
<b>Details from the session</b><br/> 
Requested session:<%=request.getRequestedSessionId()%><br/> 
Session: <%= session.getId()%><br/> 
Generating or back end host: <%= hostipl %><br /> 
Accessing or front end host: <%= hostipr %><br /> 


Count: <%= n %><br/> 
</body> 
</html> 
: 아래

가 JSP 코드입니다 .. 나는 카운터가 여전히 오른쪽 노드 2에 .. 우리는 노드 2로 이동합니까 작업을 것이라고 생각하지만, 새로운 세션을 시작합니다

답변

관련 문제