Greetings Mike: Thanks for your input. I was able to use the mod_rewrite module to swithc between the different servlet contexts within the httpd.conf file. I don't know if this will work when you are using mod_jk.
<VirtualHost *:80> ServerName myhost.localhost DocumentRoot /usr/local/tomcat/myhost/myhost Options Indexes ProxyRequests Off ProxyPass / http://myhost.localhost:8082/ ProxyPassReverse / http://myhost.localhost:8082/ RewriteRule ^/(.*) http://myhost.localhost:8082/$1 [P,L] </VirtualHost> Original Message: ----------------- From: Mike Sabroff [EMAIL PROTECTED] Date: Tue, 28 Mar 2006 09:59:55 -0600 To: users@tomcat.apache.org Subject: Re: multiple sessions being created with Tomcat Proxy and sessionis null Do you have any mappings for your servlet in a web.xml? I have always mapped my servlets in my web.xml, then made a JkMount the same as that mapping i.e. <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>admincontrol</servlet-name> <servlet-class>com.bla.servlet.AdminServlet</servlet-class> <load-on-startup>4</load-on-startup> </servlet> <servlet-mapping> <servlet-name>admincontrol</servlet-name> <url-pattern>/admincontrol/*</url-pattern> </servlet-mapping> </web-app> then in httpd.conf JkMount /*.jsp local JkMount /webappname/* local JkMount /admincontrol/* local then when accessing through these mappings, the session is the same session The problem is, if you don't have some kind of mapping in apache to match a webapp class in tomcat apache will access the jsp though a session at "/" and the webapp servlet at /servlet or whatever so you have 2 different sessions Doing it the way I described, then accessing through the /webappname/main.jsp where the action of the form is /webappname/admincontrol insures using the same session. Now, there may be better ways of doing this as the support persons at tomcat would know better than me, but this works for me. The thing is (I believe this to be true) that if you don't create the correct mappings for both servers, you can get 2 different sessions as you have 2 different servers. After all, a session is a connection between a client and a server. [EMAIL PROTECTED] wrote: > Greetings: > > I am looking for help with an issue that I cannot find the answer to on the > web or list-archives. My issue is this: > > I use Tomcat 5.5 and jdk 1.5 on linux. > > 1)I have a custom jsp tag that puts string data in a Session attribute when > the jsp page loads (via pageRequest.getSession().setAttribute("var",value). > > 2)The jsp page is a form that submits to data to a servlet. The servlet > retrieves the data request.getSession().getAttribute("var") to compare it > with data from another form field. > > Under normal deployement with tomcat running on port 8080 and the app at > context /myapp (http://localhost:8080/myapp) the servlet is able to > retrieve the "var" out of the session and read it. > > The problem-issue is when I setup the apache/tomcat proxy (http not > modjk). > > When I access the application with Apache on port 80 through the proxy on > port 8082 (http://myhost.localhost/myapp), the > request.getSession().getAttribute("var") within the servlet returns null. > When I access the application throgh the proxied port > (http://myhost.localhost:8082/myapp) the session attribute is not null. > > Also, when I access the application through port 80, the Tomcat manager > webapp reports double the amount of sessions being created. > > > Here is the connector setting in sever.xml > <Connector port="8082" > maxThreads="150" minSpareThreads="25" maxSpareThreads="75" > enableLookups="false" acceptCount="100" > connectionTimeout="20000" > proxyPort="80" disableUploadTimeout="true" /> > > Here is the host setting in server.xml > <Host name="myhost.localhost" appBase="myhost" unpackWARs="true" > autoDeploy="true" > xmlValidation="false" xmlNamespaceAware="false"> > <Alias>myhost.localhost.org</Alias> > > <Context path="" docBase="/usr/local/tomcat/myhost" /> > > <Context path="/manager" debug="0" privileged="true" > docBase="${catalina.home}/server/webapps/manager" /> > > </Host> > > Here is the apache virtual host proxy configuration: > <VirtualHost *:80> > ServerName myhost.localhost > DocumentRoot /usr/local/tomcat/myhost > Options Indexes > > ProxyPass / http://myhost.localhost:8082/myhost/ > ProxyPassReverse / http://myhost.localhost:8082/myhost/ > > </VirtualHost> > > > Does anyone know what is going on here? any help is greatly appreciated. > Thanks. > Bill > > -------------------------------------------------------------------- > mail2web - Check your email from the web at > http://mail2web.com/ . > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Mike Sabroff Web Services Developer [EMAIL PROTECTED] 920-568-8379 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ . --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]