File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes session gets lost via apache web server / mod_jk / modrewrite Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "session gets lost via apache web server / mod_jk / modrewrite" Watch "session gets lost via apache web server / mod_jk / modrewrite" New topic

session gets lost via apache web server / mod_jk / modrewrite

Robert Jaeger
Ranch Hand

Joined: Apr 29, 2002
Posts: 62

After investigating myself in a problem I am giving up and so I ask clever people in this forum

I have successfully installed and configured apache web server 2.x, tomcat 5.x and mod_jk (by usting xampp) to enable communication between both servers.

Everything works fine, the requests are redirected from the web server to tomcat.

Unfortunately the session object that is filled with attributes in my JSPs gets lost after each request (object = null). I think I still have a problem with my configuration - seems that apache doesn't receive or redirect the session to tomcat Or it fails because my requests are targeted to an apache/htdocs-directory where a htaccess-file waits to redirect the request to my webapplication. I need htaccess/modrewrite for proper urls for search engines.

I do this:
localhost/mywebapp/my.jsp -> adds attribute to session object -> link on jsp references to localhost/apachedir/ -> htaccess references to localhost/mywebapp/my.jsp -> added session attribute is gone

Maybe someone has a good advice - would be great, I could not solve the problem on my own

Thanks and regards from Bogota, Colombia,
Mav Ricky
Ranch Hand

Joined: May 19, 2004
Posts: 76
Hi robert

now problem relating to same occurs to me.

i have done the application migration from windows to UNIX.
earlier application was on JDK 1.3 APACHE 1.3 and Tomcat 3.2
now it has been migrated to JDK 1.4 Apache 2.0 and Tomcat 4.1
same application works in windows but not in UNIX.
coz server is on UNIX .it is working on Localhost


public SqlManager(HttpServletRequest request)
throws SQLException,IOException,SeptoUserException{
currentRequest = request;
currentRequest = request;
currentSession = currentRequest.getSession();
SeptoUser user = getSeptoUser();

after this line in BOLD
currentSession = currentRequest.getSession()

the execution stops in UNIX and in windows whole application is perfectly

no exceptions were looged in UNIX console when i tried to debug.
i tried to print request object it is getting created perfectly on UNIX Tomcat console but after that session object nothing is printed and execution stops there .
i dont know why this is happenning ?
as Java is paltform independent why same code is working on WINDOWS and not on UNIX.

thanks for any help!
I agree. Here's the link:
subject: session gets lost via apache web server / mod_jk / modrewrite
It's not a secret anymore!