Revision [1359]

Last edited on 2008-01-24 09:15:36 by WikiAdmin
Additions:
For security reasons, some network may not allow multucast traffic. This traffic is an essential communication protocol for memory-to-memory replication. If you suspect multicast is banned, run [[http://www.waterlovinghead.com/images/multicast_test.jar this tool]] to confirm.
Deletions:
For security reasons, some network may not allow multucast traffic. This traffic is an essential communication protocol for memory-to-memory replication. If you suspect multicast is banned, run [http://www.waterlovinghead.com/images/multicast_test.jar this tool] to confirm.


Revision [1358]

Edited on 2008-01-24 09:15:15 by WikiAdmin
Additions:
For security reasons, some network may not allow multucast traffic. This traffic is an essential communication protocol for memory-to-memory replication. If you suspect multicast is banned, run [http://www.waterlovinghead.com/images/multicast_test.jar this tool] to confirm.
Deletions:
For security reasons, some network may not allow multucast traffic. This traffic is an essential communication protocol for memory-to-memory replication. If you suspect multicast is banned, run {http://www.waterlovinghead.com/images/multicast_test.jar this tool] to confirm.


Revision [1357]

Edited on 2008-01-24 09:14:59 by WikiAdmin
Additions:
===Multicast issue===
For security reasons, some network may not allow multucast traffic. This traffic is an essential communication protocol for memory-to-memory replication. If you suspect multicast is banned, run {http://www.waterlovinghead.com/images/multicast_test.jar this tool] to confirm.
On node1
> java -jar multicast_test.jar NODE1
On node2
> java -jar multicast_test.jar NODE2
If you receive messages from each other, multicast works.


Revision [1292]

Edited on 2008-01-10 07:27:02 by WikiAdmin
Additions:
%%(xml;server.xml)


Revision [1291]

Edited on 2008-01-10 07:26:18 by WikiAdmin

No differences.

Revision [1290]

Edited on 2008-01-10 07:25:50 by WikiAdmin
Additions:
Simply add a distributable tag in web.xml anywhere between the block

Deletions:
Simply add a distributable tag in web.xml


Revision [1289]

Edited on 2008-01-10 07:24:15 by WikiAdmin
Additions:
Compile [[http://www.waterlovinghead.com/images/SessionExample.java SessionExample.java]] with this command line if you are not familiar with java classpath:
Deletions:
SessionExample.java - [[http://www.waterlovinghead.com/images/SessionExample.java download it]]
Compile the servlet with this command line if you are not familiar with java classpath:


Revision [1288]

Edited on 2008-01-10 07:23:10 by WikiAdmin
Additions:
SessionExample.java - [[http://www.waterlovinghead.com/images/SessionExample.java download it]]
Deletions:
%%(java;SessionExample.java)
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class SessionExample extends HttpServlet {

public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("");
out.println("");
out.println("");
String title = "Session example";
out.println("" + title + "");
out.println("");
out.println("");
out.println("

" + title + "

");
HttpSession session = request.getSession(true);
out.println("Session Info
Session ID: " + session.getId());
out.println("
");
out.println("Created on: ");
out.println(new Date(session.getCreationTime()) + "
");
out.println("Last accessed: ");
out.println(new Date(session.getLastAccessedTime()));
String dataName = request.getParameter("dataname");
String dataValue = request.getParameter("datavalue");
if (dataName != null && dataValue != null) {
session.setAttribute(dataName, dataValue);
}
out.println("

");
out.println("Session Data


");
Enumeration names = session.getAttributeNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
String value = session.getAttribute(name).toString();
out.println(name + " = " + value + "
");
}
out.println("
");
out.print("
out.print(response.encodeURL("SessionExample"));
out.print("\" ");
out.println("method=POST>");
out.println("Session Name: ");
out.println("");
out.println("
");
out.println("Session Value: ");
out.println("");
out.println("
");
out.println("");
out.println("
");

out.println("");
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
doGet(request, response);
}
}


Revision [1287]

Edited on 2008-01-10 07:19:08 by WikiAdmin
Additions:
-----
http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html


Revision [1286]

Edited on 2008-01-10 07:18:17 by WikiAdmin
Additions:
Session Info
Session ID: D0F607C86A3A4F22958E92A01F7E10E1.jvm1
Session Info
Session ID: D0F607C86A3A4F22958E92A01F7E10E1.jvm2
Deletions:
Session Info
Session ID: D0F607C86A3A4F22958E92A01F7E10E1.jvm1
Session Info
Session ID: D0F607C86A3A4F22958E92A01F7E10E1.jvm2


Revision [1285]

Edited on 2008-01-10 07:17:08 by WikiAdmin
Additions:
**Step 1. Enable tomcat cluster in server.xml**
Edit server.xml such that SimpleTcpCluster is enabled, and a jvmRoute is added.
**Step2: Modify your webapp such that tomcat knows sessions need to be replicated**
Simply add a distributable tag in web.xml
**Step3: Fire up tomcats and test the same TomcatSession app again. **
If you get it running correctly, you will see session appearing on the other tomcat instance right after you enter it in the current one. You should also notice the session id on different instances of tomcat are different:
Deletions:
Step 1. Enable tomcat cluster in server.xml - Edit server.xml such that SimpleTcpCluster is enabled, and a jvmRoute is added.
Step2: Modify your webapp such that tomcat knows sessions need to be replicated. Simply add a distributable tag in web.xml
Step3: Fire up tomcats and test the same TomcatSession app again. If you get it running correctly, you should notice the session id on different instances of tomcat are different:


Revision [1284]

Edited on 2008-01-10 07:15:14 by WikiAdmin
Additions:
To enable tomcat clustering, do the following
Step 1. Enable tomcat cluster in server.xml - Edit server.xml such that SimpleTcpCluster is enabled, and a jvmRoute is added.





Of course you will need to assign a different jvmRoute to different tomcat instances. Other than that, if you are running two or more tomcats on the same host, make sure the ports 8005, 8080, 8009 are changed on different instances so they won't fight for the same ports.
Step2: Modify your webapp such that tomcat knows sessions need to be replicated. Simply add a distributable tag in web.xml


Step3: Fire up tomcats and test the same TomcatSession app again. If you get it running correctly, you should notice the session id on different instances of tomcat are different:
On tomcat1
Session Info
Session ID: D0F607C86A3A4F22958E92A01F7E10E1.jvm1
On tomcat2
Session Info
Session ID: D0F607C86A3A4F22958E92A01F7E10E1.jvm2
That's it, you're done! That's how easy Java/Tomcat is!
Deletions:
Haven't got it working yet.


Revision [1283]

Edited on 2008-01-10 06:56:49 by WikiAdmin
Additions:
Notice if you do not specify a Manager, tomcat will start the default Manager automatically. By default, tomcat stores sessions in a file at this location **TOMCAT_HOME\work\Catalina\localhost\TomcatSession\SESSIONS.ser**. More information on SessionManager can be found at http://tomcat.apache.org/tomcat-4.1-doc/config/manager.html. From the link, you will be able to define other attributes on Session Manager. For example, the following allows you to specify where tomcat sessions should be stored on restart.
==Tomcat cluster and Session Replication==
Haven't got it working yet.
Reference doc:
http://www.javaworld.com.tw/jute/post/view?bid=9&id=194224&sty=1&tpg=1&age=-1
Deletions:
Notice if you do not specify a Manager, tomcat will start the default Manager automatically. By default, tomcat stores sessions in a file at this location **TOMCAT_HOMEwork\Catalina\localhost\TomcatSession\SESSIONS.ser**. More information on SessionManager can be found at http://tomcat.apache.org/tomcat-4.1-doc/config/manager.html. From the link, you will be able to define other attributes on Session Manager. For example, the following allows you to specify where tomcat sessions should be stored on restart.


Revision [1282]

Edited on 2008-01-10 06:34:56 by WikiAdmin
Additions:
Compile the servlet with this command line if you are not familiar with java classpath:
%JAVA_HOME%\bin\javac -cp .;w:\apache-tomcat-6.0.14\lib\servlet-api.jar SessionExample.java


Revision [1281]

Edited on 2008-01-10 06:22:34 by WikiAdmin
Additions:
Notice if you do not specify a Manager, tomcat will start the default Manager automatically. By default, tomcat stores sessions in a file at this location **TOMCAT_HOMEwork\Catalina\localhost\TomcatSession\SESSIONS.ser**. More information on SessionManager can be found at http://tomcat.apache.org/tomcat-4.1-doc/config/manager.html. From the link, you will be able to define other attributes on Session Manager. For example, the following allows you to specify where tomcat sessions should be stored on restart.
Deletions:
Notice if you do not specify a Manager, tomcat will start the default Manager automatically. More information on SessionManager can be found at http://tomcat.apache.org/tomcat-4.1-doc/config/manager.html. From the link, you will be able to define other attributes on Session Manager. For example, the following allows you to specify where tomcat sessions should be stored on restart.


Revision [1280]

Edited on 2008-01-10 06:15:12 by WikiAdmin
Additions:
If you play with the app, you will be able to input session variables and retrieve them by going to the same page.
==Session Persistence==
If you try restarting tomcat, you will realize the session variables are still there. That's because since tomcat5.5, sessions are made persistent by default. Sessions are written to disk on restart. To turn that off, edit TOMCAT_HOME/conf/context.xml and uncomment the following block -
%%(xml;context.xml)

Notice if you do not specify a Manager, tomcat will start the default Manager automatically. More information on SessionManager can be found at http://tomcat.apache.org/tomcat-4.1-doc/config/manager.html. From the link, you will be able to define other attributes on Session Manager. For example, the following allows you to specify where tomcat sessions should be stored on restart.


Revision [1279]

Edited on 2008-01-10 06:08:37 by WikiAdmin
Additions:
|- webapps
|--- TomcatSession
|----- index.html
|----- WEB-INF
|------- classes
|------- web.xml
|--------- SessionExample.java
|--------- SessionExample.class
Deletions:
- webapps
-- TomcatSession
--- index.html
--- WEB-INF
---- classes
---- web.xml
----- SessionExample.java
----- SessionExample.class


Revision [1278]

The oldest known version of this page was created on 2008-01-10 06:07:32 by WikiAdmin
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki