RE: Using Tomcat over NFS over multiple hosts, want to separate locations of directories
you may try to manually run tomcat via a script, that may help you to assign tomcat variables seperately i run tomcat via a script (guistart.sh) containing that CATALINA_HOME=$ARGELA_RUN_HOME/SANE_GUI_WEB/tomcat export CATALINA_HOME cd $CATALINA_HOME/bin java -Dcatalina.base=$CATALINA_HOME -Dcatalina.home=$CATALINA_HOME -Djava.en dorsed.dirs=$CATALINA_HOME/common/endorsed -Djava. io.tmpdir=$CATALINA_HOME/temp -cp $CATALINA_HOME/bin/bootstrap.jar:$JAVA_HOME/lib/tools.jar org.apache.catalina.startup.Bootst rap start -Original Message- From: Mark Demma [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 5:06 AM To: users@tomcat.apache.org Subject: Using Tomcat over NFS over multiple hosts, want to separate locations of directories Hello folks I am currently trying to convert from Resin Pro 3.0.17 to Tomcat 5.5. We have several Solaris 9 machines and we generally place applications in a NFS mounted /usr/dist/ directory, which is RO for the web application servers. I have a local link, /usr/resin - /usr/dist/pkgs/resin which points to /usr/dist/pkgs/resin/ - vers/resin-pro-3.0.17 so that I can easily install a new version of resin by changing that link. I have my RESIN_HOME=/usr/resin, which is the NFS mount and my SERVER_ROOT=/usr/local/resin, which is a local directory. In my resin.conf, I use web-app-deploy path=/w/${mode}/warfiles expand-path=/usr/local/resin/webapps/ to have Resin look on another NFS mounted directory /w for its warfiles, which it expands in the locally mounted /usr/local/resin. This setup allows me to have my resin config files, binaries, shared libraries, etc, on a central NFS server, my warfiles on another NFS server and the only thing I need to have local is the webapps dir where it explodes the war files, and cache and session. I am thus able to turn a machine into a resin server by copying over one rc file, which when invoked creates the /usr/local/resin dir and pulls everything else it needs off of NFS. I've been scouring the web for days trying to figure out how to make Tomcat do the same thing, but can't for the life of me figure out how... the two main problems I run into is the inability to separate the web app deploy path, i.e. where it LOOKS for the warfiles and the expand path, where it expands them. The other problem is wanting to put the conf/ files in a different location from the webapp/ files. $CATALINA_BASE seems to be the extent to which you can separate things, and it wants to put conf, logs, shared, webapps. work. temp together... So my question is how in Tomcat do I put the bin/ common/ conf/ server/ and shared/ directories in one location (NFS mounted RO) the temp/ webapps/ and work / locally ; logs/ (all of them, including catalina.out) in a sepate location NOT in $CATALINA_BASE or HOME; AND put the location Tomcat looks for new .war files in another NFS mounted location. I know I could do it all with sym-links, but god that would be messy. Any suggestions? Mark Demma Senior UNIX Systems Admin PlanetOut Inc.
RE: Apache 2.0.50 - Tomcat 5.0.28 - Mod_jk - .htaccess
There are any form of change the loading order or i would need reinstall apache. Re-intalling will do you no good. You'd still end up with the same Apache. Re-building it, would, but that can be quite a task. Finding a newer version, differently compiled, might also be a good idea. Anyway, I'm not sure what is the loading order of modules, but it appears that staically linked modules load after dynamically built ins. And you have no control over mod_access. Nix. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
I want to subscribe
This email may contain confidential or privileged information for the intended recipient(s) and the views expressed in the same are not necessarily the views of Zensar Technologies Ltd. If you are not the intended recipient or have received this e-mail by error, its use is strictly prohibited, please delete the e-mail and notify the sender. Zensar Technologies Ltd. does not accept any liability for virus infected mails.
custom jaas login module
Hi all! in org.apache.catalina.realm.GeneralPrincipal I've found the following code: public Principal getUserPrincipal() { if (userPrincipal != null) { return userPrincipal; } else { return this; } } Could anybody explain me the reason why I cannot assing a subject both user and role principal? Thanks a lot Regards Jan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Realm and Authentication with Tomcat 5.0, Apache 2 and mod_jk 1.2
Hi, We have a web application deployed under Tomcat 5.0 which uses a custom Realm for authentication. This custom Realm basically does a web service call using the user's credentials to authenticate with the web service server (basic WS-I username/password authentication). If the web service call fails (user not allowed to call the web service with his credentials), then Tomcat authentication fails. If the web service call succeed (user has access to the web service), then Tomcat authentication succeed and the Realm will store the Session object returned by the web service in a ThreadLocalContext to be reused later in the web application. This works fine with Tomcat only, but as soon as I add mod_jk and try to use Apache to do the authentication and then pass the credentials to Tomcat (using tomcatAuthentication=false), I get the 403 - access denied page. I'd like to know if, in my configuration (Apache authentication + Tomcat Realm + tomcatAuthentication=false), Apache is supposed to pass the user login/password to the Tomcat Realm or if the realm is not called at all (This would be the bad news I fear)? My combination Apache/Tomcat/mod_jk works when I specify tomcatAuthentication=true. But, I'd like to have Apache authentication and the Tomcat Realm called automatically after that with the username/password... Is this possible or do I have to move my Session creation process somewhere else? Hope you understood my problem, Cheers, Mickael -- Mickael Goujon Software Engineer Lion Bioscience Ltd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help me
I am getting following error * org.apache.jasper.JasperException: Unable to compile class for JSP Generated servlet error: Only a type can be imported. org.apache.commons.fileupload.DiskFileUpload resolves to a package Generated servlet error: Only a type can be imported. org.apache.commons.fileupload.FileItem resolves to a package An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: DiskFileUpload cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: DiskFileUpload cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: FileItem cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: FileItem cannot be resolved to a type WHEN I AM COMPILING THE A JSP FILE(REQESTING THE JSP FILE THROUGH BROWSER) IN JSP I IMPORTED FOLLOWINGS %@ page import=org.apache.commons.fileupload.DiskFileUpload% %@ page import=org.apache.commons.fileupload.FileItem% %@ page import=java.util.List% %@ page import=java.util.Iterator% %@ page import=java.io.File% sO PLEASE HELP ME TO GET IT WORK.IS THIS ERROR IS DUE TO CLASS PATH.IF YES THEN PLS SUGGEST ME WHAT PATH I SET FOR IT
RE: Help me
Hi Mir, The problem is because your using %page import= % multiple times... Use only once like % page import=org.apache.commons...,org.apache. % Use commas to separate each importI think then it should work fine.:-). Regards, Awaneesh -Original Message- From: Mir Kasim Ali [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 5:17 PM To: users@tomcat.apache.org Subject: Help me I am getting following error * org.apache.jasper.JasperException: Unable to compile class for JSP Generated servlet error: Only a type can be imported. org.apache.commons.fileupload.DiskFileUpload resolves to a package Generated servlet error: Only a type can be imported. org.apache.commons.fileupload.FileItem resolves to a package An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: DiskFileUpload cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: DiskFileUpload cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: FileItem cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: FileItem cannot be resolved to a type WHEN I AM COMPILING THE A JSP FILE(REQESTING THE JSP FILE THROUGH BROWSER) IN JSP I IMPORTED FOLLOWINGS %@ page import=org.apache.commons.fileupload.DiskFileUpload% %@ page import=org.apache.commons.fileupload.FileItem% %@ page import=java.util.List% %@ page import=java.util.Iterator% %@ page import=java.io.File% sO PLEASE HELP ME TO GET IT WORK.IS THIS ERROR IS DUE TO CLASS PATH.IF YES THEN PLS SUGGEST ME WHAT PATH I SET FOR IT This email may contain confidential or privileged information for the intended recipient(s) and the views expressed in the same are not necessarily the views of Zensar Technologies Ltd. If you are not the intended recipient or have received this e-mail by error, its use is strictly prohibited, please delete the e-mail and notify the sender. Zensar Technologies Ltd. does not accept any liability for virus infected mails. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help me
Hi Mir, The problem is because your using %@ page import= % multiple times... Use only once like %@ page import=org.apache.commons...,org.apache. % Use commas to separate each importI think then it should work fine.:-). Regards, Awaneesh -Original Message- From: Mir Kasim Ali [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 5:17 PM To: users@tomcat.apache.org Subject: Help me I am getting following error * org.apache.jasper.JasperException: Unable to compile class for JSP Generated servlet error: Only a type can be imported. org.apache.commons.fileupload.DiskFileUpload resolves to a package Generated servlet error: Only a type can be imported. org.apache.commons.fileupload.FileItem resolves to a package An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: DiskFileUpload cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: DiskFileUpload cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: FileItem cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: FileItem cannot be resolved to a type WHEN I AM COMPILING THE A JSP FILE(REQESTING THE JSP FILE THROUGH BROWSER) IN JSP I IMPORTED FOLLOWINGS %@ page import=org.apache.commons.fileupload.DiskFileUpload% %@ page import=org.apache.commons.fileupload.FileItem% %@ page import=java.util.List% %@ page import=java.util.Iterator% %@ page import=java.io.File% sO PLEASE HELP ME TO GET IT WORK.IS THIS ERROR IS DUE TO CLASS PATH.IF YES THEN PLS SUGGEST ME WHAT PATH I SET FOR IT This email may contain confidential or privileged information for the intended recipient(s) and the views expressed in the same are not necessarily the views of Zensar Technologies Ltd. If you are not the intended recipient or have received this e-mail by error, its use is strictly prohibited, please delete the e-mail and notify the sender. Zensar Technologies Ltd. does not accept any liability for virus infected mails. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help me
The problem was for package called org.apache.common.fileupload but when I put the jar file for above package in the C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib directory still it causes differnet error.The error now is... root cause javax.servlet.ServletException: org/apache/commons/io/output/DeferredFileOutputStream org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.ProcessFileUpload_jsp._jspService(org.apache.jsp.ProcessFileUpload_jsp:93) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Re: Help me
your commons-fileupload.jar should go in your webapp's WEB-INF/lib directory Mir Kasim Ali a écrit : The problem was for package called org.apache.common.fileupload but when I put the jar file for above package in the C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib directory still it causes differnet error.The error now is... root cause javax.servlet.ServletException: org/apache/commons/io/output/DeferredFileOutputStream org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.ProcessFileUpload_jsp._jspService(org.apache.jsp.ProcessFileUpload_jsp:93) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with Tomcat and Java versions
Hello everyone, I was using java 1.4.2 here, and recently migrated to java 1.5. Unfortunately, something probably is missing, 'cause I'm having problems with Tomcat. When I turn on the computer (that has tomcat on it), if I open the browser and try to access a web application built on java 1.5, it will give me the famous struts error: Cannot find ActionMappings or ActionFormBeans collection. However, if I open a web app built on java 1.4.2, everything works fine. Then, if I just restart the tomcat server (with the command /etc/init.d/tomcat 5 restart) and try to access the first application (the one built on java 1.5), everything will work fine. I'm guessing it's because there's maybe an environment variable that I may have forgotten to update or something. Here go my variables: JAVA_HOME = /usr/local/jdk1.5.0_06 PATH = /usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin CLASSPATH is empty, my jar's are on the application's lib folder. Is there something else I should have setted? Is there something I gotta set in tomcat to show it what java version to use? I use Tomcat 5 and my server runs on a Suse Linux 9.3 box. Thanks everyone -- Letícia Álvares Barbalho [EMAIL PROTECTED]
RE : Tomcat 4.1.31 IBM JDK JSSE crash
Hi, I have following error message Error Message Caused by: java.lang.NoClassDefFoundError: com/sun/net/ssl/SSLContext at org.apache.catalina.net.SSLServerSocketFactory.initProxy(SSLServerSoc ketFactory.java:469) at org.apache.catalina.net.SSLServerSocketFactory.initialize(SSLServerSo cketFactory.java:386) at org.apache.catalina.net.SSLServerSocketFactory.createSocket(SSLServer I use an Tomcat 4.1.31 wit IBM JDK 1.4.1 and i want Implement JSSE on my Tomcat I have removed Sun jsse.jar on $JAVA_HOME/jre/lib/ext but i have following error, where is my mistake ?? I have add in Catalina.sh CLASSPATH=$CLASSPATH:$JAVA_HOME/jre/lib/security.jar My server.xml file is Connector className=org.apache.catalina.connector.http.HttpConnector port=8443 minProcessors=5 maxProcessors=75 enableLookups=true acceptCount=10 debug=0 scheme=https secure=true Factory className=org.apache.catalina.net.SSLServerSocketFactory clientAuth=true keystoreFile=/home/phi/tssl/server/server.ks keystorePass=changeit algorithm=IbmX509 protocol=TLS/ /Connector Regards Philippe Philippe COUAS Responsable Développement INFODEV S.A.
Null XADataSource of Mysql from InitialContext in Tomcat
I have send this mail to another mail list, but have no reply yet. I have wasted much time in this problem, please help. Does MySQL5.0.18 suport XA in Tomcat 5.5 ? I do a XA test in tomcat with only one jsp file and necessary jars. The jsp is as: - % Context ctx = new InitialContext(); com.mysql.jdbc.jdbc2.optional.MysqlXADataSource xads = new com.mysql.jdbc.jdbc2.optional.MysqlXADataSource(); xads.setServerName(localhost); xads.setDatabaseName(test); xads.setPortNumber(3306); XAConnection xcon = xads.getXAConnection(root,password); Connection con = xcon.getConnection(); System.out.println(I get the correct xads and the con= + con); System.out.println(Bind xads to InitialContext); ctx.bind(myXADB, xads); MysqlXADataSource mysqlXADataSource = (MysqlXADataSource)ctx.lookup(myXADB); System.out.println(Get the null MysqlXADataSource from ctx xads= + mysqlXADataSource ); % - Why I can only get a null mysqlXADataSource from the InitialContext ? Is this why I can not configure the XADataSource in tomcat ? Thanks. Wang Jun - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Log4j configuration on a per context basis
Guys, how can I setup log4j with a context specific configuration file ? In the past I used to put a global log4j configuration in the system classpath for the tomcat, but that is no longer appropriate in my current setup. -- Oded ::.. Who the hell wants to hear actors talk? -- H. M. Warner (1881-1958), founder of Warner Brothers, in 1927 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4j configuration on a per context basis
Guys, how can I setup log4j with a context specific configuration file ? In the past I used to put a global log4j configuration in the system classpath for the tomcat, but that is no longer appropriate in my current setup. Hi, remove any log4j.jar and log4j.properties from your global classpathes (system classpath, common, shared). Put a log4j.jar and log4j.properties in each WEB-INF/lib (jar) and WEB-INF/classes (properties) with the correspondent config. Regards Boris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4j configuration on a per context basis
This is trivial if you only introduce log4j.jar in each web app. If you share log4j.jar across web apps, then you have some LoggerRepositorySelector coding ahead of you. This is easy enough via JNDI context for cases where the contextual classloader is set for you by Tomcat, but in other cases (e.g. JMX remote request threads) you have to do such classloader setup yourself. Our web app now supports a per context log4j even if log4j.jar is shared -- in which case anything outside all the web apps goes into another log4j context. Note the log4j JMX MBeans don't support this sort of thing properly (they have a hard-wired ObjectName location for starters), so you'll have to write your own if you're interested in that aspect. Oded Arbel wrote: Guys, how can I setup log4j with a context specific configuration file ? In the past I used to put a global log4j configuration in the system classpath for the tomcat, but that is no longer appropriate in my current setup. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Logging session timeouts
Is there any way of trapping session timeouts, so I can log them? I am logging when a user logs in and when they explicitly log out, but would like to log when their session times out, if that is possible. TIA! Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4j configuration on a per context basis
On Thursday, 9 בFebruary 2006 16:30, Boris Unckel wrote: Guys, how can I setup log4j with a context specific configuration file ? In the past I used to put a global log4j configuration in the system classpath for the tomcat, but that is no longer appropriate in my current setup. Hi, remove any log4j.jar and log4j.properties from your global classpathes (system classpath, common, shared). Put a log4j.jar and log4j.properties in each WEB-INF/lib (jar) and WEB-INF/classes (properties) with the correspondent config. Thanks. I figured that something like that would work, but for some non-related issues, I rather not have a classes directory. Is there a way to have a log4j configuration available to the web app w/o putting it in the classes dir or in a jar file ? maybe someway to setup the context.xml to point to a log4j configuration directly in WEB-INF ? -- Oded ::.. The essential ideas of Algol 68 were that the whole language should be precisely defined and that all the pieces should fit together smoothly. The basic idea behind Pascal was that it didn't matter how vague the language specification was (it took *years* to clarify) or how many rough edges there were, as long as the CDC Pascal compiler was fast. -- Richard A. O'Keefe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging session timeouts
Below is a filter which keeps track of how many sessions are attached to a web app. The key part is the HttpSessionBindingListener interface. Tim /** * J2EE Filter to count page hits. What it counts depends on the url-mapping * in web.xml. * * @author tim.lucia */ public class SessionCountFilter implements Filter, HttpSessionBindingListener, Serializable { private final static Log logger = LogFactory.getLog(SessionCountFilter.class); public static final Hashtable sessions = new Hashtable(); public static int sessionCountHighWater = 0; /** * Container startup notification */ public void init(FilterConfig arg0) throws ServletException { logger.debug(init(): + arg0); } /** * Container shutdown notification */ public void destroy() { logger.debug(destroy()); } /** * Process the container's filter request. * @param request - Request object * @param response - response object * @param chain - next filter in the chain. */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(request, response); HttpServletRequest httpRequest = (HttpServletRequest)request; HttpSession session = httpRequest.getSession(false); if (logger.isDebugEnabled()) { logger.debug(Request + httpRequest.getRequestURI() + (session == null ? returned no session : belongs to session ID + session.getId())); } // Bind to the session, if there is one, and it is new: if (null != session session.isNew()) { session.setAttribute(toString(), this); } } /** * Implement HttpSessionBindingListener#valueBound */ public void valueBound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = session.getId(); sessions.put(session, sessionID); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] CREATE: + sessionID); } sessionCountHighWater = (sessionCountHighWater sessions.size() ? sessions.size() : sessionCountHighWater); } /** * Implement HttpSessionBindingListener#valueUnbound */ public void valueUnbound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = (String)sessions.get(session); sessions.remove(session); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] DESTROY: + sessionID); } } /** * Return current count of sessions * @return The number of sessions currently tracked */ public static int getSessionCount() { return sessions.size(); } /** * Return high water mark of number of sessions * @return The high water mark of sessions tracked */ public static int getSessionCountHighWater() { return sessionCountHighWater; } /** * Return string representation of this object * @return a String representation of this object */ public String toString() { return getClass().getName() + # + hashCode(); } } -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 9:38 AM To: Tomcat Users List Subject: Logging session timeouts Is there any way of trapping session timeouts, so I can log them? I am logging when a user logs in and when they explicitly log out, but would like to log when their session times out, if that is possible. TIA! Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging session timeouts
Session Listeners http://pdf.coreservlets.com/CSAJSP-Chapter9.pdf -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 8:38 AM To: Tomcat Users List Subject: Logging session timeouts Is there any way of trapping session timeouts, so I can log them? I am logging when a user logs in and when they explicitly log out, but would like to log when their session times out, if that is possible. TIA! Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Logging session timeouts
I was hoping for something a little simpler to implement into my app for just logging a user timing out (something like a HttpSession.timeOut event), but I will definitely have a use for the high water mark functionality in the not-too-distant future. Thanks! Tim Lucia wrote: Below is a filter which keeps track of how many sessions are attached to a web app. The key part is the HttpSessionBindingListener interface. Tim /** * J2EE Filter to count page hits. What it counts depends on the url-mapping * in web.xml. * * @author tim.lucia */ public class SessionCountFilter implements Filter, HttpSessionBindingListener, Serializable { private final static Log logger = LogFactory.getLog(SessionCountFilter.class); public static final Hashtable sessions = new Hashtable(); public static int sessionCountHighWater = 0; /** * Container startup notification */ public void init(FilterConfig arg0) throws ServletException { logger.debug(init(): + arg0); } /** * Container shutdown notification */ public void destroy() { logger.debug(destroy()); } /** * Process the container's filter request. * @param request - Request object * @param response - response object * @param chain - next filter in the chain. */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(request, response); HttpServletRequest httpRequest = (HttpServletRequest)request; HttpSession session = httpRequest.getSession(false); if (logger.isDebugEnabled()) { logger.debug(Request + httpRequest.getRequestURI() + (session == null ? returned no session : belongs to session ID + session.getId())); } // Bind to the session, if there is one, and it is new: if (null != session session.isNew()) { session.setAttribute(toString(), this); } } /** * Implement HttpSessionBindingListener#valueBound */ public void valueBound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = session.getId(); sessions.put(session, sessionID); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] CREATE: + sessionID); } sessionCountHighWater = (sessionCountHighWater sessions.size() ? sessions.size() : sessionCountHighWater); } /** * Implement HttpSessionBindingListener#valueUnbound */ public void valueUnbound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = (String)sessions.get(session); sessions.remove(session); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] DESTROY: + sessionID); } } /** * Return current count of sessions * @return The number of sessions currently tracked */ public static int getSessionCount() { return sessions.size(); } /** * Return high water mark of number of sessions * @return The high water mark of sessions tracked */ public static int getSessionCountHighWater() { return sessionCountHighWater; } /** * Return string representation of this object * @return a String representation of this object */ public String toString() { return getClass().getName() + # + hashCode(); } } -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 9:38 AM To: Tomcat Users List Subject: Logging session timeouts Is there any way of trapping session timeouts, so I can log them? I am logging when a user logs in and when they explicitly log out, but would like to log when their session times out, if that is possible. TIA! Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging session timeouts
Ugh, sorry I pasted and mailed the wrong link... The example posted by Tim Lucia is good. I was hoping for something a little simpler to implement into my app for just logging a user timing out Just look at the code and use it as a base and modify what you need. -Original Message- From: Joey Geiger [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 8:48 AM To: 'Tomcat Users List' Subject: RE: Logging session timeouts Session Listeners http://pdf.coreservlets.com/CSAJSP-Chapter9.pdf -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 8:38 AM To: Tomcat Users List Subject: Logging session timeouts Is there any way of trapping session timeouts, so I can log them? I am logging when a user logs in and when they explicitly log out, but would like to log when their session times out, if that is possible. TIA! Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with Tomcat and Java versions
From: Letícia Álvares Barbalho [mailto:[EMAIL PROTECTED] Subject: Problem with Tomcat and Java versions I was using java 1.4.2 here, and recently migrated to java 1.5. Unfortunately, something probably is missing, 'cause I'm having problems with Tomcat. You don't say what Tomcat version you're using. If you were running 5.5.x on JRE 1.4.2, there may in fact be something extra, not something missing. The compatibility package that's required for 1.4.2 execution should be removed when using JRE 5; the package consists of two jars in common/endorsed, and these should be deleted. Of course, this may or may not have anything to do with your problem, but it's something to try. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FW: Catalina.out gets to big- Server crashes
We rotate the catalina.out file using the logrotate program on linux. The rotation is based on file size - 10 Meg limit. We use copytruncate with compression and maintain 14 rotated files before overwriting the oldest. The following is a logrotate script that is placed in the /etc/logrotate.d directory of the server running the tomcat app: /home/tc1/tomcat/logs/catalina.out { rotate 14 size 10M copytruncate compress postrotate # reset ownership to comply with directory's permissions chown tc1.apps /home/tc1/tomcat/logs/catalina.out.* endscript notifempty missingok } The man page on lograte is pretty thorough. -Original Message- From: Tim Funk [mailto:[EMAIL PROTECTED] Sent: Friday, February 03, 2006 8:20 AM To: Tomcat Users List Subject: Re: Catalina.out gets to big- Server crashes http://tomcat.apache.org/faq/logging.html#catalina.out -Tim Joost de Heer wrote: now the question I have is now, how can I here setup jsvc so that it uses logrotation, As far as I'm aware catalina.out can't be rotated. For the Tomcat servers I maintain I've written a script that stops/moves catalina.out/gzips catalina.out/starts Tomcat every Sunday night at 4am. Not the most elegant solution but it works. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
starting with JNDI
Hello guys... its gonna sound really stupid, but i cant seen to configure JNDI to work (either global and context bound)... im getting this exception, wich sugested that something was wrong, maybe in the server.xml sintax or something, but even the tomcat manager cant make it work: Cannot create JDBC driver of class '' for connect URL 'null' im running out of ideas so if anyone can help me out, id apreciate it very much... thanks in advance... -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: starting with JNDI
Hi I hope I had the same problem ;O) My server.xml was correct but I did following steps to solve this problem: 1. I created a context.xml in my META-INF Folder. With this content: Context path=/ContextName docBase=ContextName debug=1 reloadable=true ResourceLink name=xxxblablba global=xxxblabla type=javax.sql.DataSource/ ResourceLink name=xxxblablba2 global=xxxblablba2 type=javax.sql.DataSource/ /Context 2.I guess you have a correct web.xml but anyway: In the web.xml you need this lines. resource-ref descriptionxxxblablbaOracle Datasource/description res-ref-namexxxblablba/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref resource-ref descriptionxxxblablba2 Oracle Datasource/description res-ref-namexxxblablba2/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref The String marked with xxx xxx has to be changed of course but this should solve your problem. My problem was that the context.xml was missing. Hope this will help. best regards Hans 2006/2/9, Marcelo Fukushima [EMAIL PROTECTED]: Hello guys... its gonna sound really stupid, but i cant seen to configure JNDI to work (either global and context bound)... im getting this exception, wich sugested that something was wrong, maybe in the server.xml sintax or something, but even the tomcat manager cant make it work: Cannot create JDBC driver of class '' for connect URL 'null' im running out of ideas so if anyone can help me out, id apreciate it very much... thanks in advance... -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mfg Hans Sowa mailto:[EMAIL PROTECTED]
Re: starting with JNDI
thanks man! #1 solved my problem quite right... tough, i couldnt find the context.xml in the documentation whatsoever On 2/9/06, Hans Sowa [EMAIL PROTECTED] wrote: Hi I hope I had the same problem ;O) My server.xml was correct but I did following steps to solve this problem: 1. I created a context.xml in my META-INF Folder. With this content: Context path=/ContextName docBase=ContextName debug=1 reloadable=true ResourceLink name=xxxblablba global=xxxblabla type=javax.sql.DataSource/ ResourceLink name=xxxblablba2 global=xxxblablba2 type=javax.sql.DataSource/ /Context 2.I guess you have a correct web.xml but anyway: In the web.xml you need this lines. resource-ref descriptionxxxblablbaOracle Datasource/description res-ref-namexxxblablba/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref resource-ref descriptionxxxblablba2 Oracle Datasource/description res-ref-namexxxblablba2/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref The String marked with xxx xxx has to be changed of course but this should solve your problem. My problem was that the context.xml was missing. Hope this will help. best regards Hans 2006/2/9, Marcelo Fukushima [EMAIL PROTECTED]: Hello guys... its gonna sound really stupid, but i cant seen to configure JNDI to work (either global and context bound)... im getting this exception, wich sugested that something was wrong, maybe in the server.xml sintax or something, but even the tomcat manager cant make it work: Cannot create JDBC driver of class '' for connect URL 'null' im running out of ideas so if anyone can help me out, id apreciate it very much... thanks in advance... -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mfg Hans Sowa mailto:[EMAIL PROTECTED] -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: starting with JNDI
Perhaps best to give the version of Tomcat you're using. Glen Marcelo Fukushima wrote: Hello guys... its gonna sound really stupid, but i cant seen to configure JNDI to work (either global and context bound)... im getting this exception, wich sugested that something was wrong, maybe in the server.xml sintax or something, but even the tomcat manager cant make it work: Cannot create JDBC driver of class '' for connect URL 'null' im running out of ideas so if anyone can help me out, id apreciate it very much... thanks in advance... -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: starting with JNDI
;O) Yeah, this is missing in the documentation. I needed two hours to solve this whole problem. Hopefully you didn't waste so much time. You could also add this context.xml to a certain folder in Tomcat. I don't know which one at the moement but it seems there is a problem if you do this so it seems the WEB-INF is the best place for it. 2006/2/9, Marcelo Fukushima [EMAIL PROTECTED]: thanks man! #1 solved my problem quite right... tough, i couldnt find the context.xml in the documentation whatsoever On 2/9/06, Hans Sowa [EMAIL PROTECTED] wrote: Hi I hope I had the same problem ;O) My server.xml was correct but I did following steps to solve this problem: 1. I created a context.xml in my META-INF Folder. With this content: Context path=/ContextName docBase=ContextName debug=1 reloadable=true ResourceLink name=xxxblablba global=xxxblabla type=javax.sql.DataSource/ ResourceLink name=xxxblablba2 global=xxxblablba2 type=javax.sql.DataSource/ /Context 2.I guess you have a correct web.xml but anyway: In the web.xml you need this lines. resource-ref descriptionxxxblablbaOracle Datasource/description res-ref-namexxxblablba/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref resource-ref descriptionxxxblablba2 Oracle Datasource/description res-ref-namexxxblablba2/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref The String marked with xxx xxx has to be changed of course but this should solve your problem. My problem was that the context.xml was missing. Hope this will help. best regards Hans 2006/2/9, Marcelo Fukushima [EMAIL PROTECTED]: Hello guys... its gonna sound really stupid, but i cant seen to configure JNDI to work (either global and context bound)... im getting this exception, wich sugested that something was wrong, maybe in the server.xml sintax or something, but even the tomcat manager cant make it work: Cannot create JDBC driver of class '' for connect URL 'null' im running out of ideas so if anyone can help me out, id apreciate it very much... thanks in advance... -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mfg Hans Sowa mailto:[EMAIL PROTECTED] -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mfg Hans Sowa mailto:[EMAIL PROTECTED]
Re: starting with JNDI
oh sorry... im using 5.5, tough hans solved my problems, but thanks for listening... On 2/9/06, Glen Mazza [EMAIL PROTECTED] wrote: Perhaps best to give the version of Tomcat you're using. Glen Marcelo Fukushima wrote: Hello guys... its gonna sound really stupid, but i cant seen to configure JNDI to work (either global and context bound)... im getting this exception, wich sugested that something was wrong, maybe in the server.xml sintax or something, but even the tomcat manager cant make it work: Cannot create JDBC driver of class '' for connect URL 'null' im running out of ideas so if anyone can help me out, id apreciate it very much... thanks in advance... -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with Tomcat and Java versions
Hey, First of all thank you very much for the attention. I got some reading about it and found the jars [jaxp_parser_impl].jar and [xml-commons-apis].jar under /usr/share/tomcat5/common/endorsed I renamed them (so they could not be found) and restarted the server (the computer, I mean). Still, didn't work. The problem remains just as it was before :( On 2/9/06, Caldarale, Charles R [EMAIL PROTECTED] wrote: From: Letícia Álvares Barbalho [mailto:[EMAIL PROTECTED] Subject: Problem with Tomcat and Java versions I was using java 1.4.2 here, and recently migrated to java 1.5. Unfortunately, something probably is missing, 'cause I'm having problems with Tomcat. You don't say what Tomcat version you're using. If you were running 5.5.xon JRE 1.4.2, there may in fact be something extra, not something missing. The compatibility package that's required for 1.4.2 execution should be removed when using JRE 5; the package consists of two jars in common/endorsed, and these should be deleted. Of course, this may or may not have anything to do with your problem, but it's something to try. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Letícia Álvares Barbalho [EMAIL PROTECTED]
Re: Logging session timeouts
I got your code in, and it compiles, but I don't understand how I configure the url-mapping you refer to. Could you point me to some docs for that? I looked through the web.xml files (both the server one, and the one for the app), but couldn't find anything about url-mapping or filters that seemed to apply to this. It may be there, but I don't know enough about it to recognize it. Thanks! Dave Tim Lucia wrote: Below is a filter which keeps track of how many sessions are attached to a web app. The key part is the HttpSessionBindingListener interface. Tim /** * J2EE Filter to count page hits. What it counts depends on the url-mapping * in web.xml. * * @author tim.lucia */ public class SessionCountFilter implements Filter, HttpSessionBindingListener, Serializable { private final static Log logger = LogFactory.getLog(SessionCountFilter.class); public static final Hashtable sessions = new Hashtable(); public static int sessionCountHighWater = 0; /** * Container startup notification */ public void init(FilterConfig arg0) throws ServletException { logger.debug(init(): + arg0); } /** * Container shutdown notification */ public void destroy() { logger.debug(destroy()); } /** * Process the container's filter request. * @param request - Request object * @param response - response object * @param chain - next filter in the chain. */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(request, response); HttpServletRequest httpRequest = (HttpServletRequest)request; HttpSession session = httpRequest.getSession(false); if (logger.isDebugEnabled()) { logger.debug(Request + httpRequest.getRequestURI() + (session == null ? returned no session : belongs to session ID + session.getId())); } // Bind to the session, if there is one, and it is new: if (null != session session.isNew()) { session.setAttribute(toString(), this); } } /** * Implement HttpSessionBindingListener#valueBound */ public void valueBound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = session.getId(); sessions.put(session, sessionID); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] CREATE: + sessionID); } sessionCountHighWater = (sessionCountHighWater sessions.size() ? sessions.size() : sessionCountHighWater); } /** * Implement HttpSessionBindingListener#valueUnbound */ public void valueUnbound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = (String)sessions.get(session); sessions.remove(session); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] DESTROY: + sessionID); } } /** * Return current count of sessions * @return The number of sessions currently tracked */ public static int getSessionCount() { return sessions.size(); } /** * Return high water mark of number of sessions * @return The high water mark of sessions tracked */ public static int getSessionCountHighWater() { return sessionCountHighWater; } /** * Return string representation of this object * @return a String representation of this object */ public String toString() { return getClass().getName() + # + hashCode(); } } -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 9:38 AM To: Tomcat Users List Subject: Logging session timeouts Is there any way of trapping session timeouts, so I can log them? I am logging when a user logs in and when they explicitly log out, but would like to log when their session times out, if that is possible. TIA! Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat not finding native library
(Sorry if this message is repeated - not sure my messages are reaching the list) Version 5.5.15 Tomcat is not finding libtcnative-1.so, it is located in the java.library.path and permissions are good. Nothing seems to be wrong with the library: app1:/usr/share/tomcat/bin # ldd libtcnative-1.so libapr-0.so.0 = /usr/lib64/libapr-0.so.0 (0x002a95662000) librt.so.1 = /lib64/tls/librt.so.1 (0x002a95788000) libm.so.6 = /lib64/tls/libm.so.6 (0x002a9589) libcrypt.so.1 = /lib64/libcrypt.so.1 (0x002a959e8000) libnsl.so.1 = /lib64/libnsl.so.1 (0x002a95b21000) libpthread.so.0 = /lib64/tls/libpthread.so.0 (0x002a95c37000) libdl.so.2 = /lib64/libdl.so.2 (0x002a95d4b000) libssl.so.0.9.7 = /usr/lib64/libssl.so.0.9.7 (0x002a95e4f000) libcrypto.so.0.9.7 = /usr/lib64/libcrypto.so.0.9.7 (0x002a95f85000) libc.so.6 = /lib64/tls/libc.so.6 (0x002a961b6000) /lib64/ld-linux-x86-64.so.2 (0x00552000) Could it be that the library is 64bit? libtcnative-1.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped Does tomcat expect to find a 32-bit file? Does it matter? APR is (of course) also 64-bit. Other than that I can think of nothing else. thanks, -Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: starting with JNDI
actually, i could solve it without the context.xml, just adding the ResouceLink tag, linking the global resource to the local definition... On 2/9/06, Marcelo Fukushima [EMAIL PROTECTED] wrote: oh sorry... im using 5.5, tough hans solved my problems, but thanks for listening... On 2/9/06, Glen Mazza [EMAIL PROTECTED] wrote: Perhaps best to give the version of Tomcat you're using. Glen Marcelo Fukushima wrote: Hello guys... its gonna sound really stupid, but i cant seen to configure JNDI to work (either global and context bound)... im getting this exception, wich sugested that something was wrong, maybe in the server.xml sintax or something, but even the tomcat manager cant make it work: Cannot create JDBC driver of class '' for connect URL 'null' im running out of ideas so if anyone can help me out, id apreciate it very much... thanks in advance... -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- []'s Marcelo Takeshi Fukushima -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Environment Entry
Another sily question: how do i retrieve these Environment Entries within an application? im using tomcat 5.5 thanks again -- []'s Marcelo Takeshi Fukushima - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging session timeouts
Add the following fragment to your web.xml: !-- Session Counting Filter -- !-- Every request passing through this filter will be checked for a -- !-- newly-created session, which will be then counted against the -- !-- total sessions using this application.-- filter filter-nameSessionCountFilter/filter-name filter-classSessionCountFilter/filter-class /filter filter-mapping filter-nameSessionCountFilter/filter-name url-pattern/*/url-pattern /filter-mapping -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 10:56 AM To: Tomcat Users List Subject: Re: Logging session timeouts I got your code in, and it compiles, but I don't understand how I configure the url-mapping you refer to. Could you point me to some docs for that? I looked through the web.xml files (both the server one, and the one for the app), but couldn't find anything about url-mapping or filters that seemed to apply to this. It may be there, but I don't know enough about it to recognize it. Thanks! Dave Tim Lucia wrote: Below is a filter which keeps track of how many sessions are attached to a web app. The key part is the HttpSessionBindingListener interface. Tim /** * J2EE Filter to count page hits. What it counts depends on the url-mapping * in web.xml. * * @author tim.lucia */ public class SessionCountFilter implements Filter, HttpSessionBindingListener, Serializable { private final static Log logger = LogFactory.getLog(SessionCountFilter.class); public static final Hashtable sessions = new Hashtable(); public static int sessionCountHighWater = 0; /** * Container startup notification */ public void init(FilterConfig arg0) throws ServletException { logger.debug(init(): + arg0); } /** * Container shutdown notification */ public void destroy() { logger.debug(destroy()); } /** * Process the container's filter request. * @param request - Request object * @param response - response object * @param chain - next filter in the chain. */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(request, response); HttpServletRequest httpRequest = (HttpServletRequest)request; HttpSession session = httpRequest.getSession(false); if (logger.isDebugEnabled()) { logger.debug(Request + httpRequest.getRequestURI() + (session == null ? returned no session : belongs to session ID + session.getId())); } // Bind to the session, if there is one, and it is new: if (null != session session.isNew()) { session.setAttribute(toString(), this); } } /** * Implement HttpSessionBindingListener#valueBound */ public void valueBound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = session.getId(); sessions.put(session, sessionID); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] CREATE: + sessionID); } sessionCountHighWater = (sessionCountHighWater sessions.size() ? sessions.size() : sessionCountHighWater); } /** * Implement HttpSessionBindingListener#valueUnbound */ public void valueUnbound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = (String)sessions.get(session); sessions.remove(session); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] DESTROY: + sessionID); } } /** * Return current count of sessions * @return The number of sessions currently tracked */ public static int getSessionCount() { return sessions.size(); } /** * Return high water mark of number of sessions * @return The high water mark of sessions tracked */ public static int getSessionCountHighWater() { return sessionCountHighWater; } /** * Return string representation of this object * @return a String representation of this object */ public String toString() { return getClass().getName() + # + hashCode(); } } -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 9:38 AM To: Tomcat Users List Subject: Logging session timeouts Is there any way of trapping session timeouts, so I can log them? I am logging when a user logs in and when they explicitly log out, but would like to log when their session times
Re: Help me
Setting a classpath will not work as tomcat doesn't use it. At least that is what I have read and experienced. putting you stuff in the CLASSPATH tomcat uses is a more likely scenario. On my system I can only find it in one place: /usr/local/server/webapps/manager/WEB-INF/lib/commons-fileupload-1.0.jar Do you have the manager app installed? Mir Kasim Ali wrote: I am getting following error * org.apache.jasper.JasperException: Unable to compile class for JSP Generated servlet error: Only a type can be imported. org.apache.commons.fileupload.DiskFileUpload resolves to a package Generated servlet error: Only a type can be imported. org.apache.commons.fileupload.FileItem resolves to a package An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: DiskFileUpload cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: DiskFileUpload cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: FileItem cannot be resolved to a type An error occurred at line: 12 in the jsp file: /ProcessFileUpload.jsp Generated servlet error: FileItem cannot be resolved to a type WHEN I AM COMPILING THE A JSP FILE(REQESTING THE JSP FILE THROUGH BROWSER) IN JSP I IMPORTED FOLLOWINGS %@ page import=org.apache.commons.fileupload.DiskFileUpload% %@ page import=org.apache.commons.fileupload.FileItem% %@ page import=java.util.List% %@ page import=java.util.Iterator% %@ page import=java.io.File% sO PLEASE HELP ME TO GET IT WORK.IS THIS ERROR IS DUE TO CLASS PATH.IF YES THEN PLS SUGGEST ME WHAT PATH I SET FOR IT -- Mike Sabroff Web Services Developer [EMAIL PROTECTED] 920-568-8379 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help me
The error reported is: org.apache.jasper.JasperException: Unable to compile class for JSP Generated servlet error: Only a type can be imported. org.apache.commons.fileupload.DiskFileUpload resolves to a package And the JSP page is: %@ page import=org.apache.commons.fileupload.DiskFileUpload% %@ page import=org.apache.commons.fileupload.FileItem% %@ page import=java.util.List% %@ page import=java.util.Iterator% %@ page import=java.io.File% Look at the error, the part that says org.apache.commons.fileupload.DiskFileUpload resolves to a package and look at the first import statement, the one that imports org.apache.commons.fileupload.DiskFileUpload and use just a smattering of basic Java knowledge. Asked another way: What do you imagine would happen if I tried to do the following in a regular java program (or heck, a JSP): import java.io; This exception has nothing to do with using a single import statement vs. multiple ones, or where you put your jar file or CLASSPATH. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging session timeouts
Here is the code I use, instead of a filter, I use a listener so I don't have to worry about setting urls. This part is in web.xml listener listener-classyourpackage.SessionListener/listener-class /listener The majority of this code was found online (and I think came from coreservlets.com) package yourpackage; import java.util.Date; import java.util.Enumeration; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class SessionListener implements ServletContextListener, HttpSessionListener{ private static int sessionCount=0; protected transient final Log logger = LogFactory.getLog(this.getClass()); public void contextInitialized(ServletContextEvent sce) { sce.getServletContext().setAttribute(sessionListener,this); } public void contextDestroyed(ServletContextEvent sce) { } public synchronized void sessionCreated(HttpSessionEvent event){ HttpSession session = event.getSession(); // session.setMaxInactiveInterval(60); synchronized (this) { sessionCount++; } String id = session.getId(); Date now = new Date(); String message = new StringBuffer(New Session created on ).append( now.toString()).append(\nID: ).append(id).append(\n) .append(There are now ).append( + sessionCount).append( live sessions in the application.).toString(); this.logger.debug(Created: + message); session.setAttribute(sessionstarted,new Date()); } public void sessionDestroyed(HttpSessionEvent event) { HttpSession session = event.getSession(); String id = session.getId(); synchronized (this) { sessionCount--; } String message = new StringBuffer(Session destroyed + \nValue of destroyed session ID is ).append( + id) .append(\n).append(There are now ) .append( + sessionCount).append( live sessions in the application.).toString(); this.logger.debug(Destroyed: + message); Date d = (Date)session.getAttribute(sessionstarted); this.logger.debug(Session Length: +millisecondsToString(System.currentTimeMillis() - d.getTime())); Enumeration stuff = session.getAttributeNames(); while (stuff.hasMoreElements()) { String name = (String) stuff.nextElement(); // Object value = session.getAttribute(name); this.logger.debug(Attribute Name:+name); } } public int getSessionCount() { return sessionCount; } /** * Converts time in milliseconds to a codeString/code in the format Days HH:mm:ss.SSS. * @param time the time in milliseconds. * @return a codeString/code representing the time in the format Days HH:mm:ss.SSS. */ public static String millisecondsToString(long time) { int milliseconds = (int)(time % 1000); int seconds = (int)((time/1000) % 60); int minutes = (int)((time/6) % 60); int hours = (int)((time/360) % 24); int days = (int)((time/360)/24); //hours += days*24; String millisecondsStr = (milliseconds10 ? 00 : (milliseconds100 ? 0 : ))+milliseconds; String secondsStr = (seconds10 ? 0 : )+seconds; String minutesStr = (minutes10 ? 0 : )+minutes; String hoursStr = (hours10 ? 0 : )+hours; return new String(days+ Days +hoursStr+:+minutesStr+:+secondsStr+.+millisecondsStr); } } -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 9:56 AM To: Tomcat Users List Subject: Re: Logging session timeouts I got your code in, and it compiles, but I don't understand how I configure the url-mapping you refer to. Could you point me to some docs for that? I looked through the web.xml files (both the server one, and the one for the app), but couldn't find anything about url-mapping or filters that seemed to apply to this. It may be there, but I don't know enough about it to recognize it. Thanks! Dave Tim Lucia wrote: Below is a filter which keeps track of how many sessions are attached to a web app. The
RE: Environment Entry
From: Marcelo Fukushima [mailto:[EMAIL PROTECTED] Subject: Environment Entry Another sily question: how do i retrieve these Environment Entries within an application? im using tomcat 5.5 There are examples here: http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Logging session timeouts
Cool; I'll give that one a try as well. Do you have any idea which one is likely to give less of a performance hit in an environment of 50 to 100 simultaneous users, where everything is done in a session, and there is no static content? Dave Joey Geiger wrote: Here is the code I use, instead of a filter, I use a listener so I don't have to worry about setting urls. This part is in web.xml listener listener-classyourpackage.SessionListener/listener-class /listener The majority of this code was found online (and I think came from coreservlets.com) package yourpackage; import java.util.Date; import java.util.Enumeration; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class SessionListener implements ServletContextListener, HttpSessionListener{ private static int sessionCount=0; protected transient final Log logger = LogFactory.getLog(this.getClass()); public void contextInitialized(ServletContextEvent sce) { sce.getServletContext().setAttribute(sessionListener,this); } public void contextDestroyed(ServletContextEvent sce) { } public synchronized void sessionCreated(HttpSessionEvent event){ HttpSession session = event.getSession(); // session.setMaxInactiveInterval(60); synchronized (this) { sessionCount++; } String id = session.getId(); Date now = new Date(); String message = new StringBuffer(New Session created on ).append( now.toString()).append(\nID: ).append(id).append(\n) .append(There are now ).append( + sessionCount).append( live sessions in the application.).toString(); this.logger.debug(Created: + message); session.setAttribute(sessionstarted,new Date()); } public void sessionDestroyed(HttpSessionEvent event) { HttpSession session = event.getSession(); String id = session.getId(); synchronized (this) { sessionCount--; } String message = new StringBuffer(Session destroyed + \nValue of destroyed session ID is ).append( + id) .append(\n).append(There are now ) .append( + sessionCount).append( live sessions in the application.).toString(); this.logger.debug(Destroyed: + message); Date d = (Date)session.getAttribute(sessionstarted); this.logger.debug(Session Length: +millisecondsToString(System.currentTimeMillis() - d.getTime())); Enumeration stuff = session.getAttributeNames(); while (stuff.hasMoreElements()) { String name = (String) stuff.nextElement(); // Object value = session.getAttribute(name); this.logger.debug(Attribute Name:+name); } } public int getSessionCount() { return sessionCount; } /** * Converts time in milliseconds to a codeString/code in the format Days HH:mm:ss.SSS. * @param time the time in milliseconds. * @return a codeString/code representing the time in the format Days HH:mm:ss.SSS. */ public static String millisecondsToString(long time) { int milliseconds = (int)(time % 1000); int seconds = (int)((time/1000) % 60); int minutes = (int)((time/6) % 60); int hours = (int)((time/360) % 24); int days = (int)((time/360)/24); //hours += days*24; String millisecondsStr = (milliseconds10 ? 00 : (milliseconds100 ? 0 : ))+milliseconds; String secondsStr = (seconds10 ? 0 : )+seconds; String minutesStr = (minutes10 ? 0 : )+minutes; String hoursStr = (hours10 ? 0 : )+hours; return new String(days+ Days +hoursStr+:+minutesStr+:+secondsStr+.+millisecondsStr); } } -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 9:56 AM To: Tomcat Users List Subject: Re: Logging session timeouts I got your code in, and it compiles, but I don't understand how I configure the url-mapping you refer to. Could you point me to some docs for that? I looked through the web.xml files (both the server one, and the one for the app), but couldn't find
Re: Logging session timeouts
That got me going; thanks! One more question: Is there any way of telling if the session was actively invalidated, or if it timed out? Looking at the docs for HttpSessionBindingEvent, I don't see any differentiation between them. That's not a big deal, but would be nice to have. Dave Tim Lucia wrote: Add the following fragment to your web.xml: !-- Session Counting Filter -- !-- Every request passing through this filter will be checked for a -- !-- newly-created session, which will be then counted against the -- !-- total sessions using this application.-- filter filter-nameSessionCountFilter/filter-name filter-classSessionCountFilter/filter-class /filter filter-mapping filter-nameSessionCountFilter/filter-name url-pattern/*/url-pattern /filter-mapping -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 10:56 AM To: Tomcat Users List Subject: Re: Logging session timeouts I got your code in, and it compiles, but I don't understand how I configure the url-mapping you refer to. Could you point me to some docs for that? I looked through the web.xml files (both the server one, and the one for the app), but couldn't find anything about url-mapping or filters that seemed to apply to this. It may be there, but I don't know enough about it to recognize it. Thanks! Dave Tim Lucia wrote: Below is a filter which keeps track of how many sessions are attached to a web app. The key part is the HttpSessionBindingListener interface. Tim /** * J2EE Filter to count page hits. What it counts depends on the url-mapping * in web.xml. * * @author tim.lucia */ public class SessionCountFilter implements Filter, HttpSessionBindingListener, Serializable { private final static Log logger = LogFactory.getLog(SessionCountFilter.class); public static final Hashtable sessions = new Hashtable(); public static int sessionCountHighWater = 0; /** * Container startup notification */ public void init(FilterConfig arg0) throws ServletException { logger.debug(init(): + arg0); } /** * Container shutdown notification */ public void destroy() { logger.debug(destroy()); } /** * Process the container's filter request. * @param request - Request object * @param response - response object * @param chain - next filter in the chain. */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(request, response); HttpServletRequest httpRequest = (HttpServletRequest)request; HttpSession session = httpRequest.getSession(false); if (logger.isDebugEnabled()) { logger.debug(Request + httpRequest.getRequestURI() + (session == null ? returned no session : belongs to session ID + session.getId())); } // Bind to the session, if there is one, and it is new: if (null != session session.isNew()) { session.setAttribute(toString(), this); } } /** * Implement HttpSessionBindingListener#valueBound */ public void valueBound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = session.getId(); sessions.put(session, sessionID); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] CREATE: + sessionID); } sessionCountHighWater = (sessionCountHighWater sessions.size() ? sessions.size() : sessionCountHighWater); } /** * Implement HttpSessionBindingListener#valueUnbound */ public void valueUnbound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = (String)sessions.get(session); sessions.remove(session); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] DESTROY: + sessionID); } } /** * Return current count of sessions * @return The number of sessions currently tracked */ public static int getSessionCount() { return sessions.size(); } /** * Return high water mark of number of sessions * @return The high water mark of sessions tracked */ public static int getSessionCountHighWater() { return sessionCountHighWater; } /** * Return string representation of this object * @return a String representation of this object */ public String toString() { return getClass().getName() + # + hashCode(); } } -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 9:38 AM To: Tomcat Users List Subject: Logging session timeouts Is there any way of trapping session
RE: Logging session timeouts
I don't believe so. Someone please correct me if I am wrong. -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 12:09 PM To: Tomcat Users List Subject: Re: Logging session timeouts That got me going; thanks! One more question: Is there any way of telling if the session was actively invalidated, or if it timed out? Looking at the docs for HttpSessionBindingEvent, I don't see any differentiation between them. That's not a big deal, but would be nice to have. Dave Tim Lucia wrote: Add the following fragment to your web.xml: !-- Session Counting Filter -- !-- Every request passing through this filter will be checked for a -- !-- newly-created session, which will be then counted against the -- !-- total sessions using this application. -- filter filter-nameSessionCountFilter/filter-name filter-classSessionCountFilter/filter-class /filter filter-mapping filter-nameSessionCountFilter/filter-name url-pattern/*/url-pattern /filter-mapping -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 10:56 AM To: Tomcat Users List Subject: Re: Logging session timeouts I got your code in, and it compiles, but I don't understand how I configure the url-mapping you refer to. Could you point me to some docs for that? I looked through the web.xml files (both the server one, and the one for the app), but couldn't find anything about url-mapping or filters that seemed to apply to this. It may be there, but I don't know enough about it to recognize it. Thanks! Dave Tim Lucia wrote: Below is a filter which keeps track of how many sessions are attached to a web app. The key part is the HttpSessionBindingListener interface. Tim /** * J2EE Filter to count page hits. What it counts depends on the url-mapping * in web.xml. * * @author tim.lucia */ public class SessionCountFilter implements Filter, HttpSessionBindingListener, Serializable { private final static Log logger = LogFactory.getLog(SessionCountFilter.class); public static final Hashtable sessions = new Hashtable(); public static int sessionCountHighWater = 0; /** * Container startup notification */ public void init(FilterConfig arg0) throws ServletException { logger.debug(init(): + arg0); } /** * Container shutdown notification */ public void destroy() { logger.debug(destroy()); } /** * Process the container's filter request. * @param request - Request object * @param response - response object * @param chain - next filter in the chain. */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(request, response); HttpServletRequest httpRequest = (HttpServletRequest)request; HttpSession session = httpRequest.getSession(false); if (logger.isDebugEnabled()) { logger.debug(Request + httpRequest.getRequestURI() + (session == null ? returned no session : belongs to session ID + session.getId())); } // Bind to the session, if there is one, and it is new: if (null != session session.isNew()) { session.setAttribute(toString(), this); } } /** * Implement HttpSessionBindingListener#valueBound */ public void valueBound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = session.getId(); sessions.put(session, sessionID); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] CREATE: + sessionID); } sessionCountHighWater = (sessionCountHighWater sessions.size() ? sessions.size() : sessionCountHighWater); } /** * Implement HttpSessionBindingListener#valueUnbound */ public void valueUnbound(HttpSessionBindingEvent bindEvent) { HttpSession session = bindEvent.getSession(); final String sessionID = (String)sessions.get(session); sessions.remove(session); if (logger.isDebugEnabled()) { logger.debug([ + sessions.size() + ] DESTROY: + sessionID); } } /** * Return current count of sessions * @return The number of sessions currently tracked */ public static int getSessionCount() { return sessions.size(); } /** * Return high water mark of number of sessions * @return The high water mark of sessions tracked */ public static int getSessionCountHighWater() { return sessionCountHighWater; } /** * Return string representation of this object * @return a String representation of this object */ public String toString() { return
RE: Logging session timeouts
While the user can delete the cookie that is associated with the session, the server will consider the session valid until it times out, as the user is unable to end the session manually. If you add in a link/button that says Remove my session from server and then have the application invalidate the session, the listener would still log it the same as if the server did it automatically, but you also now have control over logging that. I might be wrong (a famous saying) but I don't know how effective the Filter version of the system will be, as it needs to be invoked via a request in order to process/expire the session. The listener is able to log sessions as they end, and not require a user to hit the filter first. (If a user goes inactive, the session will expire, and the listener will catch it and log it) -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 11:09 AM To: Tomcat Users List Subject: Re: Logging session timeouts That got me going; thanks! One more question: Is there any way of telling if the session was actively invalidated, or if it timed out? Looking at the docs for HttpSessionBindingEvent, I don't see any differentiation between them. That's not a big deal, but would be nice to have. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Logging session timeouts
Joey Geiger wrote: While the user can delete the cookie that is associated with the session, the server will consider the session valid until it times out, as the user is unable to end the session manually. If you add in a link/button that says Remove my session from server and then have the application invalidate the session, the listener would still log it the same as if the server did it automatically, but you also now have control over logging that. That's essentially what I have: a log out link, whch logs it and calls session.invaildate(), but I know not all my users use it. I might be wrong (a famous saying) but I don't know how effective the Filter version of the system will be, as it needs to be invoked via a request in order to process/expire the session. The listener is able to log sessions as they end, and not require a user to hit the filter first. (If a user goes inactive, the session will expire, and the listener will catch it and log it) -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 11:09 AM To: Tomcat Users List Subject: Re: Logging session timeouts That got me going; thanks! One more question: Is there any way of telling if the session was actively invalidated, or if it timed out? Looking at the docs for HttpSessionBindingEvent, I don't see any differentiation between them. That's not a big deal, but would be nice to have. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging session timeouts
The filter, implementing HttpSessionListener, and binding itself to the session, will be called by Tomcat when the session is invalidated (all bound values which implement HttpSessionListener will have their valueUnbound method called.) So, the filter is effective in that it won't miss any session unbind events as long as the filter captures the creation request as well. If you create the session but the request which does so has not passed through the filter, then it will not know when the session goes away. So in the listener case, you are guaranteed a call from the server any time any session is created. That might be a better approach, depending on your need(s). In my case, the filter does a whole lot more, but I stripped it down before posting it to only show the relevant section. Tim -Original Message- From: Joey Geiger [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 12:27 PM To: 'Tomcat Users List' Subject: RE: Logging session timeouts While the user can delete the cookie that is associated with the session, the server will consider the session valid until it times out, as the user is unable to end the session manually. If you add in a link/button that says Remove my session from server and then have the application invalidate the session, the listener would still log it the same as if the server did it automatically, but you also now have control over logging that. I might be wrong (a famous saying) but I don't know how effective the Filter version of the system will be, as it needs to be invoked via a request in order to process/expire the session. The listener is able to log sessions as they end, and not require a user to hit the filter first. (If a user goes inactive, the session will expire, and the listener will catch it and log it) -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 11:09 AM To: Tomcat Users List Subject: Re: Logging session timeouts That got me going; thanks! One more question: Is there any way of telling if the session was actively invalidated, or if it timed out? Looking at the docs for HttpSessionBindingEvent, I don't see any differentiation between them. That's not a big deal, but would be nice to have. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging session timeouts
Thank you for the clarification. -Original Message- From: Tim Lucia [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 11:38 AM To: 'Tomcat Users List' Subject: RE: Logging session timeouts The filter, implementing HttpSessionListener, and binding itself to the session, will be called by Tomcat when the session is invalidated (all bound values which implement HttpSessionListener will have their valueUnbound method called.) So, the filter is effective in that it won't miss any session unbind events as long as the filter captures the creation request as well. If you create the session but the request which does so has not passed through the filter, then it will not know when the session goes away. So in the listener case, you are guaranteed a call from the server any time any session is created. That might be a better approach, depending on your need(s). In my case, the filter does a whole lot more, but I stripped it down before posting it to only show the relevant section. Tim -Original Message- From: Joey Geiger [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 12:27 PM To: 'Tomcat Users List' Subject: RE: Logging session timeouts While the user can delete the cookie that is associated with the session, the server will consider the session valid until it times out, as the user is unable to end the session manually. If you add in a link/button that says Remove my session from server and then have the application invalidate the session, the listener would still log it the same as if the server did it automatically, but you also now have control over logging that. I might be wrong (a famous saying) but I don't know how effective the Filter version of the system will be, as it needs to be invoked via a request in order to process/expire the session. The listener is able to log sessions as they end, and not require a user to hit the filter first. (If a user goes inactive, the session will expire, and the listener will catch it and log it) -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 11:09 AM To: Tomcat Users List Subject: Re: Logging session timeouts That got me going; thanks! One more question: Is there any way of telling if the session was actively invalidated, or if it timed out? Looking at the docs for HttpSessionBindingEvent, I don't see any differentiation between them. That's not a big deal, but would be nice to have. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Disable HTTP / session messages on browser
Hi, Once in about 4-5 times I make a request to a page in my simple JSF application deployed on Tomcat 5, I get this sort of message on the browser - I am sure that I am not setting these messages anywhere in my application or jsp's. HTTP/1.1 500 Internal Server Error Server: Apache-Coyote/1.1 Content-Type: text/html;charset=UTF-8 Content-Language: en Content-Length: 7568 Date: Thu, 09 Feb 2006 17:50:17 GMT Connection: close Can anybody please help me with disabling this sort of messages -- Thanks and best regards, Anoop
Re: Logging session timeouts
Thanks to both of you, Tim and Joey! I've tested them both, and either one of these methods seems to work great for my limited needs. I still have a question about performance: any idea which of these methods (filter or listener) will use less cpu time when handling 50 to 100 simultaneous users, each logged in with their own ID and session? Dave Tim Lucia wrote: The filter, implementing HttpSessionListener, and binding itself to the session, will be called by Tomcat when the session is invalidated (all bound values which implement HttpSessionListener will have their valueUnbound method called.) So, the filter is effective in that it won't miss any session unbind events as long as the filter captures the creation request as well. If you create the session but the request which does so has not passed through the filter, then it will not know when the session goes away. So in the listener case, you are guaranteed a call from the server any time any session is created. That might be a better approach, depending on your need(s). In my case, the filter does a whole lot more, but I stripped it down before posting it to only show the relevant section. Tim -Original Message- From: Joey Geiger [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 12:27 PM To: 'Tomcat Users List' Subject: RE: Logging session timeouts While the user can delete the cookie that is associated with the session, the server will consider the session valid until it times out, as the user is unable to end the session manually. If you add in a link/button that says Remove my session from server and then have the application invalidate the session, the listener would still log it the same as if the server did it automatically, but you also now have control over logging that. I might be wrong (a famous saying) but I don't know how effective the Filter version of the system will be, as it needs to be invoked via a request in order to process/expire the session. The listener is able to log sessions as they end, and not require a user to hit the filter first. (If a user goes inactive, the session will expire, and the listener will catch it and log it) -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 11:09 AM To: Tomcat Users List Subject: Re: Logging session timeouts That got me going; thanks! One more question: Is there any way of telling if the session was actively invalidated, or if it timed out? Looking at the docs for HttpSessionBindingEvent, I don't see any differentiation between them. That's not a big deal, but would be nice to have. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging session timeouts
The listener should get called only once, right? Whereas the filter will get called for every matching URL (keeping in mind it does additional useful things in my case...) and if checks to see if the session is new each and every time. I seem to recall an issue recently (can't find it in a quick scan of the archives) about sessionDestroyed(SessionEvent) being called after the session is invalidated. I think the valueUnbound() method gets called during the destruction process and the session is still valid at this point. DON'T QUOTE ME ON THIS! I wrote the filter a while ago, and have just brought it along as needed... If someone knows for sure... Please let me (us) know. Tim -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 1:16 PM To: Tomcat Users List Subject: Re: Logging session timeouts Thanks to both of you, Tim and Joey! I've tested them both, and either one of these methods seems to work great for my limited needs. I still have a question about performance: any idea which of these methods (filter or listener) will use less cpu time when handling 50 to 100 simultaneous users, each logged in with their own ID and session? Dave Tim Lucia wrote: The filter, implementing HttpSessionListener, and binding itself to the session, will be called by Tomcat when the session is invalidated (all bound values which implement HttpSessionListener will have their valueUnbound method called.) So, the filter is effective in that it won't miss any session unbind events as long as the filter captures the creation request as well. If you create the session but the request which does so has not passed through the filter, then it will not know when the session goes away. So in the listener case, you are guaranteed a call from the server any time any session is created. That might be a better approach, depending on your need(s). In my case, the filter does a whole lot more, but I stripped it down before posting it to only show the relevant section. Tim -Original Message- From: Joey Geiger [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 12:27 PM To: 'Tomcat Users List' Subject: RE: Logging session timeouts While the user can delete the cookie that is associated with the session, the server will consider the session valid until it times out, as the user is unable to end the session manually. If you add in a link/button that says Remove my session from server and then have the application invalidate the session, the listener would still log it the same as if the server did it automatically, but you also now have control over logging that. I might be wrong (a famous saying) but I don't know how effective the Filter version of the system will be, as it needs to be invoked via a request in order to process/expire the session. The listener is able to log sessions as they end, and not require a user to hit the filter first. (If a user goes inactive, the session will expire, and the listener will catch it and log it) -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 11:09 AM To: Tomcat Users List Subject: Re: Logging session timeouts That got me going; thanks! One more question: Is there any way of telling if the session was actively invalidated, or if it timed out? Looking at the docs for HttpSessionBindingEvent, I don't see any differentiation between them. That's not a big deal, but would be nice to have. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging session timeouts
Well let's just think about that for a second. Filter: a filter is called each and every time you make a web request. So even if the filter is highly efficient, if you make 1000 requests in a session, you (that is, the container) will invoke the filter's doFilter method 1000 times. Listener: A session is created exactly once and destroyed exactly once. -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 12:16 PM To: Tomcat Users List Subject: Re: Logging session timeouts I still have a question about performance: any idea which of these methods (filter or listener) will use less cpu time when handling 50 to 100 simultaneous users, each logged in with their own ID and session? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
httpd, tomcat, mod_jk and LAST_MODIFIED
Hello all, I'm having a problem with a couple of my servers, whereby the last modified date of an shtml file isn't being properly reported by the LAST_MODIFIED variable, if server side includes are used in a directory that is served by mod_jk / tomcat. So, to break down the run-on sentance... I have servers, running httpd 2.0.55, tomcat 4.1.31, and mod_jk from tomcat_connectors 1.2.15. I have several users that use the following code to report back the last modified date on their pages, using server-side includes: !--#echo var=LAST_MODIFIED-- If I use server side includes on a page that is served by httpd, outside of a tomcat context, I get the proper response, i.e. the last modified date. Here's an example: http://edjo.usask.ca/test.shtml If I have the same page in a tomcat context, the last modified date is reported as Wednesday, 31-Dec-1969 18:00:00 CST which I believe is the UNIX epoch. This suggests that it's just getting '0' when it reads the last modified date. Here's a corresponding example: http://edjo.usask.ca/classes/test.shtml All other variables report properly. I've hunted through the mailing list archives here with no luck, posted in other forums with no useful response, and Google hasn't been of any help at all. I'm hoping that SOMEBODY has seen this problem, and has a workaround / fix. On the example pages I've posted above, I've included information on my setup - my server software and the included modules. I can also post appropriate configuration files if necessary. Thanks for taking the time to read this. shane doucette, webmaster Department of Computer Science, University of Saskatchewan. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Logging session timeouts
Thanks! It seems to be unanimous then, that for the purposes I need, the listener is the way to go. That was my gut feel as well, but I don't know enough of the internals of session handling to know why it would be that way. GB Developer wrote: Well let's just think about that for a second. Filter: a filter is called each and every time you make a web request. So even if the filter is highly efficient, if you make 1000 requests in a session, you (that is, the container) will invoke the filter's doFilter method 1000 times. Listener: A session is created exactly once and destroyed exactly once. -Original Message- From: David Kerber [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 12:16 PM To: Tomcat Users List Subject: Re: Logging session timeouts I still have a question about performance: any idea which of these methods (filter or listener) will use less cpu time when handling 50 to 100 simultaneous users, each logged in with their own ID and session? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Verisign SSL on Tomcat 5.5.9
Sycamore Days wrote: Follow the instructions here on tomcat's site: Every step is correct, ***EXCEPT*** for the Verisign link: For Verisign.com go to: http://www.verisign.com/support/install/intermediate.html That should be: http://www.verisign.com/support/verisign-intermediate-ca/Trial_Secure_Server_Root/index.html The Trial Root Certificate is what you should use, not the Secure Site Intermediate. That's apparently for paid customers only. I have updated the docs to clarify that there are different CAs for trial and paid certificates. Updated docs will be included in the next release. Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: turning off sessions
On Wed, Feb 08, 2006 at 12:14:36AM +0100, Ed wrote: Yep, JSPs automatically create sessions (part of the JSP spec certainly). To turn session off put %@ page session=false % in your JSP. Beware, that web frameworks such as struts may also create sessions for other purposes (eg, storing the locale). you may also turn this off also beware that tomcat makes it _extremely_ hard to share content between jsp pages that have session=false and those that don't. Even if you try to wrap the access to the session scope in an if statement, tomcat will refuse to compile the jsp file. The closest I could get was a tag file that contained this: c:if test=%= ((PageContext)jspContext).getSession() != null % c:set var=optScope value=%= org.apache.commons.el.ImplicitObjects.creat eSessionScopeMap((PageContext)jspContext) %/ /c:if But even that fails because the getSession() call always returns null, even if there is a session, if the including page has session=false. I really wish there was a session=use_it_if_its_there option. eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Calling Realm.authenticate() doesn't register Principal in with the Session??
I'm trying to re-word these two concepts in a more elegant way: 1) I'm looking for a way to use form based authentication - but unlike with the current form login Realm, I need a way to intercept the persons email address(s) (typed into the username field), so that I can convert that into its corresponding username *before* passing it to the Realm (this cannot be done with the current form based login). For this method, I would *prefer* not to write an override to any existing Realm (Form or WWW-Authenticate) - because users may already have their own. In other words, I would like to be able to call into whatever Realm the user already has configured (provided it's a user/pass one). 2) As an alternative, being able to simply register a given username (void doLogin(Principal p)) with a session via the server API would also be very useful - one could perform their own password or X509 validation inside of a servlet/jsp (using rules that are much more strict than what the current impls support, e.g trust levels/rules for issuers, and revocation checks, and critical subject flags for x509 certs). One could also implement the simplest possible (yet highly customizable) login logic against say, a database: ResultSet rs = ps.exec(SELECT pass FROM auth WHERE user = ? ,request.getParameter(user)); if (Digest.sha1(request.getParameter(pass)) .equals(rs.getString(pwdSha)) ) Tomcat5.doLogin(session, new Principal(request.getParameter(user)); I hope that these two (very different) concepts will be tantalizing enough that some highly simplified auth APIs/concepts will make their way into the server. I have tried to build the first one - but the protected request/response fields in CoyoteRequestFacade cannot be accessed from a external class, and reflection would be needed to cast/call the method. An 'expert' will do much better than I. class Tomcat5: public static boolean tryLogin(HttpServletRequest request, HttpServletRequest response, String user, String pass) throws Exception { Server server = ServerFactory.getServer(); Service service = server.findService(Catalina); if (service==null) throw new NullPointerException(login: Cannot load Service 'Catalina'); Engine engine = (Engine) service.getContainer(); if (engine==null) throw new NullPointerException(login: Cannot load Container for Service 'Catalina'); Host host = null; String hostname = Strings.norm(request.getHeader(Host)); Object[] o = engine.findChildren(); for (int i=0; io.length; i++) { if (!(o[i] instanceof Host)) continue; Host h = (Host)o[i]; String[] list = h.findAliases(); for (int j=0; jlist.length; j++) if (hostname.equalsIgnoreCase(list[j])) { host = h; break; } } if (host==null) throw new NullPointerException(login: Cannot load Host '+hostname+'); String reqbase = Strings.norm(req.getContextPath())+/; Context context = (Context) host.findChild(reqbase); if (context==null) { context = (Context) host.findChild(Strings.clip(reqbase,-1)); } if (context==null) throw new NullPointerException(login: Cannot load Context '+reqbase+'); Manager manager = context.getManager(); HttpSession hses = request.getSession(true); Session session = null; try { session = manager.findSession(hses.getId()); } catch (IOException e) {} if (session==null) throw new NullPointerException(login: Cannot load Session '+reqbase+'); Realm realm = context.getRealm(); LoginConfig config = context.getLoginConfig(); FormAuthenticator auth = null; Pipeline pipe = context.getPipeline(); Valve[] v = pipe.getValves(); for (int i=0; iv.length; i++) { if (v[i] instanceof Authenticator) { auth = (FormAuthenticator)v[i]; //if (true)throw new NullPointerException(o[i].toString()); break; } } if (auth==null) throw new NullPointerException(login: Cannot load Authenticator '+reqbase+'); Principal principal = realm.authenticate(user, pass); if (principal==null) return false; session.setNote(Constants.FORM_PRINCIPAL_NOTE, principal); session.setNote(Constants.SESS_USERNAME_NOTE, user); session.setNote(Constants.SESS_PASSWORD_NOTE, pass); if (true) throw new NullPointerException(request.getClass().toString()+ +response.getClass().toString()); auth.authenticate(((CoyoteRequestFacade)request).request, ((CoyoteResponseFacade)response).response, config); return true; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Tomcat over NFS over multiple hosts, want to separate locations of directories
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Well, I got tomcat running via NFS with these variables starting up: (where /usr/dist/pkgs/... is a NFS mounted RO directory) JAVA_HOME=/usr/dist/pkgs/java CATALINA_BASE=/usr/local/tomcat CATALINA_HOME=/usr/dist/pkgs/tomcat LOG_HOME=/usr/local/logs/$instance.hive/ ARGS=-config $CATALINA_HOME/conf/server.xml TOMCAT_START=$CATALINA_HOME/bin/startup.sh $ARGS TOMCAT_STOP=$CATALINA_HOME/bin/shutdown.sh $ARGS the problem is that anything I put into webapps barfs with the following, looking like it can't find any of it's libraries at /usr/ dist/pkgs/tomcat/common/lib/, even tho I can see them fine from that machine... SEVERE: Begin event threw exception java.lang.ClassNotFoundException: org.apache.catalina.deploy.FilterDef SEVERE: Parse error in application web.xml file at jndi:/localhost/ admin/WEB-INF/web.xml java.lang.ClassNotFoundException: org.apache.catalina.deploy.FilterDef at org.apache.tomcat.util.digester.Digester.createSAXException (Digester.java:2719) at org.apache.tomcat.util.digester.Digester.createSAXException (Digester.java:2745) at org.apache.tomcat.util.digester.Digester.startElement (Digester.java:1278) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElemen t(AbstractSAXParser.java:533) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s canStartElement(XMLDocumentFragmentScannerImpl.java:878) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl $FragmentContentDispatcher.dispatch (XMLDocumentFragmentScannerImpl.java:1693) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s canDocument(XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java:1242) at org.apache.tomcat.util.digester.Digester.parse (Digester.java:1561) at org.apache.catalina.startup.ContextConfig.applicationWebConfig (ContextConfig.java:350) at org.apache.catalina.startup.ContextConfig.start (ContextConfig.java:1055) at org.apache.catalina.startup.ContextConfig.lifecycleEvent (ContextConfig.java:261) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java:119) at org.apache.catalina.core.StandardContext.start (StandardContext.java:4111) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1012) at org.apache.catalina.core.StandardHost.start (StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1012) at org.apache.catalina.core.StandardEngine.start (StandardEngine.java:442) at org.apache.catalina.core.StandardService.start (StandardService.java:450) at org.apache.catalina.core.StandardServer.start (StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java: 551) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start (Bootstrap.java:275) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java: 413) Feb 9, 2006 7:22:42 PM org.apache.catalina.startup.ContextConfig applicationWebConfig SEVERE: Occurred at line 16 column 11 From the docs I read, changing CATALINA_BASE should NOT change where it looks for common/lib .. it should look in $CATALINA_HOME for that... When you use this -Dcatalina.base=$CATALINA_BASE argument, Tomcat will calculate all relative references for files in the following directories based on the value of $CATALINA_BASE instead of $CATALINA_HOME: * conf - Server configuration files (including server.xml) * logs - Log and output files * shared - For classes and resources that must be shared across all web applications * webapps - Automatically loaded web applications * work - Temporary working directories for web applications * temp - Directory used by the JVM for temporary files (java.io.tmp So why is it acting as if it can't find any libraries? Mark Demma Senior UNIX Systems Admin PlanetOut Inc. On 9 Feb 2006, at 0:14, abdurrahman sahin wrote: you may try to manually run tomcat via a script, that may help you to assign tomcat variables seperately i run tomcat via a script (guistart.sh) containing
Re: Realm and Authentication with Tomcat 5.0, Apache 2 and mod_jk 1.2
Mickael Goujon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, We have a web application deployed under Tomcat 5.0 which uses a custom Realm for authentication. This custom Realm basically does a web service call using the user's credentials to authenticate with the web service server (basic WS-I username/password authentication). If the web service call fails (user not allowed to call the web service with his credentials), then Tomcat authentication fails. If the web service call succeed (user has access to the web service), then Tomcat authentication succeed and the Realm will store the Session object returned by the web service in a ThreadLocalContext to be reused later in the web application. This works fine with Tomcat only, but as soon as I add mod_jk and try to use Apache to do the authentication and then pass the credentials to Tomcat (using tomcatAuthentication=false), I get the 403 - access denied page. I'd like to know if, in my configuration (Apache authentication + Tomcat Realm + tomcatAuthentication=false), Apache is supposed to pass the user login/password to the Tomcat Realm or if the realm is not called at all (This would be the bad news I fear)? Sorry for the bad news, but the Tomcat Realm is not called at all in this situation. Also, Apache doesn't forward the password directly (although it is still in encoded in the Header). My combination Apache/Tomcat/mod_jk works when I specify tomcatAuthentication=true. But, I'd like to have Apache authentication and the Tomcat Realm called automatically after that with the username/password... Is this possible or do I have to move my Session creation process somewhere else? A custom Authenticator is probably over-kill here. I would probably just use a custom Valve. But as-is, you do at least have to add something (or, modify your copy of the Tomcat code :) to invoke the Realm. Hope you understood my problem, Cheers, Mickael -- Mickael Goujon Software Engineer Lion Bioscience Ltd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Tomcat over NFS over multiple hosts, want to separate locations of directories
What version of java are you running? - Original Message - From: Mark Demma [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, February 09, 2006 10:38 PM Subject: Re: Using Tomcat over NFS over multiple hosts, want to separate locations of directories -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Well, I got tomcat running via NFS with these variables starting up: (where /usr/dist/pkgs/... is a NFS mounted RO directory) JAVA_HOME=/usr/dist/pkgs/java CATALINA_BASE=/usr/local/tomcat CATALINA_HOME=/usr/dist/pkgs/tomcat LOG_HOME=/usr/local/logs/$instance.hive/ ARGS=-config $CATALINA_HOME/conf/server.xml TOMCAT_START=$CATALINA_HOME/bin/startup.sh $ARGS TOMCAT_STOP=$CATALINA_HOME/bin/shutdown.sh $ARGS the problem is that anything I put into webapps barfs with the following, looking like it can't find any of it's libraries at /usr/ dist/pkgs/tomcat/common/lib/, even tho I can see them fine from that machine... SEVERE: Begin event threw exception java.lang.ClassNotFoundException: org.apache.catalina.deploy.FilterDef SEVERE: Parse error in application web.xml file at jndi:/localhost/ admin/WEB-INF/web.xml java.lang.ClassNotFoundException: org.apache.catalina.deploy.FilterDef at org.apache.tomcat.util.digester.Digester.createSAXException (Digester.java:2719) at org.apache.tomcat.util.digester.Digester.createSAXException (Digester.java:2745) at org.apache.tomcat.util.digester.Digester.startElement (Digester.java:1278) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElemen t(AbstractSAXParser.java:533) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s canStartElement(XMLDocumentFragmentScannerImpl.java:878) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl $FragmentContentDispatcher.dispatch (XMLDocumentFragmentScannerImpl.java:1693) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s canDocument(XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java:1242) at org.apache.tomcat.util.digester.Digester.parse (Digester.java:1561) at org.apache.catalina.startup.ContextConfig.applicationWebConfig (ContextConfig.java:350) at org.apache.catalina.startup.ContextConfig.start (ContextConfig.java:1055) at org.apache.catalina.startup.ContextConfig.lifecycleEvent (ContextConfig.java:261) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java:119) at org.apache.catalina.core.StandardContext.start (StandardContext.java:4111) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1012) at org.apache.catalina.core.StandardHost.start (StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1012) at org.apache.catalina.core.StandardEngine.start (StandardEngine.java:442) at org.apache.catalina.core.StandardService.start (StandardService.java:450) at org.apache.catalina.core.StandardServer.start (StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java: 551) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start (Bootstrap.java:275) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java: 413) Feb 9, 2006 7:22:42 PM org.apache.catalina.startup.ContextConfig applicationWebConfig SEVERE: Occurred at line 16 column 11 From the docs I read, changing CATALINA_BASE should NOT change where it looks for common/lib .. it should look in $CATALINA_HOME for that... When you use this -Dcatalina.base=$CATALINA_BASE argument, Tomcat will calculate all relative references for files in the following directories based on the value of $CATALINA_BASE instead of $CATALINA_HOME: * conf - Server configuration files (including server.xml) * logs - Log and output files * shared - For classes and resources that must be shared across all web applications * webapps - Automatically loaded web applications * work - Temporary working directories for web applications * temp - Directory used by the JVM for temporary files (java.io.tmp So why is it acting as if it can't find
Re: Trouble understanding security constraints
Alan Chandler [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thursday 09 February 2006 04:05, Bill Barker wrote: Alan Chandler [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ... This works correctly in TC 5.x. You need to reverse the order for TC 4.1.x (this is due to a change in the respective versions of the servlet spec they implement). security-constraint web-resource-collection web-resource-name Valid Users /web-resource-name url-pattern /* /url-pattern /web-resource-collection auth-constraint role-name*/role-name /auth-constraint /security-constraint security-constraint web-resource-collection web-resource-name Site Admin /web-resource-name url-pattern /admin/* /url-pattern /web-resource-collection auth-constraint role-nameadmin/role-name /auth-constraint /security-constraint Since I am doing everything for TC 4.1.3 (Debian Stable) and just to be clear, do you mean the following (ie swapping round the security-constraints) security-constraint web-resource-collection web-resource-name Site Admin /web-resource-name url-pattern /admin/* /url-pattern /web-resource-collection auth-constraint role-nameadmin/role-name /auth-constraint /security-constraint security-constraint web-resource-collection web-resource-name Valid Users /web-resource-name url-pattern /* /url-pattern /web-resource-collection auth-constraint role-name*/role-name /auth-constraint /security-constraint Otherwise thank you very much that was very clear. Yes. TC 4.1.x does a first-match on security-constraints (since the 2.3 servlet spec doesn't specify otherwise), so you need to have your longest patterns first. -- Alan Chandler http://www.chandlerfamily.org.uk Open Source. It's the difference between trust and antitrust. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Using Tomcat over NFS over multiple hosts, want to separate locations of directories
From: Mark Demma [mailto:[EMAIL PROTECTED] Subject: Re: Using Tomcat over NFS over multiple hosts, want to separate locations of directories the problem is that anything I put into webapps barfs with the following, looking like it can't find any of it's libraries at /usr/ dist/pkgs/tomcat/common/lib/, even tho I can see them fine from that machine... SEVERE: Begin event threw exception java.lang.ClassNotFoundException: org.apache.catalina.deploy.FilterDef The above class isn't stored in common/lib, it's in server/lib/catalina.jar. Have you checked to make sure that jar is properly accessible and not damaged? I'm a bit surprised Tomcat could get this far if catalina.jar isn't around. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Tomcat over NFS over multiple hosts, want to separate locations of directories
Just wanted to make sure you didn't have 1.4 . Going out on a limb here, do you have allowlinking =true attribute set in you context? It might be worth a try as some of your paths may appear as links to Tomcat even if they are mounted volumes. Doug - Original Message - From: Mark Demma [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Cc: Parsons Technical Services [EMAIL PROTECTED] Sent: Thursday, February 09, 2006 11:02 PM Subject: Re: Using Tomcat over NFS over multiple hosts, want to separate locations of directories -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 java version 1.5.0_06 Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing) Mark Demma Senior UNIX Systems Admin PlanetOut Inc. On 9 Feb 2006, at 19:49, Parsons Technical Services wrote: What version of java are you running? - Original Message - From: Mark Demma [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, February 09, 2006 10:38 PM Subject: Re: Using Tomcat over NFS over multiple hosts, want to separate locations of directories -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Well, I got tomcat running via NFS with these variables starting up: (where /usr/dist/pkgs/... is a NFS mounted RO directory) JAVA_HOME=/usr/dist/pkgs/java CATALINA_BASE=/usr/local/tomcat CATALINA_HOME=/usr/dist/pkgs/tomcat LOG_HOME=/usr/local/logs/$instance.hive/ ARGS=-config $CATALINA_HOME/conf/server.xml TOMCAT_START=$CATALINA_HOME/bin/startup.sh $ARGS TOMCAT_STOP=$CATALINA_HOME/bin/shutdown.sh $ARGS the problem is that anything I put into webapps barfs with the following, looking like it can't find any of it's libraries at / usr/ dist/pkgs/tomcat/common/lib/, even tho I can see them fine from that machine... SEVERE: Begin event threw exception java.lang.ClassNotFoundException: org.apache.catalina.deploy.FilterDef SEVERE: Parse error in application web.xml file at jndi:/ localhost/ admin/WEB-INF/web.xml java.lang.ClassNotFoundException: org.apache.catalina.deploy.FilterDef at org.apache.tomcat.util.digester.Digester.createSAXException (Digester.java:2719) at org.apache.tomcat.util.digester.Digester.createSAXException (Digester.java:2745) at org.apache.tomcat.util.digester.Digester.startElement (Digester.java:1278) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startEle men t(AbstractSAXParser.java:533) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l.s canStartElement(XMLDocumentFragmentScannerImpl.java:878) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l $FragmentContentDispatcher.dispatch (XMLDocumentFragmentScannerImpl.java:1693) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l.s canDocument(XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse ( XML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse ( XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java:1242) at org.apache.tomcat.util.digester.Digester.parse (Digester.java:1561) at org.apache.catalina.startup.ContextConfig.applicationWebConfig (ContextConfig.java:350) at org.apache.catalina.startup.ContextConfig.start (ContextConfig.java:1055) at org.apache.catalina.startup.ContextConfig.lifecycleEvent (ContextConfig.java:261) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java:119) at org.apache.catalina.core.StandardContext.start (StandardContext.java:4111) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1012) at org.apache.catalina.core.StandardHost.start (StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1012) at org.apache.catalina.core.StandardEngine.start (StandardEngine.java:442) at org.apache.catalina.core.StandardService.start (StandardService.java:450) at org.apache.catalina.core.StandardServer.start (StandardServer.java:700) at org.apache.catalina.startup.Catalina.start (Catalina.java: 551) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start (Bootstrap.java:275) at org.apache.catalina.startup.Bootstrap.main
Re: Using Tomcat over NFS over multiple hosts, want to separate locations of directories
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I think I have it, well, at least part of it... using the argument - config $CATALINA_HOME/conf/server.xml allows it to start up, but then if the CATALINA_BASE doesn't have a conf/ directory, it doesn't work. I copied the conf directory from the $CATALINA_HOME directory and got it to start up. I can't for the life of me find anywhere that you can tell tomcat that it should look for it's whole [EMAIL PROTECTED]@ conf/ directory in $CATALINA_HOME NOT $CATALINA_BASE cause wouldn't it be convenient to have ONE conf/ directory mounted for multiple servers on one NFS mount. Yes, NFS is satan, etc etc... but it's what I've got to work with. Mark Demma Senior UNIX Systems Admin PlanetOut Inc. On 9 Feb 2006, at 21:02, Parsons Technical Services wrote: Just wanted to make sure you didn't have 1.4 . Going out on a limb here, do you have allowlinking =true attribute set in you context? It might be worth a try as some of your paths may appear as links to Tomcat even if they are mounted volumes. Doug - Original Message - From: Mark Demma [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Cc: Parsons Technical Services [EMAIL PROTECTED] Sent: Thursday, February 09, 2006 11:02 PM Subject: Re: Using Tomcat over NFS over multiple hosts, want to separate locations of directories -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 java version 1.5.0_06 Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing) Mark Demma Senior UNIX Systems Admin PlanetOut Inc. On 9 Feb 2006, at 19:49, Parsons Technical Services wrote: What version of java are you running? - Original Message - From: Mark Demma [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, February 09, 2006 10:38 PM Subject: Re: Using Tomcat over NFS over multiple hosts, want to separate locations of directories -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Well, I got tomcat running via NFS with these variables starting up: (where /usr/dist/pkgs/... is a NFS mounted RO directory) JAVA_HOME=/usr/dist/pkgs/java CATALINA_BASE=/usr/local/tomcat CATALINA_HOME=/usr/dist/pkgs/tomcat LOG_HOME=/usr/local/logs/$instance.hive/ ARGS=-config $CATALINA_HOME/conf/server.xml TOMCAT_START=$CATALINA_HOME/bin/startup.sh $ARGS TOMCAT_STOP=$CATALINA_HOME/bin/shutdown.sh $ARGS the problem is that anything I put into webapps barfs with the following, looking like it can't find any of it's libraries at / usr/ dist/pkgs/tomcat/common/lib/, even tho I can see them fine from that machine... SEVERE: Begin event threw exception java.lang.ClassNotFoundException: org.apache.catalina.deploy.FilterDef SEVERE: Parse error in application web.xml file at jndi:/ localhost/ admin/WEB-INF/web.xml java.lang.ClassNotFoundException: org.apache.catalina.deploy.FilterDef at org.apache.tomcat.util.digester.Digester.createSAXException (Digester.java:2719) at org.apache.tomcat.util.digester.Digester.createSAXException (Digester.java:2745) at org.apache.tomcat.util.digester.Digester.startElement (Digester.java:1278) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startE le men t(AbstractSAXParser.java:533) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerI mp l.s canStartElement(XMLDocumentFragmentScannerImpl.java:878) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerI mp l $FragmentContentDispatcher.dispatch (XMLDocumentFragmentScannerImpl.java:1693) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerI mp l.s canDocument(XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse ( XML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse ( XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java:1242) at org.apache.tomcat.util.digester.Digester.parse (Digester.java:1561) at org.apache.catalina.startup.ContextConfig.applicationWebConfig (ContextConfig.java:350) at org.apache.catalina.startup.ContextConfig.start (ContextConfig.java:1055) at org.apache.catalina.startup.ContextConfig.lifecycleEvent (ContextConfig.java:261) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java:119) at org.apache.catalina.core.StandardContext.start (StandardContext.java:4111) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1012) at org.apache.catalina.core.StandardHost.start
RE: Using Tomcat over NFS over multiple hosts, want to separate locations of directories
From: Mark Demma [mailto:[EMAIL PROTECTED] Subject: Re: Using Tomcat over NFS over multiple hosts, want to separate locations of directories I can't for the life of me find anywhere that you can tell tomcat that it should look for it's whole [EMAIL PROTECTED]@ conf/ directory in $CATALINA_HOME NOT $CATALINA_BASE cause wouldn't it be convenient to have ONE conf/ directory mounted for multiple servers on one NFS mount. I don't think that was the intent of CATALINA_BASE, which appears to have been designed to allow multiple instances of Tomcat _on_one_system_ to execute from a single installation. Since each such instance requires a separate conf/server.xml to define the ports, IP addresses, etc., that has to go under CATALINA_BASE, not CATALINA_HOME (which is pretty much just for code). - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat Security Vulnerabilities
Hi. Just wanting to know if anyone can tell me in which version of Tomcat the bug was fixed that allows you to enter in a URL like http://domain.com/%3f.jsp and get a directory listing. I know it exists in 3.2, just wondering which version it was fixed in. Thanks, Jo. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with Tomcat and Java versions
Do you have the option of reinstalling Tomcat5 - so that Tomcat5 would just pick up java 5 and not have anything at all to do with java 1.4?? -Anoop On 2/9/06, Letícia Álvares Barbalho [EMAIL PROTECTED] wrote: Hey, First of all thank you very much for the attention. I got some reading about it and found the jars [jaxp_parser_impl].jar and [xml-commons-apis].jar under /usr/share/tomcat5/common/endorsed I renamed them (so they could not be found) and restarted the server (the computer, I mean). Still, didn't work. The problem remains just as it was before :( On 2/9/06, Caldarale, Charles R [EMAIL PROTECTED] wrote: From: Letícia Álvares Barbalho [mailto:[EMAIL PROTECTED] Subject: Problem with Tomcat and Java versions I was using java 1.4.2 here, and recently migrated to java 1.5. Unfortunately, something probably is missing, 'cause I'm having problems with Tomcat. You don't say what Tomcat version you're using. If you were running 5.5.xon JRE 1.4.2, there may in fact be something extra, not something missing. The compatibility package that's required for 1.4.2 execution should be removed when using JRE 5; the package consists of two jars in common/endorsed, and these should be deleted. Of course, this may or may not have anything to do with your problem, but it's something to try. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Letícia Álvares Barbalho [EMAIL PROTECTED] -- Thanks and best regards, Anoop
tomcat + certificate
Hi, I am running a tomcat server running here. We have a servlet container hosted in the server. The servlet is called from a java client program and is working fine(http). Then i following the instructions from the tomcat documentation page i installed a self signed certificate. The site now shows up with the certificate from the browser. The problem is while running the java client and connecting to the server(https) the program gives out error(connection timed out/SSL handshake ... etc). Hope i am not raising a dumb question here. What is wrong with my setup? Any pointers. Some one said we have to install apache also. Is that so? Is it possible to make tomcat handle the certificates itself and free the servlet from that. BTW, i am running on FC4, with tomcat version 5.5.12. TIA, SK - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]