Re: Enabling compression in embedded tomcat 7
Perfect. Thanks. --adam http://gordonizer.com On Thu, May 10, 2012 at 5:16 AM, Konstantin Kolinko knst.koli...@gmail.comwrote: 2012/5/10 Adam Gordon adam.n.gor...@gmail.com: I see XML options for enabling compression but am not seeing how this is done programmatically with an embedded tomcat instance. thanks. Look at Connector.setProperty(name, value). That method is what should be called by digester that parses the XML file. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Enabling compression in embedded tomcat 7
I see XML options for enabling compression but am not seeing how this is done programmatically with an embedded tomcat instance. thanks. --adam - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Classpath issues with Embedded Tomcat 7
UPDATE: By adding all my jars in WEB-INF/lib to my launch command classpath, I can get the embedded server to run, but this does not seem correct as then what would be the point of WEB-INF/lib? --- I've been unable to find any decent documentation on how to use Embedded Tomcat so I've been winging it. The issue I'm having is that from what I've gleaned from the web all I *should* need in my classpath for my main method is my main class, tomcat-embed-core.jar, tomcat-embed-logging.juli.jar, tomcat-embed-jasper.jar, and ecj.jar but I'm finding that when trying to launch my main from the command line I keep having to append more and more jars from WEB-INF/lib to my classpath to get it to continue to try and start up because it keeps spitting out NoClassDefFoundErrors. I was under the impression that it would use WEB-INF/lib for the web app's classpath but this is not what's happening. The syntax used below was used from http://people.apache.org/~markt/presentations/2010-11-04-Embedding-Tomcat.pdf, see the section for running a web application. Here's my main: public static void main(String[] args) throws LifecycleException, InterruptedException, ServletException { Tomcat tomcat = new Tomcat(); tomcat.setPort(9090); File docBase = new File(/usr/local/foo/foo-ui); tomcat.addWebapp(null, , docBase.getAbsolutePath()); tomcat.start(); tomcat.getServer().await(); } and here's my launch command: user@host: /usr/local/foo/foo-ui $ java -cp WEB-INF/classes:WEB-INF/lib/tomcat-embed-core-7.0.27.jar:WEB-INF/lib/tomcat-juli-7.0.27.jar:WEB-INF/lib/tomcat-embed-jasper-7.0.27.jar:WEB-INF/lib/ecj-3.7.1.jar com.foo.WebAppMain Anyone have any ideas what I'm doing wrong? Thanks. --adam http://gordonizer.com
Re: Classpath issues with Embedded Tomcat 7
Chris- If this is an update, why not reply to your original thread? It's difficult to keep everything in context when you start a new thread. I got in trouble for using Nabble and my original message never posted, just the update. Since I wasn't sure how to handle or correct it all I just created a new thread knowing I'd probably get in trouble again. C'est la vie. --- As far as the issues I was having. I had WEB-INF/classes in my classpath so that it could find my main class and WEB-INF/classes also contained all my servlets, Spring services, GWT code, etc... hence the third-party library dependencies for SLF4J, GWT, Spring, etc... To solve, I moved the four required JARs (the three tomcat ones and the ECJ JAR) to a separate directory and also created the directory structure for the package in which my main class lives (e.g. com/foo/bar/MainClass) and then just ran: java -cp lib:lib/tomcat-embed-core-7.0.27.jar:lib/tomcat-juli-7.0.27.jar:lib/tomcat-embed-jasper-7.0.27.jar:lib/ecj-3.7.1.jar com.foo.bar.MainClass and everything worked correctly. As an FYI, the docs say Tomcat provides a sensible default for a temp dir which is why I didn't set one. Thanks, --adam - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Classpath issues with Embedded Tomcat 7
On Thu, Apr 19, 2012 at 15:11, Caldarale, Charles R chuck.caldar...@unisys.com wrote: the docs say Tomcat provides a sensible default for a temp dir which is why I didn't set one. That's true when Tomcat is run as a normal server, but for embedded, it will use whatever the JVM decides to set for the system property java.io.tmpdir, which varies depending on platform. Likely better if you pick an explicit location. are you sure? it's creating tomcat.9090 in the same directory as my web application. that aside, i do agree that it's FAR better to explicitly specify one rather than crossing one's fingers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: mod_jk and jsessionid issue
He shouldn't have to set this option. We're using the same configuration, load balanced apache servers and we don't have this configuration set. Additionally, I think you can choose as to whether the session id is cookied vs appending to the request. Unlessare you serving up static images off your apache server? --adam Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Lmk, On 8/17/2009 8:40 AM, lmk wrote: I have a 2 tomcat servers load balanced using apache mod_jk, I have a probleme with images on the login page, the image url generate is postfixed by jsessionid, so, the image is not rendered, the user have to use F5 button. ... plus, users who have cookies disabled will never be able to see images. how to work arround this issue? Use the JkStripSession directive in your Apache httpd configuration. If you have a reasonably recent version of mod_jk, this will remove the ;jsessionid=... parameter from your URLs before httpd tries to serve them. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkqMACUACgkQ9CaO5/Lv0PDHTwCgmvACyRp8C30fK/0pZjKWLXPh CyQAn2cbCecxLjvuFsDbwlMb55eG+1yE =sfW+ -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Monitoring Tomcat availability in a load balanced capacity
André, I only think it's overkill because we're currently not even using mod-proxy so adding this module for the sole purpose of being able to monitor our tomcat servers is what I consider to be overkill. Additionally, with running a proxy comes tons of security enforcement as you need to prevent anyone from outside from being able to use it. Were we already using mod-proxy, your solution is fine but essentially obviates the need for mod JK. --adam André Warnier wrote: Adam Gordon wrote: See my reply to Hassan. I think setting up a proxy would be overkill, and besides, when running Tomcat in a load-balanced capacity w/ sticky sessions using mod JK, while you can connect directly to the port on which Tomcat is listening for mod JK requests, unless you speak mod JK, it doesn't do anything. I'm glad there is another solution available directly through mod_jk, which I was unaware of. But re-read my earlier attempt maybe. I wasn't trying to tell you to talk to the AJP connector from the front-end. I was trying to tell you to talk to Tomcat's HTTP ports, not to interfere with the load balancing, which I presume applies only to requests coming through the AJP connectors. Like, at the Apache front-end level : Location /tomcat1/are_you_there --- proxy to http://tomcat1:8080/imthere.html /Location Location /tomcat2/are_you_there --- proxy to http://tomcat2:8081/imtheretoo.html /Location Seemed pretty clever to me, as a quick solution. ;-) Maybe due to my lack of knowledge, but I don't really see where the overkill would be. --adam André Warnier wrote: Adam Gordon wrote: We're running two Tomcat (5.5.16) instances in a load-balanced capacity behind an Apache server (2.0.55 w/ mod j/k 1.2.14). We'd like to set up some sort of monitoring that would allow us to not just check to see if the Tomcat Java processes are still running (that's easy) but to actually connect to each web server (either independently or via the load-balancer) and verify that a certain page can be returned. Since we're connecting to Tomcat via an Apache load-balancer, we don't know of a way to force the load-balancer to go to a certain Tomcat instance. Additionally, we don't know how to speak mod j/k so we can't fake a direct connection to each Tomcat instance. Does anyone know of a way or a product (commercial or open-source) to achieve this? I don't think you would need a special product to do that, open source or not. On your Apache front-end, it would probably be easy to set up a proxy, which via simple HTTP would proxy just the links you want to either one of your back-end Tomcat HTTP ports. You would need the HTTP Connector active on each Tomcat, but that should already be the case by default. Someone better versed in Apache mod_proxy could help you there. Maybe try the list at [EMAIL PROTECTED] if you don't get more help here. Of course, if you can access your Tomcats directly through their own HTTP ports, then you don't even need that. I'm just assuming you cannot. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Monitoring Tomcat availability in a load balanced capacity
We've discovered a problem with simply adding another (HTTP) Connector in that by allowing a different form of connection to our web app and using this connector for our monitoring, we aren't testing the path that a user would take, which is through the load balancer and mod JK. One of the issues we had was that we had an errant script that was rsync-ing from one Tomcat server to the other (when we had one active and one as a backup) to ensure that the second machine was always up-to-date with the latest version of the web app. When we went from active/passive to active/active w/ a load-balancer, we forgot to remove this script so the server.xml file, where the JVM Route is defined, was getting clobbered with the source Tomcat server's server.xml file and causing major accessibility issues. Having another connector and using that for our monitoring would actually have told us that the server was fine when in fact no one could get to it because Apache became confused when it now has two load balanced servers but they both have the same JVM Route. The 'wget' command allows the user to play with Cookies so our next step is to see if we can specify a fake JSESSIONID in cookie form to see if we can dictate to which server Apache will send us. As previously mentioned, we cannot simply put this on the URL as a parameter because we are using sticky sessions. --adam David Rees wrote: On Wed, Nov 12, 2008 at 1:15 PM, Adam Gordon [EMAIL PROTECTED] wrote: See my reply to Hassan. I think setting up a proxy would be overkill, and besides, when running Tomcat in a load-balanced capacity w/ sticky sessions using mod JK, while you can connect directly to the port on which Tomcat is listening for mod JK requests, unless you speak mod JK, it doesn't do anything. Did you not see my earlier post? It sounds like you should be able to do what you want without any configuration changes at all. -Dave - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Monitoring Tomcat availability in a load balanced capacity
We're running two Tomcat (5.5.16) instances in a load-balanced capacity behind an Apache server (2.0.55 w/ mod j/k 1.2.14). We'd like to set up some sort of monitoring that would allow us to not just check to see if the Tomcat Java processes are still running (that's easy) but to actually connect to each web server (either independently or via the load-balancer) and verify that a certain page can be returned. Since we're connecting to Tomcat via an Apache load-balancer, we don't know of a way to force the load-balancer to go to a certain Tomcat instance. Additionally, we don't know how to speak mod j/k so we can't fake a direct connection to each Tomcat instance. Does anyone know of a way or a product (commercial or open-source) to achieve this? Thanks, --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Monitoring Tomcat availability in a load balanced capacity
Can you please include a link? Google is not helping... Thanks. Alberto Jesus La Rosa Agramonte wrote: application manager, is not free, but with the trial licence you can work with all the functionalities. bye 2008/11/13 Adam Gordon [EMAIL PROTECTED]: We're running two Tomcat (5.5.16) instances in a load-balanced capacity behind an Apache server (2.0.55 w/ mod j/k 1.2.14). We'd like to set up some sort of monitoring that would allow us to not just check to see if the Tomcat Java processes are still running (that's easy) but to actually connect to each web server (either independently or via the load-balancer) and verify that a certain page can be returned. Since we're connecting to Tomcat via an Apache load-balancer, we don't know of a way to force the load-balancer to go to a certain Tomcat instance. Additionally, we don't know how to speak mod j/k so we can't fake a direct connection to each Tomcat instance. Does anyone know of a way or a product (commercial or open-source) to achieve this? Thanks, --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Monitoring Tomcat availability in a load balanced capacity
Hassan- I apologize if I wasn't clear. We are already running Tomcat in a load-balanced capacity with sticky sessions which means the jvmRoute is already set and configured correctly. What we are looking to do is ensure that the actual Tomcat instance isn't a zombie, rather, that it can still accept connections. That said, adding another Connector that does not use mod JK actually works, so this is the route we will take. Thanks. --adam Hassan Schroeder wrote: On Wed, Nov 12, 2008 at 9:42 AM, Adam Gordon [EMAIL PROTECTED] wrote: We're running two Tomcat (5.5.16) instances in a load-balanced capacity behind an Apache server (2.0.55 w/ mod j/k 1.2.14). We'd like to set up some sort of monitoring that would allow us to not just check to see if the Tomcat Java processes are still running (that's easy) but to actually connect to each web server (either independently or via the load-balancer) and verify that a certain page can be returned. Since we're connecting to Tomcat via an Apache load-balancer, we don't know of a way to force the load-balancer to go to a certain Tomcat instance. Additionally, we don't know how to speak mod j/k so we can't fake a direct connection to each Tomcat instance. Simplest: add an HTTP connector to use for testing. :-) Re' forcing the instance to use -- see the entry for jvmRoute in http://tomcat.apache.org/tomcat-5.5-doc/config/engine.html FWIW, - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Monitoring Tomcat availability in a load balanced capacity
See my reply to Hassan. I think setting up a proxy would be overkill, and besides, when running Tomcat in a load-balanced capacity w/ sticky sessions using mod JK, while you can connect directly to the port on which Tomcat is listening for mod JK requests, unless you speak mod JK, it doesn't do anything. --adam André Warnier wrote: Adam Gordon wrote: We're running two Tomcat (5.5.16) instances in a load-balanced capacity behind an Apache server (2.0.55 w/ mod j/k 1.2.14). We'd like to set up some sort of monitoring that would allow us to not just check to see if the Tomcat Java processes are still running (that's easy) but to actually connect to each web server (either independently or via the load-balancer) and verify that a certain page can be returned. Since we're connecting to Tomcat via an Apache load-balancer, we don't know of a way to force the load-balancer to go to a certain Tomcat instance. Additionally, we don't know how to speak mod j/k so we can't fake a direct connection to each Tomcat instance. Does anyone know of a way or a product (commercial or open-source) to achieve this? I don't think you would need a special product to do that, open source or not. On your Apache front-end, it would probably be easy to set up a proxy, which via simple HTTP would proxy just the links you want to either one of your back-end Tomcat HTTP ports. You would need the HTTP Connector active on each Tomcat, but that should already be the case by default. Someone better versed in Apache mod_proxy could help you there. Maybe try the list at [EMAIL PROTECTED] if you don't get more help here. Of course, if you can access your Tomcats directly through their own HTTP ports, then you don't even need that. I'm just assuming you cannot. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat admin webapp LoginModule configuration
I've got the Tomcat admin webapp up and running but am seeing an error (when I try and log in) in catalina.out informing me that there are no LoginModules configured for engine_name We use JAAS for our web app so I'm familiar with the concept of the LoginModule and we have a JAAS Realm defined in our context.xml file for our web app. I would assume that I need to add something similar to the admin.xml file for the admin web app, only I have no idea what to add and Google searching doesn't seem to yield anything useful. Any ideas? --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Communicating on the Tomcat admin port
Is there a way to communicate with Tomcat via the admin port but not have to use the web interface? We're looking at completely automating our deployment process and it would be nice if we could send a signal to Tomcat to shutdown via the command-line. Additionally, if it is possible, are there other things one can do via the admin port? Thanks, --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat admin webapp configuration with mod_jk
We currently use Apache/Tomcat and mod_jk for our webapp. I've downloaded and installed (correctly, I think) the admin web app but am having trouble configuring Apache and Tomcat to recognize that the admin webapp is present. I suspect it's simply a config issue, but can't figure it out. Here's our original server.xml: Server port=11005 shutdown=SHUTDOWN debug=0 Service name=Tomcat-Apache Connector protocol=AJP/1.3 port=11009 URIEncoding=UTF-8 minSpareThreads=0 maxSpareThreads=0 maxThreads=3000 backlog=6000 debug=0 enableLookups=false maxPostSize=-1 connectionTimeout=-1/ Engine name=Standalone defaultHost=localhost debug=0 Host name=localhost debug=0 appBase=webapps unpackWARs=true autoDeploy=true liveDeploy=true deployOnStartup=false Context path= docBase=palomar cookies=false debug=0 crossContext=true allowLinking=true Resources docBase= allowLinking=true/ /Context /Host /Engine /Service /Server I've tried adding another connector (on port 8080) and also adding another context based on the admin.xml file but nothing seems to be working correctly. I have workers.properties configured to redirect to Tomcat and that's working b/c I'm getting a Tomcat 404 error and not an Apache one. I don't care by which means I connect to the admin webapp (either via mod_jk or directly via another port, say 8080 but I just can't seem to figure the configuration issue out. --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat admin webapp configuration with mod_jk
I just figured it out when verifying my installation per your request of my installation steps. It finally clicked when I was looking at the subdirectories in TOMCAT_HOME/conf...there's a Standalone directory and a Catalina directory. Our Engine name is Standalone and host name is localhost - so I moved the admin.xml from the default of conf/Catalina/localhost to conf/Standalone/localhost and voila! it worked. So, now I have a problem whereby I can't log in and Tomcat is complaining that I don't have a LoginModule configured for Standalone. I assume I need to add a JAAS Realm in admin.xml (like we're doing for our web app) but it's not clear how it needs to be configured. Any ideas? --adam Caldarale, Charles R wrote: From: Adam Gordon [mailto:[EMAIL PROTECTED] Subject: Tomcat admin webapp configuration with mod_jk I've downloaded and installed (correctly, I think) the admin web app but am having trouble configuring Apache and Tomcat to recognize that the admin webapp is present. Obviously, it's not correctly installed, or you wouldn't be having a problem. Don't suppose you want to give us a hint about what version of Tomcat you're using? Guessing from the contents of server.xml is rather pointless. Exactly what steps did you take to install the admin web app? Where is Tomcat installed? - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Does mod_jk support chunked encoding?
Really? I mean, we already have mod_jk setup and all, it's just that we zip the files up server side and when that's all finished, we send the file on down via the response's output stream. I tried modifying our servlet last night to construct the ZipOutputStream from the response's output stream and it worked, only the file we tested it on was only around 600K and I don't know what the threshold is to trigger chunked encoding. Unfortunately, everything is over HTTPS which means I can't use WireShark to look at the HTTP headers to make sure it's actually using chunked encoding and when I removed the rewrite rule that forced everything over HTTPS, i.e. do the download over HTTP, the download actually stopped working... I'll just write a new servlet this morning that's (mostly) independent of our web app and try again over HTTP with a much larger file. If it works, fantastic! Thanks for the response. --adam -Original Message- From: Tim Whittington [mailto:[EMAIL PROTECTED] Sent: Tue 7/15/2008 6:51 PM To: Tomcat Users List Subject: Re: Does mod_jk support chunked encoding? mod_jk does chunked encoding on all dynamic responses (e.g. From Tomcat) that don¹t already have some form of response end set (e.g. A Content-Length header). To be accurate I think this is more a function of Apache than mod_jk. All you should need to do is connect Tomcat to Apache using mod_jk and it should work out of the box. tim From: Adam Gordon [EMAIL PROTECTED] Reply-To: Tomcat Users List users@tomcat.apache.org Date: Tue, 15 Jul 2008 15:29:02 -0600 To: Tomcat Users List users@tomcat.apache.org Subject: Does mod_jk support chunked encoding? Hi- We're running Tomcat 5.5.16 behind Apache2 and one functionality of our web app serves up ZIP files which are created on the fly. We'd like to implement chunked-encoding to serve up the ZIP file so we don't have to actually create a temporary file on disk first but also so that we can immediately begin streaming the content to a user (i.e. a user doesn't have to wait for the files to be compressed into one file). We just can't seem to find any documentation on how to set up Apache, Tomcat, and mod_jk to support chunked encoding. Can anyone point us in the right direction? Thanks. --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Does mod_jk support chunked encoding?
Hi- We're running Tomcat 5.5.16 behind Apache2 and one functionality of our web app serves up ZIP files which are created on the fly. We'd like to implement chunked-encoding to serve up the ZIP file so we don't have to actually create a temporary file on disk first but also so that we can immediately begin streaming the content to a user (i.e. a user doesn't have to wait for the files to be compressed into one file). We just can't seem to find any documentation on how to set up Apache, Tomcat, and mod_jk to support chunked encoding. Can anyone point us in the right direction? Thanks. --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Logging individual web applications
Neha- First, I assume you meant to say the WEB-INF/classes directory as that's where the log4j.properties file needs to be placed for a given web app. Second, you probably don't want to set the rootLogger to DEBUG as any libraries you use could potentially be affected by this and if you've ever used Apache libraries before, their verbose logging is VERY verbose... a better way is to set it to INFO, and then define any package specific loggers ala: log4j.rootLogger=INFO, cc1 # lock down apache logging to only INFO or higher log4j.logger.org.apache=INFO # lock down quartz logging to only INFO or higher log4j.logger.org.quartz=INFO # webapp specific loggers log4j.logger.com.foo.bar=TRACE Thirdly, I don't see the threshold set anywhere (and I don't know what the default is), ala: log4j.threshold=ALL This level basically dictates the lowest level of logging that is to be permitted by ALL loggers so it should be set to the finest level possible. If none of this helps, pull the log4j.properties file out of your webapp and just write a test java class that uses it and prints out a logging statement at each level. This way you don't have to restart your webapp every time you tweak your properties file to get it working. Use a log4j provided Appender so you don't have to muck with your custom one. If it works right away, w/ no other modifications to the appender definition, then the problem lies within your custom appender. HTH, --adam Neha Agrawal wrote: Hello i have configured log4j for system logging in Tomcat5.5 .Als othe log is rotating.. Now iwant to configure my individual web-apps using log4j i have copied log4j.jar and common-logging.jar and the Date-File-appender.jar files in the web-apps lib directory and also created log4j.properties file in the webapps classes directory.. how do i configure this log4j.properties? i used the following configuration, but nothing is being logged by my webapp.. log4j.rootLogger=DEBUG,S log4j.appender.S=biz.minaret.log4j.DatedFileAppender log4j.appender.S.layout=org.apache.log4j.PatternLayout log4j.appender.S.layout.ConversionPattern=%d [%t] %-5p %c - %m%n log4j.appender.S.Directory=/usr/share/tomcat5.5.25/webapps/sample/logs log4j.appender.S.Prefix=sample. # Suffix: The log file name suffix. log4j.appender.S.Suffix=.log Is some thing wrong in this? Thanks nEha Why delete messages? Unlimited storage is just a click away. Go to http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: encoding - web.xml,struts struts-config.xml
Just a stab in the dark here since I don't know where Polish alphabet characters lie in the code charts, but you will probably want to use UTF-8 instead of ISO-8859. We've had plenty of issues with users cutting and pasting text from RTF applications (e.g. MS Word) into our web app's text areas only to see some of the characters not be encoded correctly. If you go this route, it's a multi-step process: you need to set the form encoding on your HTML forms (acceptCharset=UTF-8 enctype=application/x-www-form-urlencoded; charset=UTF-8), you will need to set the character encoding in your JSP pages (jsp:directive.page contentType=text/html; charset=UTF-8 pageEncoding=UTF-8/), and most importantly, you need a filter that sets the character encoding on each request (http://wiki.apache.org/tomcat/Tomcat/UTF-8) *BEFORE* you attempt to read any parameters. I don't know what the requirements of your web app will be regarding text input, but I've discovered that you must always assume that the user will do something you didn't expect. I've mucked around with this a bunch in resolving a ton of problems, so if you need any pointers, feel free to ask away. --adam Raghuveer wrote: I am working on i18n application that needs to be worked in English and Polish language. This application is working on Tomcat Servers on windows system In India, But getting Question Marks Polish language in Poland Windows System. Is there anything that needs to be handled in web.xml and struts-config.xml with encoding attribute? ?xml version=1.0 encoding=ISO-8859-1? I don't find any difference when modified to ISO-8859-2 ?xml version=1.0 encoding= ISO-8859-2? Any advice or suggestion ? - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Leap-year problem with commons-net
Short of downloading/patching the source code and redeploying, just a stab in the dark here, but maybe just execute touch -d date in the offending directory/directories. There's no recursive flag though, bummer. At least it'll only be a problem for 12 more hours (MST). HTH, --adam David kerber wrote: I have found that the commons-net ftp.listfiles() fails to get files whose date on the server is on feb 29. Googling indicates that this a known problem (at least since this morning), but I haven't found a quick fix. Does anybody know of one? D - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Leap-year problem with commons-net
Dave- Just set a cron job to do it every minute or (some other interval) and then you don't have to worry about it - just don't forget to remove the job tonight. --adam David kerber wrote: Yeah, that's what I've done so far today, but the files come in continuously throughout the day for a total of 1000 or so, and we need to process them as they come in, so I've been letting them build up and doing it every hour or so. It's a pain, and I hope they get this fixed sometime before the next leap year (and enough before it that I have time to implement and test it!!!) D Adam Gordon wrote: Short of downloading/patching the source code and redeploying, just a stab in the dark here, but maybe just execute touch -d date in the offending directory/directories. There's no recursive flag though, bummer. At least it'll only be a problem for 12 more hours (MST). HTH, --adam David kerber wrote: I have found that the commons-net ftp.listfiles() fails to get files whose date on the server is on feb 29. Googling indicates that this a known problem (at least since this morning), but I haven't found a quick fix. Does anybody know of one? D - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Leap-year problem with commons-net
I mean a cron job to touch the files and change the date David kerber wrote: The problem is that ftp.getfiles won't even retrieve the files from the server! It sees them as invalid because of the date issue. So I have to retrieve them manually. Yeah, I could script up that part as well, but I don't think it's worth it for now. Adam Gordon wrote: Dave- Just set a cron job to do it every minute or (some other interval) and then you don't have to worry about it - just don't forget to remove the job tonight. --adam David kerber wrote: Yeah, that's what I've done so far today, but the files come in continuously throughout the day for a total of 1000 or so, and we need to process them as they come in, so I've been letting them build up and doing it every hour or so. It's a pain, and I hope they get this fixed sometime before the next leap year (and enough before it that I have time to implement and test it!!!) D Adam Gordon wrote: Short of downloading/patching the source code and redeploying, just a stab in the dark here, but maybe just execute touch -d date in the offending directory/directories. There's no recursive flag though, bummer. At least it'll only be a problem for 12 more hours (MST). HTH, --adam David kerber wrote: I have found that the commons-net ftp.listfiles() fails to get files whose date on the server is on feb 29. Googling indicates that this a known problem (at least since this morning), but I haven't found a quick fix. Does anybody know of one? D - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache/Tomcat - mod_jk issues
No worries, happens to the best of us. I don't think tomcat is a reserved worker name - that said, I've seen stranger things... Anyway, regarding your host question, it depends. localhost should work fine out of the box if your apache/tomcat are running on the same server (assuming your hosts file is setup correctly, which it should be for localhost). We're running it all on apache load balancers and they hand off the JK mounts to the Tomcat server computers as appropriate. For the host parameter to work correctly I think all you'll need to ensure is that either the host value is mapped correctly in the hosts file or in DNS - we use DNS. Next up, what exactly happens when you try to go to a Tomcat URL? Do you get a 404? Regardless of whether you do or not, do you get any type of error? Is the error an Apache error or Tomcat error? If you haven't change the defaults of Apache or Tomcat, an Apache error will generally tell you the apache version in black text whereas the Tomcat error page usually has green or grey colored bars across it and will not display anything about Apache. If you get an Apache error, it's definitely not going to Tomcat-land and if it gets to Tomcat-land, then your Apache configuration is probably correct. I would next suggest turning up your JK logging and monitor your request logging to make sure 1) your requests are coming through and look as you expect them (in your apache access log), and then 2) look at your mod_jk log to see what's going on. Another thing to make sure is that Tomcat is listening on port 8009. Not sure what platform you're on, but a netstat -a will tell you which ports are active - you should see 8009. And on that note, make sure your ports.conf file has you listening on both port 80 and 443. --adam Lessie Z. Mitch wrote: Thank you Adam! 1- eepers! Okay, that was overlooked! Changed that. ^.^ 2- Not everything is secure (https). SSL is configured outside of the httpd.conf file for security reasons and defined in conf.d/someotherfile.conf, with conf.d being included (see previous post) 3- context files are located in their respective directories within catalin home (/tomcat_home/conf/Catalina/mydomain1.com et al) I followed option #2 of http://tomcat.apache.org/tomcat-5.5-doc/virtual-hosting-howto.html Okay, fixed the virtual Host: JkMount /*.jsp tomcat JkMount /servlet/* tomcat Restarted, yet Apache is still not handing off to TC. The TC serves up my webapps fine when standalone (either as 80 or 8080). Should the localhost property in workers.properties be changed to the IP (or domain name) of the designated webapp? IE: /somedirectory/worker.properties worker.list=tomcat worker.tomcat.host=localhost change localhost to 123.234.345.1 or mydomain.com??? worker.tomcat.port=8009 worker.tomcat.type=ajp13 ~LZM~ -Original Message- From: Adam Gordon [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 26, 2008 12:39 PM To: Tomcat Users List Subject: Re: Apache/Tomcat - mod_jk issues Lessie- Sorry to hear you're having trouble. We use Apache/Tomcat in the same way and assuming your snippets are reasonably complete I've noticed some issues that may or may not be helping to cause problems: 1. First and foremost, your worker list defines the worker name as tomcat yet in your J/K mount in your VirtualHost you say ajp13 as the worker name. I.e., JkMount /*.jsp ajp13 should be JkMount /*.jsp tomcat. 2. While I've not used the redirectPort attribute on the Connector element, I'm assuming you are redirecting everything to HTTPS. If this is the case, I'm curious as to why you don't define either SSLCertificateFile or SSLCertificateKeyFile in your VirtualHost. We have to to ensure the right certificate is served up with the right IP since we don't have a site domain certificate. 3. I don't see them but I'm also assuming that each of your webapps have their own Context defined in the META-INF directory. That's all I noticed after a quick glance, but the biggie is #1. Let us know how it goes. --adam No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.21.1/1299 - Release Date: 2/26/2008 9:08 AM - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache/Tomcat - mod_jk issues
Chris- That makes sense, because the SSL is between the web server and the browser, and not a connector between two web servers - I've just never used it so at first glance it looks like it redirects incoming traffic to port 8443, which is Tomcat's default SSL port... Thanks for the clarification. --adam Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Adam, Adam Gordon wrote: | 2. While I've not used the redirectPort attribute on the Connector | element, I'm assuming you are redirecting everything to HTTPS. If this | is the case, I'm curious as to why you don't define either | SSLCertificateFile or SSLCertificateKeyFile in your VirtualHost. We | have to to ensure the right certificate is served up with the right IP | since we don't have a site domain certificate. AJP doesn't do encryption, so any redirectPort would be expected to point to an HTTPS connection, which would be handled by something other than the AJP connector. Therefore, no SSL configuration on the AJP connector is necessary. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkfFcM0ACgkQ9CaO5/Lv0PAkDgCgnJ1x4OC5hAnd5PVuyAyiUT1d oMkAoKU5DTG2jd/busAKlssQ5MWAIj68 =B4kk -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session expiration and AJAX issues
Not easily. See Christopher's response in this thread chain. There is not currently a way to not tell Tomcat that a request has come in and not update the last ping time (or similar) on the Session. Jason Pyeron wrote: -Original Message- From: Adam Gordon [mailto:[EMAIL PROTECTED] Sent: Monday, February 25, 2008 13:11 To: Tomcat Users List Subject: Re: Session expiration and AJAX issues Martin- We are using Struts, however, version 1.2.9. But, after looking at the link, I'm not sure this will help as it doesn't really address the problem. Storing the date/time a user logs in on the session is probably useful, but our problem is that we want to forcefully log the user out if there's no human present at the computer and the AJAX tasks keep a user's session active indefinitely, whether or not they mean it to. Can url patterns be excluded from session prolonging magic? Additionally, assuming we didn't have the AJAX tasks, we'd have to check the logged in time from the session on every request and that's just not realistic when you have hundreds of Struts actions, even with a unique parent Action class. That said, I'm beginning to suspect that this may be the only way to go, i.e., have base Action for Struts actions and base action for AJAX actions. My only issue with this is that then the onus is on the developer to use the right Action and if they don't, a session could inadvertently be left open which is a security risk. Alternatively, we could simply force the logout on the user after 12 hours period...which would kind of suck for the user if they were in the middle of something and so I can almost guarantee that our product management team wouldn't go for it since it's not really creating a positive user experience. --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache/Tomcat - mod_jk issues
Lessie- Sorry to hear you're having trouble. We use Apache/Tomcat in the same way and assuming your snippets are reasonably complete I've noticed some issues that may or may not be helping to cause problems: 1. First and foremost, your worker list defines the worker name as tomcat yet in your J/K mount in your VirtualHost you say ajp13 as the worker name. I.e., JkMount /*.jsp ajp13 should be JkMount /*.jsp tomcat. 2. While I've not used the redirectPort attribute on the Connector element, I'm assuming you are redirecting everything to HTTPS. If this is the case, I'm curious as to why you don't define either SSLCertificateFile or SSLCertificateKeyFile in your VirtualHost. We have to to ensure the right certificate is served up with the right IP since we don't have a site domain certificate. 3. I don't see them but I'm also assuming that each of your webapps have their own Context defined in the META-INF directory. That's all I noticed after a quick glance, but the biggie is #1. Let us know how it goes. --adam Lessie Z. Mitch wrote: Greetings list. For some reason web browser queries are not passing through apache to tomcat via mod_jk. I understand I may have a misconfiguration somewhere, I just cannot find it. L I am trying to host 4 separate domains, all with different java apps. Each domain has its own IP and own configurations, but they all run within one instance of Tomcat. When I disable Apache, my webapps run fine and are called forth by the web browser fine. When I reconfigure for Apache, I do not hit my site(s). When I attempt to view the my domain, I see the standard Apache welcome page and no error in catalina.out. When I force it to go to port 8009, I get a standard browser error (64 - Host not available) and the following in catalina.out: Feb 23, 2008 7:13:19 PM org.apache.jk.common.MsgAjp processHeader SEVERE: BAD packet signature 18245 Feb 23, 2008 7:13:19 PM org.apache.jk.common.ChannelSocket processConnection SEVERE: Error, processing connection java.lang.IndexOutOfBoundsException at java.io.BufferedInputStream.read(BufferedInputStream.java:306) at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:626) at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:583) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:691) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java :895) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:685) at java.lang.Thread.run(Thread.java:595) Below are my configurations. Please note all specific information has been xx’d out. If more is needed let me know. Server: RHE 4 Apache 2.0.52 Tomcat 5.5.23 mod_jk 1.2.21 /etc/httpd/conf/httpd.conf ~~ other configurations Include conf.d/*.conf ~~ other configurations VirtualHost xxx.xxx.xxx.xxx ServerName mydomain.com ServerAlias HYPERLINK http://www.mydomain.comwww.mydomain.com DocumentRoot /home/sites/mydomain.com/webapps/mydomain ErrorLog /home/sites/mydomain.com/logs/mydomain_error_log CustomLog /home/sites/mydomain.com/logs/mydomain_access_log common JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 /VirtualHost ~~ other virtual hosts follow, mimic same format /etc/httpd/conf.d/mod_jk.conf LoadModulejk_module /usr/lib/httpd/modules/mod_jk.so JkWorkersFile /etc/httpd/conf/workers.properties JkShmFile /var/log/httpd/mod_jk.shm JkLogFile /var/log/httpd/mod_jk.log JkLogLevelinfo JkLogStampFormat [%a %b %d %H:%M:%S %Y] /etc/httpd/conf/workers.properties worker.list=tomcat worker.tomcat.host=localhost worker.tomcat.port=8009 worker.tomcat.type=ajp13 tomcat_home/conf/server.xml ~~ other configurations, ~~ http ssl are both removed Connector port=8009 enableLookups=false redirectPort=8443 protocol=AJP/1.3 / ~~ other configurations Host name=mydomain.com appBase=someotherdirectory/mydomain.com/webapps unpackWARs=true autoDeploy=true /Host ~~ other hosts to follow, mimic same format I have read so much and now I am more confused than ever. Can someone please shed some light? ~LZM~ No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.21.1/1297 - Release Date: 2/25/2008 9:22 AM - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection Pooling
Hi, I think you may be confusing the number of allowable processes with the number of allowable threads. Per Tomcat's documentation, maxActive refers to the maximum number of DB connections whereas the Oracle error you are seeing refers to the maximum number of processes (threads?) which are not necessarily connections. It's been too many years since I've worked with Oracle, let alone 9i, so I can't point you where to look in your config files, but I suspect that's where the problem may be. As an aside, the solution is probably not to just up the number of processes but to determine why Oracle is generating so many (if 150 is indeed considered many.). Hope this helps. --adam abhishek reddy wrote: Here are the pool configuration details in context.xml file. Resource name=jdbc/pool auth=Container type=javax.sql.DataSource username=scott password=tiger driverClassName=sun.jdbc.odbc.JdbcOdbcDriver url=jdbc:odbc:pool maxWait=6 removeAbandoned=true maxActive=130 maxIdle=50 removeAbandonedTimeout=300 logAbandoned=true / software: database : oracle 9i server: tomcat 5.5 iam getting the following error: java.sql.SQLException: [Oracle][ODBC][Ora]ORA-00020: maximum number of processes (150) exceeded. I have set the maxActive to 130 then how will the number of processes exceeds 150? tell me when will the maximum number of processes (150) exceeded in the oracle and how do i solve the problem? I have checked the application 5 to 10 times and there is no connection leakage problem. the application is under going performance testing.with around 200 users at a time, for the first time it worked perfeclty, next time the above mentioned error is comming.. i need your help in solving this problem.. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Session expiration and AJAX issues
A couple of issues: We've set our session expiration to 12 hours (I know it's long) and we're seeing behavior where certain browsers (namely IE) apparently can't count that high (we set the meta Refresh header but the page doesn't reload after the allotted time, session expiration time + 20 minutes). Since this issue was discovered, we've added background AJAX timers on some of our web pages that refresh (authenticated) content. While this happily works, unfortunately, if the user chooses to remain on one of these pages, and then goes on vacation, the session stays active because the AJAX calls keep the session alive. Our first attempt at a solution was to have a JavaScript counter that, after every 20 minutes, incremented a counter and if that counter ever got to 37, we knew that the user hadn't changed web pages and we could log them out (window.location = logout URL. The problem is that this doesn't appear to work either and additionally, it relies on JavaScript bypassing Tomcat's built-in features. User's cannot log in w/o having JavaScript enabled, so it's not a matter of a user potentially disabling it, rather it puts the onus on the browser to inform the server that the user's session needs to be expired. Does anyone have experience in this area and if so, how have you solved this problem? I know Google uses AJAX with their Gmail webapp, but they don't seem to care about not expiring the user's session. Any help would be appreciated. Thanks, --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session expiration and AJAX issues
Paul- Are you saying that certain browser will never expire their sessions? Or are you saying that certain browsers kill their sessions before 12 hours (because they can't count that high)? The former, i.e. that browsers will never expire the sessions. The way I understand it - you are using ajax to keep a session alive. Why not set the session expiration to live as long as the browser is open, or for some other length of time? The session mechanism should work. I don't understand the need to hack sessions using ajax. As indicated from the tone of my original post (see the second sentence of the second paragraph in my original post), are not intentionally using AJAX to keep the session alive - it is a side-effect which we would like to obviate, hence the JavaScript counter. Isn't that part of the browser's job? Uh, I would have to argue that this is a HUGE no. I think it's VERY obvious to anyone that has done any sort of web development with cross-browser compatibility in mind that browser makers cannot be relied upon to implement ANY sort of common standard in the same way (case and point look at how you instantiate an XmlHttpRequest object in JavaScript across different browsers, not to mention CSS functionality). Besides if it were the browser's job, why would Tomcat even have support for it? It's like making an assumption that user's never leave their browsers open or never click the back button. I think the only thing one can absolutely rely on a user doing in a web application using it in a manner to which one had not considered. So, all that said, is there anyone out there who's had experience with this problem and knows of a solution? Thanks. --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session expiration and AJAX issues
Martin- We are using Struts, however, version 1.2.9. But, after looking at the link, I'm not sure this will help as it doesn't really address the problem. Storing the date/time a user logs in on the session is probably useful, but our problem is that we want to forcefully log the user out if there's no human present at the computer and the AJAX tasks keep a user's session active indefinitely, whether or not they mean it to. Additionally, assuming we didn't have the AJAX tasks, we'd have to check the logged in time from the session on every request and that's just not realistic when you have hundreds of Struts actions, even with a unique parent Action class. That said, I'm beginning to suspect that this may be the only way to go, i.e., have base Action for Struts actions and base action for AJAX actions. My only issue with this is that then the onus is on the developer to use the right Action and if they don't, a session could inadvertently be left open which is a security risk. Alternatively, we could simply force the logout on the user after 12 hours period...which would kind of suck for the user if they were in the middle of something and so I can almost guarantee that our product management team wouldn't go for it since it's not really creating a positive user experience. --adam Martin Gainty wrote: Hi Adam- You can try this with Struts.. http://struts.apache.org/2.x/docs/simplelogin-with-session.html insert the starting-date-time intio Session variable and then in the logoutAction.execute method do some quick math on the time-delta to determine if you want to quiesce the session HTH M- - Original Message - From: Adam Gordon [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Monday, February 25, 2008 11:04 AM Subject: Session expiration and AJAX issues A couple of issues: We've set our session expiration to 12 hours (I know it's long) and we're seeing behavior where certain browsers (namely IE) apparently can't count that high (we set the meta Refresh header but the page doesn't reload after the allotted time, session expiration time + 20 minutes). Since this issue was discovered, we've added background AJAX timers on some of our web pages that refresh (authenticated) content. While this happily works, unfortunately, if the user chooses to remain on one of these pages, and then goes on vacation, the session stays active because the AJAX calls keep the session alive. Our first attempt at a solution was to have a JavaScript counter that, after every 20 minutes, incremented a counter and if that counter ever got to 37, we knew that the user hadn't changed web pages and we could log them out (window.location = logout URL. The problem is that this doesn't appear to work either and additionally, it relies on JavaScript bypassing Tomcat's built-in features. User's cannot log in w/o having JavaScript enabled, so it's not a matter of a user potentially disabling it, rather it puts the onus on the browser to inform the server that the user's session needs to be expired. Does anyone have experience in this area and if so, how have you solved this problem? I know Google uses AJAX with their Gmail webapp, but they don't seem to care about not expiring the user's session. Any help would be appreciated. Thanks, --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session expiration and AJAX issues
Adding a time decay in our timer task is an interesting idea and were it not for IE's JavaScript counting ineptness, that'd probably work. Bob Hall wrote: --- 10:10AM Mon 25 Feb 2008, Adam Gordon [EMAIL PROTECTED] wrote: Storing the date/time a user logs in on the session is probably useful, but our problem is that we want to forcefully log the user out if there's no human present at the computer and the AJAX tasks keep a user's session active indefinitely, whether or not they mean it to. If there's a user input side to the AJAX tasks, would it be possible for the AJAX task time interval to increase over time w/o user input? Eventually, this would lead to a session timeout. -Bob Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5.23 - Connector URIEncoding=UTF-8
AFAIK, we had to add two things to support UTF-8 in our environment: 1. We had to add a Filter to Tomcat to set the encoding on every request to UTF-8, see this page: http://wiki.apache.org/tomcat/Tomcat/UTF-8 2. Add JkOptions +ForwardURICompatUnparsed to our apache config file in sites-enabled. Note that this only applies if you are using Apache to redirect requests to Tomcat. Hope this helps. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Debugging tomcat with eclipse
It's actually MUCH easier than that... :-) If you use Tomcat's start and stop scripts, pass the jpda parameter to the script, e.g. /usr/local/tomcat/bin/catalina.sh jpda start Then, in Eclipse, select the Debug Perspective and then click the down arrow in the little green bug icon in the toolbar and select Open Debug Dialog. Right-click on Remote Application Server in the list on the left and select New. Name it whatever you want and use the Browse button to select the project you want to debug. If tomcat is running on the same box, leave the host and port alone and click the Debug button in the lower right corner. You should see a ton of threads appear in the Debug frame in the upper left. You are now connected. --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Avoiding same server to server HTTP calls to generate HTML pages via JSPs
Any one know if there exists a JSP writer engine in the Tomcat API that allows for the generation of HTML pages via JSP code but without having to make server to server HTTP calls? Right now we basically have a URL dispatcher that when a specific request comes in, we make another request to retrieve the contents of a URI (a JSP page to generate HTML) via a server-to-server HTTP call and then essentially slap that into a MimeBodyPart for sending text/html email messages. It would be nice (and make for much easier unit testing) if we could do this purely in Java land without having to make a server-to-server HTTP call behind the scenes. Any one know a way or if this functionality even exists? Thanks, --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Dynamic logging configuration updates in Tomcat
I have no idea if Tomcat supports this -- the logging-related configuration directives in the docs should say if it is directly supported. I didn't see anything in the logging documentation that's indicated either way whether or not this was supported. The JVM theoretically supports it with the LogManager.readConfiguration(...) method but as I originally noted, there's a known bug in the JVM that causes new configurations to not be loaded, however there is a work-around. Where do you do this? In your webapp or somewhere else? We already have several servlet context listeners, so in the one that initializes the web app (database, initializes static classes, etc...) we add a thread to our thread pool whose sole job is to read the logging.properties file and if it's changed within the last minute apply those changes. Originally, we constructed an InputStream from this file and passed the stream to LogManager.readConfiguration(...) but as I've mentioned (and even with the bug work-around) this only works for the first couple of log file changes. After the first few changes, it stops working entirely in that no subsequent changes to the logging.properties file is picked up short of changing the .level log level property. If you come up with something, consider logging a bug/enhancement and submitting a patch. Suggestions with patches are usually given higher priority than those without patches ;) I'd love to submit a patch, only I never found out where in Tomcat (if it's even IN Tomcat) the problem is occurring. My first test was copying verbatim the code from LogManager that reads the properties from the InputStream and iterates over the logging level properties applying them to their respective loggers. It worked consistently when I copied it over, but not when I relied on LogManager to do it. Once I got it working consistently, I tweaked the code a little to maintain a mapping of logger names to log levels so I could reset log levels for loggers who had been removed from the logging.properties file during subsequent changes. --adam -Original Message- From: Christopher Schultz [mailto:[EMAIL PROTECTED] Sent: Thursday, October 11, 2007 12:39 PM To: Tomcat Users List Subject: Re: Dynamic logging configuration updates in Tomcat -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Adam, Adam Gordon wrote: Wow, no one had any ideas as to what is going on? I have no idea if Tomcat supports this -- the logging-related configuration directives in the docs should say if it is directly supported. If you're using log4j, I know that there are tools you can use to modify the in-memory configuration of the logging framework, but they won't be persisted to the disk (and they don't allow you re-read the configuration file AFAIK). Anyway. We never figured out why Tomcat has an issue with this, but we found a suitable workaround by basically doing what the LogHandler does when it re-reads and refreshes the logging configuration - we take the new logging level values and apply them to their respective loggers. Where do you do this? In your webapp or somewhere else? In fact, my first test was an exact copy of the LogHandler code and the test worked (i.e., dynamic logging worked), whereas using the LogHandler didn'th. If you come up with something, consider logging a bug/enhancement and submitting a patch. Suggestions with patches are usually given higher priority than those without patches ;) - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHDm2x9CaO5/Lv0PARAhWXAJ4nVi21oqN7A99wtoZMtY1HzfUQNwCcDR8Q ivOydqjYdN1xGwtd1WqrU8c= =4Bp9 -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic logging configuration updates in Tomcat
I've never heard of embedded Tomcat. That said, the whole deal w/ embedded systems is that the API is drastically limited so if logging isn't working, and this may sound like a dumb question but, is it possible that logging just isn't supported? Regardless, space isn't really an issue for us in that this webapp is on it's own production quality serverunless there's a totally logical reason to use an embedded Tomcat instance. --adam Carl Mosca wrote: Adam, Have you tried your code with the embedded Tomcat? (I am not having any success getting a webapp to do logging within embedded Tomcat.) TIA, Carl - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Dynamic logging configuration updates in Tomcat
Wow, no one had any ideas as to what is going on? Anyway. We never figured out why Tomcat has an issue with this, but we found a suitable workaround by basically doing what the LogHandler does when it re-reads and refreshes the logging configuration - we take the new logging level values and apply them to their respective loggers. In fact, my first test was an exact copy of the LogHandler code and the test worked (i.e., dynamic logging worked), whereas using the LogHandler didn'th. --adam -Original Message- From: Adam Gordon [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 09, 2007 1:55 PM To: users@tomcat.apache.org Subject: Dynamic logging configuration updates in Tomcat Hi- We have a web application in which we'd like to get dynamic logging working. By dynamic logging, I mean live changes to the webapps' logging.properties file are read and applied without having to restart Tomcat. We have all the code written and running but it appears to not work exactly as it should. That is, I can change a logger's logging level once and it works, but if I change it again, it doesn't. If I change the global logger level (.level) the change is picked up but, obviously, that affects ALL the loggers in our webapp. I pulled the code out of tomcat and ran it as a stand-alone Java application and it works perfectly. I then created a very tiny/simple webapp to run this logging code and the problem appears again. I'm at a loss as to what Tomcat can possibly be doing to prevent the properties from being read subsequent times after the first change. We're using the java.util.logging API and have our own LogHandler class. We have a ServletContextListener that starts a background thread when the webapp starts up. This background thread finds the logging.properties file for this webapp and if it has been modified in the last 60 second, creates an InputStream to this file and passes this InputStream to the LogManager.getLogManager().readConfiguration(...) method. We are aware of this bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5035854 in the Java logging API, but we are using the workaround in this bug to reapply the logging levels. If we can't find a solution to this using readConfiguration(...), we have a solution we've not tried which is to read the properties file ourselves, and loop over the loggers applying any levels that have changed - which is exactly what the LogManager is doing - but at least this is our code. Again, we've not tried this brute-force method yet, so I don't know if it will work. Thanks, --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dynamic logging configuration updates in Tomcat
Hi- We have a web application in which we'd like to get dynamic logging working. By dynamic logging, I mean live changes to the webapps' logging.properties file are read and applied without having to restart Tomcat. We have all the code written and running but it appears to not work exactly as it should. That is, I can change a logger's logging level once and it works, but if I change it again, it doesn't. If I change the global logger level (.level) the change is picked up but, obviously, that affects ALL the loggers in our webapp. I pulled the code out of tomcat and ran it as a stand-alone Java application and it works perfectly. I then created a very tiny/simple webapp to run this logging code and the problem appears again. I'm at a loss as to what Tomcat can possibly be doing to prevent the properties from being read subsequent times after the first change. We're using the java.util.logging API and have our own LogHandler class. We have a ServletContextListener that starts a background thread when the webapp starts up. This background thread finds the logging.properties file for this webapp and if it has been modified in the last 60 second, creates an InputStream to this file and passes this InputStream to the LogManager.getLogManager().readConfiguration(...) method. We are aware of this bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5035854 in the Java logging API, but we are using the workaround in this bug to reapply the logging levels. If we can't find a solution to this using readConfiguration(...), we have a solution we've not tried which is to read the properties file ourselves, and loop over the loggers applying any levels that have changed - which is exactly what the LogManager is doing - but at least this is our code. Again, we've not tried this brute-force method yet, so I don't know if it will work. Thanks, --adam - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]