If anyone is interested, I was able to solve the problem. What was happening is that the server that was not being logged into had not yet loaded the main servlet needed for context. So when the In Memory Session Replication triggered a static method to call an ejb, a null pointer exception was received. The solution I created was to make a new InitServlet extending the main servlet that sets up the context. By putting a call to super() in InitServlet's constuctor, and loading the InitServlet on startup(web.xml), I now have both servers ready for any calls triggered by the SessionAttributeListener even though the user has not logged into the server yet.
Hope I explained everything well, if you are interested in how we have set up two web servers balancing two app servers while sharing session, let me know at [EMAIL PROTECTED]
Brian
Brian P Bohnet wrote:
Hi all,
My application is balancing two app servers running tomcat.4, using one web server and sharing session across the app servers with In Memory Session Replication by Filip Hanik. I am attempting to create some data sets like a list of countries (that should never change) which would be available to all users who sign in by having some static methods in a class to load and retrieve this list.
The way the data set (Vector) is loaded is in the login servlet the static method GlobalDataSets.loadCountries() is called and a single static vector is loaded from a stateless ejb which makes the vector vailable for display in the jsp's.
So at this point we have a single GlobalDataSet class loaded on app1. However, when the next request to the server occurs it could go to app2 and the GlobalDataSet has not yet been loaded on that server. The only way the GlobalDataSet works is if the request for the list occurs on the same app server the user logged into. If the request for the list goes to the other server I get null pointers when calling the ejb's.
From what I can tell, this would be caused by some initialization somewhere at login. I tried putting in a SessionAttributeListener class that would notify app2 of a login made in app1,(based on a session attribute being added) which would then trigger a call on app2 to load the GlobalDataSet, but it still threw a null pointer exception on app2.
Any ideas on how I can get the context initialized on the second server if a user logs in on the first server or vice versa?
The last resort would be to login to each server specifically to get proper initialization, then restart the balance software for both. For obvious reasons I would prefer a way to code it.
Thanks, Brian
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com
=========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com
