Re: Tomcat dies suddenly
Carl, Here's what I have on my system, you'll obviously need to adjust for your setup, especially the httpd part as I don't believe you're using it: #db-style timestamp STAMP=`date +%F' '%T`; # count the number of httpd child processes AP_COUNT=`ps auxf | grep -c httpd`; # count the number of Tomcat threads. # NOTE: this assumes that the only program that is using java is Tomcat TC_COUNT=`ps auxHS | grep -c bin/java`; # pipe the output of free into grep seaching for the second line MEM_CHECK=`free -m | grep buffers/`; #use a tab delimiter to simplify importing results into a spreadsheet or db TAB=`echo -e '\t'`; MESSAGE=$STAMP$TAB--$TAB$AP_COUNT$TAB$TC_COUNT$TAB$MEM_CHECK$TAB[httpd,tomcat,memory]; echo $MESSAGE; hope you find it helpful On Fri, Feb 5, 2010 at 10:57 PM, chadwickbailey71 chadwickbaile...@yahoo.com wrote: There is no hardware restrictions in 64-bit mode. use 64-bit Linux, this will fix the problem - Learn an http://automatedsocialnetworking.com/ Automated Social Marketing technique WITHOUT Spending More than 5 Minutes Per Month at your Computer :working: -- View this message in context: http://old.nabble.com/Tomcat-dies-suddenly-tp27377457p27476911.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat dies suddenly
Hi Carl, I've skimmed thru all your posts, please excuse me if these questions are redundant. You've mentioned VisualJVM, JMeter, and Slackware monitoring tools, it seems to me that you are using these to occasionally to monitor you Tomcat instance, when things seem to be going badly (thats my perception from reading your posts) Have you done any long term sampling (Tomcat threads, memory, etc) of your system? I use Slackware 12.2 (32-bit), Httpd 2.2, Java 1.6, Tomcat 6.0.18 and had Tomcat die in a manner similiar to yours: First it died silently (nothing in the catalina.out), the next time (about a week later) it became non-responsive complaining about PermGen, OOMException and so on. I haven't determined the cause yet, I rolled over to another server (exact same hardware/software btw). I ran Memtest on the problematic server, no problems detected. Anyways, I've been sampling the httpd process count, tomcat thread count, and free memory (sans cache and buffers) every minute via a cron job and writing the results to a file on both machines since this issue arose about 2 weeks ago. My hope is that the next time it bugs out, i'll be able to say oh the thread count exploded, but the memory use only increased incrementally or whatever the cause actually is. Have you done any monitoring at that fine grained a level on your systems? It would be especially interesting to see how your old HW setup compares to the new ones. Hope I've helped a little bit :) On Fri, Feb 5, 2010 at 11:26 AM, Carl c...@etrak-plus.com wrote: Chris, I agree but this seemed like a low risk change. I also understand that changing too many things at once sometimes confuses the issue. Thanks, Carl - Original Message - From: Christopher Schultz ch...@christopherschultz.net To: Tomcat Users List users@tomcat.apache.org Sent: Friday, February 05, 2010 10:48 AM Subject: Re: Tomcat dies suddenly -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Carl, On 2/5/2010 10:16 AM, Carl wrote: Do you see any harm in just doubling the number (to 2048) just to see if it has an impact? We would expect to see an OOME (strange, I know) if you were running out of file descriptors. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktsPbYACgkQ9CaO5/Lv0PBWnwCfXyZVJNsd/mMCgJWVamRBVZ+F AMkAn1H2romyi8eFunc3lF+eDiQa0Hlq =muVu -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
Understanding url-patterns
Are URL Patterns ending in a wild card allowed by the Servlet Spec? I have this pattern setup with the intention of binding every url that begins with foo to a serlvet servlet-mapping servlet-nameMultiFooService/servlet-name url-pattern/foo*/url-pattern /servlet-mapping But http://localhost/foo1, ...foo2, ...fooANYTHING gives me a 404 Only http://localhost/foo* actually resolves to the servlet. Do I have the syntax wrong? I seen examples like url-pattern/*.jsp/url-pattern, so is there some different notation required for wildcards at the end of the pattern? Tomcat 6.0.20
Re: Understanding url-patterns
I actually spent an hour and half trying to find the Servlet 2.5 specs and researching this question in general. The only thing on Sun's site for Servlet 2.5 was the Javadocs, not the actual specs. In fact I even found other people who had the same issue of not being able to find the Specs as a PDF. I have would be tickled to death to be able to read the specs straight from the source, but since I couldn't find the source, I figured I would ask another source of information, ie this list. On Tue, Dec 8, 2009 at 12:25 PM, André Warnier a...@ice-sa.com wrote: Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jonathan, On 12/8/2009 11:48 AM, Jonathan Mast wrote: Are URL Patterns ending in a wild card allowed by the Servlet Spec? You could check. You've been on this list long enough to know that the spec itself is available +1 and quite readable. + ... 0.5 Maybe it's time to read it. +1 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Preventing httpd from accessing WEB-INF contents
Can someone please provide the magical httpd config-cantation that will block httpd from accessing anything in WEB-INF directories? I need something that will be apply globally and can't be overridden by VirtualHost directives. I've dug around the httpd config documentation and I'm just not understanding it, everything I've tried just hasn't worked. thanks httpd 2.2 Tomcat 6.0
Re: Preventing httpd from accessing WEB-INF contents
yes I am keeping the all the web-app stuff in place. I don't have the time to re-architect my entire system to your suggested format. I really need to just prevent httpd from accessing anything with WEB-INF in the url. On Wed, Nov 25, 2009 at 11:21 AM, Pid p...@pidster.com wrote: On 25/11/2009 16:13, Jonathan Mast wrote: Can someone please provide the magical httpd config-cantation that will block httpd from accessing anything in WEB-INF directories? I need something that will be apply globally and can't be overridden by VirtualHost directives. I've dug around the httpd config documentation and I'm just not understanding it, everything I've tried just hasn't worked. thanks httpd 2.2 Tomcat 6.0 At a guess, I'd say you've published, via HTTPD, the web application directory. This is one of the reasons we advise users not publish webapp directories via HTTPD. Using a separate webapps and document root is advisable. E.g. /path/to/site.com/httpdocs /path/to/site.com/httpdocs/index.html /path/to/site.com/httpdocs/images/ /path/to/site.com/httpdocs/scripts/ /path/to/site.com/webapps /path/to/site.com/webapps/ROOT /path/to/site.com/webapps/myapp If this isn't the case, you'll have to supply information about your mod_jk / mod_proxy config so we can see what you're doing. p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Preventing httpd from accessing WEB-INF contents
My understanding of Location directives is that cannot be used with regex and if not then thats not what I'm looking for. I have multiple contexts underneath multiple (virtual) hosts. I need a VirtualHost level directive that will block any attempts to access */WEB-INF/* on that host. Adding a new Location directive to httpd.conf for each context would be alot of work and something that would be easy to forget to do. On Wed, Nov 25, 2009 at 11:48 AM, Tobias Crefeld t...@cataneo.eu wrote: Am Wed, 25 Nov 2009 11:13:19 -0500 schrieb Jonathan Mast jhmast.develo...@gmail.com: I need something that will be apply globally and can't be overridden by VirtualHost directives. Why don't you use a standard like Location/Order/Deny/Allow in the vhosts config to deny access to WEB-INF, etc.? Individual config-files for Apache's vhosts are still part of the Apache-config and you can insert in it whatever you like to control (or crash!) Apache as a whole. Because of this I would never give the Tomcat-User (e.g. our developers) direct access to the vhost's config-files. Regards, Tobias. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Preventing httpd from accessing WEB-INF contents
Thanks! I had to make a slight adjustment to get it to work fully: Location ~ /?WEB-INF/ AllowOverride none deny from all /Location Now foo.mysite.com/WEB-INF/* and foo.mysite.com/another_context/WEB-INF/*are blocked. I did get this message on httpd shutdown and startup: [warn] Useless use of AllowOveride ... Removing it didn't seem to affect the behavior, not sure if I should still keep it in there. On Wed, Nov 25, 2009 at 1:07 PM, Tim Funk funk...@apache.org wrote: Equally well Location ~ /WEB-INF/ AllowOverride none deny from all /Location The docs say AllowOverride is not allowed on regex's so I believe in reality - this could be overridden with effort. -Tim Pid wrote: On 25/11/2009 16:47, Nikolay Diulgerov wrote: Try Location /myapp/WEB-INF AllowOverride None deny from all /Location Probably a better solution would be: LocationMatch /*/WEB-INF/ AllowOverride None deny from all /LocationMatch LocationMatch /*/META-INF/ AllowOverride None deny from all /LocationMatch ... but we're really just guessing what config is already in place - maybe the mod_jk / mod_proxy config could be adjusted instead. Correcting a poor/broken config is a much better solution than attempting, blindly, to stick bandages on an unknown setup. p -Original Message- From: Jonathan Mast [mailto:jhmast.develo...@gmail.com] Sent: Wednesday, November 25, 2009 6:40 PM To: Tomcat Users List; p...@pidster.com Subject: Re: Preventing httpd from accessing WEB-INF contents yes I am keeping the all the web-app stuff in place. I don't have the time to re-architect my entire system to your suggested format. I really need to just prevent httpd from accessing anything with WEB-INF in the url. On Wed, Nov 25, 2009 at 11:21 AM, Pidp...@pidster.com wrote: On 25/11/2009 16:13, Jonathan Mast wrote: Can someone please provide the magical httpd config-cantation that will block httpd from accessing anything in WEB-INF directories? I need something that will be apply globally and can't be overridden by VirtualHost directives. I've dug around the httpd config documentation and I'm just not understanding it, everything I've tried just hasn't worked. thanks httpd 2.2 Tomcat 6.0 At a guess, I'd say you've published, via HTTPD, the web application directory. This is one of the reasons we advise users not publish webapp directories via HTTPD. Using a separate webapps and document root is advisable. E.g. /path/to/site.com/httpdocs /path/to/site.com/httpdocs/index.html /path/to/site.com/httpdocs/images/ /path/to/site.com/httpdocs/scripts/ /path/to/site.com/webapps /path/to/site.com/webapps/ROOT /path/to/site.com/webapps/myapp If this isn't the case, you'll have to supply information about your mod_jk / mod_proxy config so we can see what you're doing. p - 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 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Preventing httpd from accessing WEB-INF contents
You're right I did misunderstand the Location directive. Its at the top of the config file now, working fine :) On Wed, Nov 25, 2009 at 1:31 PM, André Warnier a...@ice-sa.com wrote: Jonathan Mast wrote: My understanding of Location directives is that cannot be used with regex and if not then thats not what I'm looking for. Then your understanding of Location directives is wrong. Why don't you look up the original article ? http://httpd.apache.org/docs/2.2/mod/core.html#location (and LocationMatch) I have multiple contexts underneath multiple (virtual) hosts. I need a VirtualHost level directive that will block any attempts to access */WEB-INF/* on that host. Adding a new Location directive to httpd.conf for each context would be alot of work and something that would be easy to forget to do. Well, /you/ are the one who created the mess in the first place, so don't complain at us. ;-) A tip (also in the Apache documentation, about VirtualHost) : Generally speaking, configuration directives you use in the main part of the Apache server config (by this meaning what is outside of a VirtualHost../VirtualHost block), is inherited by all VirtualHost sections, and acts as a default unless specifically overridden inside the VirtualHost sections. In other words, if you use a LocationMatch section in the main configuration, it will carry over to all VirtualHosts. Note that I'm leaving something here to figure out by yourself, not that you would get rusty or lazy or so. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat Manager sees distribution directories as applications
You're right, I totally forgot to put appBase attributes in my Host declarations. However, httpd only lets *.jsp and *.do requests pass on to Tomcat so I don't have to worry about the security issue. I'm gonna put appBase attributes into my config and see if that fixes it. thanks On Fri, Oct 30, 2009 at 7:59 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hassan, On 10/30/2009 5:07 PM, Hassan Schroeder wrote: On Fri, Oct 30, 2009 at 2:03 PM, Jonathan Mast jhmast.develo...@gmail.com wrote: When I log into the Tomcat Web Application Manager, in addition to the actual webapps defined in server.xml, it also lists the /bin, /conf, /logs, /temp, /lib and /work directories of the Tomcat installation as if they are webapps. I doubt this is correct, so how do I fix it? Sounds like your server.xml is wildly wrong. :-) +1 I suspect you have something like this: Host appBase= ... If you thought I don't need a webapps directory because all my webapps are defined in their own XML files and you decided to just remove the appBase string, then you likely ended up setting your appBase to CATALINA_BASE and exposing all your configuration to the world. If you're using JNDI DataSources, you might want to change your database passwords right about now. ;) - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkrri9sACgkQ9CaO5/Lv0PCWAACfQmyQyUGXH1JmWdC5KjjvPrhT psoAnAtiufYZvyqE8Fd4D9gZYm4Qa3UB =XY3t -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat Manager sees distribution directories as applications
OK I just added the appBase attr to a Host in my server.xml. It did get rid of the Tomcat install. folders showing up as webapps, but it isnt' doing exactly what I thought it would do. Now everything in my appBase shows up in my Manager instance as belonging to that Host, when what I want there is only those directories in my appBase that are referenced by Contexts in my particular Host. At least the old (appBase-less) method retained the logical mapping defined in the Host section. My reading of the Tomcat config docs seemed to indicate that each Host should have it's own Manager Context defined as opposed to having a single Manager instance that can span multiple Hosts. Is this correct? On Mon, Nov 2, 2009 at 10:05 AM, Jonathan Mast jhmast.develo...@gmail.comwrote: You're right, I totally forgot to put appBase attributes in my Host declarations. However, httpd only lets *.jsp and *.do requests pass on to Tomcat so I don't have to worry about the security issue. I'm gonna put appBase attributes into my config and see if that fixes it. thanks On Fri, Oct 30, 2009 at 7:59 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hassan, On 10/30/2009 5:07 PM, Hassan Schroeder wrote: On Fri, Oct 30, 2009 at 2:03 PM, Jonathan Mast jhmast.develo...@gmail.com wrote: When I log into the Tomcat Web Application Manager, in addition to the actual webapps defined in server.xml, it also lists the /bin, /conf, /logs, /temp, /lib and /work directories of the Tomcat installation as if they are webapps. I doubt this is correct, so how do I fix it? Sounds like your server.xml is wildly wrong. :-) +1 I suspect you have something like this: Host appBase= ... If you thought I don't need a webapps directory because all my webapps are defined in their own XML files and you decided to just remove the appBase string, then you likely ended up setting your appBase to CATALINA_BASE and exposing all your configuration to the world. If you're using JNDI DataSources, you might want to change your database passwords right about now. ;) - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkrri9sACgkQ9CaO5/Lv0PCWAACfQmyQyUGXH1JmWdC5KjjvPrhT psoAnAtiufYZvyqE8Fd4D9gZYm4Qa3UB =XY3t -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat Manager sees distribution directories as applications
So you are saying each Host *must* have it's own distinct appBase. That sucks, doing that will make my deployment process a nightmare. Any way around the problem I described above? On Mon, Nov 2, 2009 at 11:02 AM, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Mon, Nov 2, 2009 at 8:35 AM, Jonathan Mast jhmast.develo...@gmail.com wrote: My reading of the Tomcat config docs seemed to indicate that each Host should have it's own Manager Context defined as opposed to having a single Manager instance that can span multiple Hosts. Is this correct? Yes, and its own appBase. -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat Manager sees distribution directories as applications
By nightmare I meant complexity. Currently all my webapps are located in a single directory, its flat, it only contains webapps (IE. folders with a WEB-INF directory). I have approximately a dozen Hosts defined across 3 domain names (and every intention of adding more). Some Hosts have single Contexts, but others have dozens of Contexts defined. If each Host must have it's own unique appBase for the Manager to work correctly, then that entails a 3 level structure for my webserver's document root: / --/webapps -/host_MY_HOST ---/MY_CONTEXT Which means reworking the build scripts for each and every webapp. If this is the only way to have the manager work correctly, then I guess I'll have to do. I just don't understand why the server.xml cannot be interpreted as a logical structure. If I can define a /blahblah Context on a docBase of foobar-webapp (a logical or arbitrary mapping) why can't Contexts be understood as belonging to certain arbitrary Hosts, regardless of their filepath? On Mon, Nov 2, 2009 at 12:11 PM, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Mon, Nov 2, 2009 at 9:22 AM, Jonathan Mast jhmast.develo...@gmail.com wrote: So you are saying each Host *must* have it's own distinct appBase. Not must, but that's the easy/simple/standard way to do it, and of course you're free to complicate your life in any number of ways by fighting it. :-) That sucks, doing that will make my deployment process a nightmare. Any way around the problem I described above? Uh, nightmare? If it were me I'd fix that deployment process. YMMV. -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat Manager sees distribution directories as applications
Thanks Chris, I'm now just pointing the appBase to an empty directory and everything looks great. A lot easier than reorganizing my server setup. Although I do agree with everyone that that approach (each Host has it's own dir) is more *correct* the complexity of it just too much for my organization at this moment. On Mon, Nov 2, 2009 at 3:16 PM, André Warnier a...@ice-sa.com wrote: Jonathan Mast wrote: / --/webapps -/host_MY_HOST ---/MY_CONTEXT Is it not more like server -- Host1 --webapps -- manager -- your app 1 -- your app 2 -- others -- Host2 --webapps -- manager -- your app3 (maybe the same as app 1 above) -- others ? Maybe you did not exactly grasp what Chuck was asking you, which was what are you trying to achieve ? (.. with the Tomcat Manager application) As far as I know, the Manager allows you to : - list the applications that exist - start and stop these applications - undeploy and application - deploy an application (all of that within a Host, and using a nice interactive web page). Not necessarily for me, but in the grand Tomcat scheme of things, these look like relatively simple things, that could be done with something else. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat Manager sees distribution directories as applications
When I log into the Tomcat Web Application Manager, in addition to the actual webapps defined in server.xml, it also lists the /bin, /conf, /logs, /temp, /lib and /work directories of the Tomcat installation as if they are webapps. I doubt this is correct, so how do I fix it? thanks, Tomcat 6 (behind Httpd 2.2) Java 1.6
Re: Tomcat Manager sees distribution directories as applications
I think it must be because all the webapps except the manager webapp is actually located outside of tomcat's dir (its in httpd's directory). Its too late in the day for the sanitization needed with my server.xml, but I think the cause is the dir issue above. thanks On Fri, Oct 30, 2009 at 5:07 PM, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Fri, Oct 30, 2009 at 2:03 PM, Jonathan Mast jhmast.develo...@gmail.com wrote: When I log into the Tomcat Web Application Manager, in addition to the actual webapps defined in server.xml, it also lists the /bin, /conf, /logs, /temp, /lib and /work directories of the Tomcat installation as if they are webapps. I doubt this is correct, so how do I fix it? Sounds like your server.xml is wildly wrong. :-) You might want to post a sanitized de-commented version here... -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Best Tomcat O.S. and Server Configuration
so which linux distro should you use? that question has no right or wrong answer ;) i don't know much about virtualization, but if I had 4 (or 5) servers to do those things, here's what i would use: 1) CENTOS: SVN MySQL 2) Slackware: Tomcat Trac (if if runs inside of Tomcat) 3) Slackware: Tomcat 4) Slackware: Tomcat generally: Centos is full-featured but also somewhat heavyweight and bolted down out of the box Slackware is very flexible but we've found it's lack of package management difficult and as such use it only for httpd/tomcat I've never touch SuSE or Ubuntu so can't comment on those. Gentoo is super high performance but could lead to your head exploding during setup. On Tue, Oct 20, 2009 at 11:52 AM, beppe_c giuseppe.ca...@calbisolutions.com wrote: Hi all, I've just bought a dedicated server, and I'm looking 4 the best configuration. I need to run Java (Struts2-hibernate+mysql) applications through Tomcat. Motherboard supports till 8GB RAM CPU Intel 2,6GHz Pentium Dual Core 4GB RAM DDR2 667 MHz 2HD SATA 500GB 7200rpm in RAID 1 software I'm thinking to create 4 virtual servers: 1) Developing Environment. It contains repository (svn) and Trac application (a project management web app.) 2) Test Environment. Identical to Production. 3) Production Environment. Must run Struts2+Hibernate apps. 4) Parking Environment. Dedicated to simple static sites and parked domains. 5) Mysql Environment. To be used and not duplicated from the other virtualizations. I'd create also a virtual shared storage. I'm going to use XenServer to virtualize, I'm almost sure about it. Yet, I still don't know which O.S. is better to use on the virtualizations.. over of all, on test and production environments. Please, tell me some advice about it.. or about the right strategy in virtualizing the system. Thanx.. ciao ciao -- View this message in context: http://www.nabble.com/Best-Tomcat-O.S.-and-Server-Configuration-tp25977685p25977685.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Does Tomcat http support subdomains?
If you by subdomains you mean foo.yoursite.com, bar.yoursite.com and so on, then of course Tomcat supports that. In the server.xml file, add: Host name=foo.yoursite.com Context path= docBase=/your/path/here/foo_site / /Host On Tue, Oct 20, 2009 at 4:03 PM, Tony Anecito adanec...@yahoo.com wrote: Hi Chuck, I am still a newbe at this concept but here is a link that mentions Apache Web Server setup in addition to DNS you mentioned. They do add Virtual Hosts setup to support and I am not sure for Tomcat what would be needed to do this. http://content.websitegear.com/article/subdomain_setup.htm Regards, -Tony --- On Tue, 10/20/09, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Caldarale, Charles R chuck.caldar...@unisys.com Subject: RE: Does Tomcat http support subdomains? To: Tomcat Users List users@tomcat.apache.org Date: Tuesday, October 20, 2009, 1:46 PM From: Tony Anecito [mailto:adanec...@yahoo.com] Subject: Does Tomcat http support subdomains? Does anyone know if Tomcat supports subdomains for its or the APR http function? I'm confused; what's there to support? The primary thing you need is DNS resolution of the different names, insuring that the resolved IP addresses all target your server. Everything else is browser, not server, related. - 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: 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: Persistent Storage for Webapps
So you have multiple contexts on a host, each of which needs separate, persistent storage? If you don't want to keep track of a property files, you could write a bean with a method that takes a HttpRequest as a argument, and returns a file path based on the info in the request. You would have to dedicate a directory on your server as the root for the persistence system. Then build subdirectories based on info available in the request object. I could go on if you want, but basically I'm trying to say there is more than enough info in each HttpRequest to allow you build a flexible, scalable persistence system without having to resort to .properties files which you'll then have to squirrel away somewhere and remember to update each time you change your Context name, etc. Just look at the javadocs for HttpRequest. See especially getContextPath() and getLocalName(). On Mon, Oct 12, 2009 at 12:57 PM, Jesse Long j...@unknown.za.net wrote: Tobias Crefeld wrote: Am Mon, 12 Oct 2009 13:01:44 +0200 schrieb Jesse Long j...@unknown.za.net: In my webapp I need persistent storage. I am building my webapp as a .war file, and copying it into $CATALINE_HOME/webapps/ Tomcat extracts $CATALINA_HOME/webapps/app.war to $CATALINA_HOME/webapps/app/ The war file contains an empty directory /WEB-INF/data . During operations, data files are created under /WEB-INF/data/ WEB-INF should contain only static files which shouldn't be accessible by Webclients (directly), e.g. by /app/data/filename . So it seems to be a bad place Question: id /WEB-INF/ in the extracted directory the correct place for persistent data storage? If not, where is? AFAIK there is no general advise where to put dynamic, persistent data. As system administrator I prefer solutions that give me the opportunity to decide myself where to put dynamic data. There are a lot of reasons for this: securing against disk space overflow, backup, priviledge separation, etc. Following this way you might create a properties-file outside the Tomcat-hierarchy at a sensible place (e.g. /etc/app.properties) with the paths your application should use. Another way is to define a Tomcat-parameter during JVM-startup that will contain the path to your data-directory. As this might not survive the next update of Tomcat itself I don't like this kind of configuration but some applications and classes are working this way. My goal is to find a consistent way of creating persistent data relative to the context. I dont want to have to configure context parameters with data directory paths for each installation. untested idea: If you have no control over the filesystem of the target Tomcat you could create a mini-application named data.war that you are deploying. Of course there is always the danger of accidentally erasing the data by re-deploying this pseudo-application. And you will have to find a way by valves, etc. to preserve this path from being accessed by web-clients. Maybe it is enough if you leave out the context-entry. Thanks for your answers Tobias. Unfortunately we have a very real use case for multiple instances on one host, with different data paths. So, /etc/app.properties is not usable, but /etc/app-context path derived data.properties might be but virtual hosting would break. No way to identify unique host consistently. Also, I could use a path name derived from the temp directory name, but nothing says the temp directory name will be consistent. For now I will reluctantly use context parameters. Thanks, Jesse - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Virtual Hosts and manager application.
Try placing the literal path to the manager in there instead of the ${catalina.home} variable. On Mon, Aug 24, 2009 at 11:09 AM, Wesley Acheson wesley.ache...@gmail.comwrote: Hi, I'm using the following configuration. *VERSION*: Tomcat 6.0.20* OS*: Fedora core 9 *uname -a*: Linux attacker.myriad.local 2.6.27.25-78.2.56.fc9.i686 #1 SMP Thu Jun 18 12:47:50 EDT 2009 i686 i686 i386 GNU/Linux *install path*: /home/servers/apache-tomcat-6.0.20 On *another* machine (windows and my desktop). I'm running Apache HTTP which is connected via AJP. I don't think thats relevant to my query but you seem to want all the details one can give. Basically my problem is I have added hosts to the server as follows in server.xml (please note I've removed comments for brevity and everything before service.) Service name=Catalina Connector port=8180 protocol=HTTP/1.1 connectionTimeout=2 redirectPort=8543 / Connector port=8109 protocol=AJP/1.3 redirectPort=8543 / Engine name=Catalina defaultHost=localhost Realm className=org.apache.catalina.realm.UserDatabaseRealm resourceName=UserDatabase/ !-- Define the default virtual host Note: XML Schema validation will not work with Xerces 2.2. -- Host name=localhost appBase=webapps unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false /Host Host name=applications.westest.example.com appbase=/home/servers/applications.westest unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false /Host Host name=cashier.westest.example.com appbase=/home/servers/cashier.westest unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false /Host Host name=communication.westest.example.com appbase=/home/servers/communication.westest unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false /Host /Engine /Service Now to try to add the manager application to each domain following the instructions found at http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html i've added a manager.xml to each of my hosts. For example /home/servers/apache-tomcat-6.0.20/conf/Catalina/ cashier.westest.example.com/manager.xml the contents of this file are as follows. ?xml version=1.0 encoding=UTF-8? Context docBase=${catalina.home}/webapps/manager privileged=true antiResourceLocking=false antiJARLocking=false /Context However whenever I alter this file (or restart) I get the following in catalina.out Aug 24, 2009 5:04:14 PM org.apache.catalina.startup.HostConfig checkResources INFO: Undeploying context [/manager] Aug 24, 2009 5:04:14 PM org.apache.catalina.startup.HostConfig deployDescriptor WARNING: A docBase /home/servers/apache-tomcat-6.0.20/webapps/manager inside the host appBase has been specified, and will be ignored Aug 24, 2009 5:04:14 PM org.apache.catalina.core.StandardContext resourcesStart SEVERE: Error starting static Resources java.lang.IllegalArgumentException: Document base /home/servers/apache-tomcat-6.0.20/./manager does not exist or is not a readable directory at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142) at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4048) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1274) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590) at java.lang.Thread.run(Thread.java:619) Aug 24, 2009 5:04:14 PM org.apache.catalina.core.StandardContext start SEVERE: Error in resourceStart() Aug
Re: Virtual Hosts and manager application.
You need to specify the path attribute in the Context tag. I would recommend something other than just manager as I've see malicious bots looking for it. I would also remove the anitResourceLocking and antiJARLocking attrs, why do you think you need them? On Mon, Aug 24, 2009 at 11:21 AM, Wesley Acheson wesley.ache...@gmail.comwrote: Thanks Jonathan. I've tried but I get the same or a similar result. See its right when the WARNING is issued but wrong two lines down. * manager.xml* ?xml version=1.0 encoding=UTF-8? Context docBase=/home/servers/apache-tomcat-6.0.20/webapps/manager privileged=true antiResourceLocking=false antiJARLocking=false /Context *catalinia.out* * *Aug 24, 2009 5:17:25 PM org.apache.catalina.startup.HostConfig checkResources INFO: Undeploying context [/manager] Aug 24, 2009 5:17:25 PM org.apache.catalina.startup.HostConfig deployDescriptor WARNING: A docBase /home/servers/apache-tomcat-6.0.20/webapps/manager inside the host appBase has been specified, and will be ignored Aug 24, 2009 5:17:25 PM org.apache.catalina.core.StandardContext resourcesStart SEVERE: Error starting static Resources java.lang.IllegalArgumentException: Document base /home/servers/apache-tomcat-6.0.20/./manager does not exist or is not a readable directory at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142) at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4048) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1274) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590) at java.lang.Thread.run(Thread.java:619) Aug 24, 2009 5:17:25 PM org.apache.catalina.core.StandardContext start SEVERE: Error in resourceStart() Aug 24, 2009 5:17:25 PM org.apache.catalina.core.StandardContext start SEVERE: Error getConfigured Aug 24, 2009 5:17:25 PM org.apache.catalina.core.StandardContext start SEVERE: Context [/manager] startup failed due to previous errors Aug 24, 2009 5:17:25 PM org.apache.catalina.core.StandardContext stop INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[ cashier.westest.myriadpayments.com].[/manager] has not been started cat manager.xml* * On Mon, Aug 24, 2009 at 5:13 PM, Jonathan Mast jhmast.develo...@gmail.comwrote: Try placing the literal path to the manager in there instead of the ${catalina.home} variable. On Mon, Aug 24, 2009 at 11:09 AM, Wesley Acheson wesley.ache...@gmail.comwrote: Hi, I'm using the following configuration. *VERSION*: Tomcat 6.0.20* OS*: Fedora core 9 *uname -a*: Linux attacker.myriad.local 2.6.27.25-78.2.56.fc9.i686 #1 SMP Thu Jun 18 12:47:50 EDT 2009 i686 i686 i386 GNU/Linux *install path*: /home/servers/apache-tomcat-6.0.20 On *another* machine (windows and my desktop). I'm running Apache HTTP which is connected via AJP. I don't think thats relevant to my query but you seem to want all the details one can give. Basically my problem is I have added hosts to the server as follows in server.xml (please note I've removed comments for brevity and everything before service.) Service name=Catalina Connector port=8180 protocol=HTTP/1.1 connectionTimeout=2 redirectPort=8543 / Connector port=8109 protocol=AJP/1.3 redirectPort=8543 / Engine name=Catalina defaultHost=localhost Realm className=org.apache.catalina.realm.UserDatabaseRealm resourceName=UserDatabase/ !-- Define the default virtual host Note: XML Schema validation will not work with Xerces 2.2. -- Host name=localhost appBase=webapps unpackWARs=true autoDeploy=true
Null value in response.sendRedirect() causes original url to be invoked 20 times
A null value in bounce_url is causing the original Request url to be invoked exactly 20 times, rather than dying with NullPointerException: public static synchronized void doSomething( HttpServletRequest request, HttpServletResponse response, JspWriter out) { final String foo = request.getParameter(foo); String bounce_url = request.getParameter(bounce); if (DataUtils.isValidFoo(foo)) { Thread myThread = new Thread(new Runnable() { public void run() { FooFactory.foomatic(foo); } }, fooFread); myThread.start(); } try { response.sendRedirect(bounce_url); } catch (IOException ex) { logger.log(ex); } } So basically if the bounce parameter is not provided then this snippet of code ends being invoked 20 times. If bounce is provided then everything works fine. Is this a bug in Tomcat? Java 1.6 Tomcat 6.0.18
Re: Null value in response.sendRedirect() causes original url to be invoked 20 times
Yeah I'm now doing a null check before the sendRedirect. But why doesn't it throw a NullPointerException, doesn't setting the Location header boil down eventually to a string concat, which in this case be attempted on a null reference? On Fri, Jun 26, 2009 at 12:37 PM, Tim Funk funk...@apache.org wrote: LiveHttHeaders is your friend ... Lets assume I have this as foo.jsp: % response.sendRedirect(null); if (out!=null) {return;} % http://localhost/foo.jsp GET /foo.jsp HTTP/1.1 Host: localhost HTTP/1.x 302 Moved Temporarily Server: Apache-Coyote/1.1 Content-Type: text/html;charset=UTF-8 Content-Length: 0 Date: Fri, 26 Jun 2009 16:33:15 GMT With no Location header in the response - some browsers will giveup. Others may redirect to the original URL. Others may do odder things. -Tim Jonathan Mast wrote: A null value in bounce_url is causing the original Request url to be invoked exactly 20 times, rather than dying with NullPointerException: - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Null value in response.sendRedirect() causes original url to be invoked 20 times
java.lang. IllegalStateException - If the response was committed or if a partial URL is given and cannot be converted into a valid URL I was just about to quote this myself. Perhaps this is not a Tomcat issue per se, but rather a gray area of the Servlet spec. Obviously a NullPointerException is being thrown at some level, but Tomcat is catching it and apparently just replacing it with , this is acceptable in that Tomcat is following the letter of spec, so to speak, but definitely not following the spirit of the java in general, imho. On Fri, Jun 26, 2009 at 12:51 PM, Jonathan Mast jhmast.develo...@gmail.comwrote: Yeah I'm now doing a null check before the sendRedirect. But why doesn't it throw a NullPointerException, doesn't setting the Location header boil down eventually to a string concat, which in this case be attempted on a null reference? On Fri, Jun 26, 2009 at 12:37 PM, Tim Funk funk...@apache.org wrote: LiveHttHeaders is your friend ... Lets assume I have this as foo.jsp: % response.sendRedirect(null); if (out!=null) {return;} % http://localhost/foo.jsp GET /foo.jsp HTTP/1.1 Host: localhost HTTP/1.x 302 Moved Temporarily Server: Apache-Coyote/1.1 Content-Type: text/html;charset=UTF-8 Content-Length: 0 Date: Fri, 26 Jun 2009 16:33:15 GMT With no Location header in the response - some browsers will giveup. Others may redirect to the original URL. Others may do odder things. -Tim Jonathan Mast wrote: A null value in bounce_url is causing the original Request url to be invoked exactly 20 times, rather than dying with NullPointerException: - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: The best place for implementing context specific behavior?
Chris, this is indeed a case of private labeling. My company has setup a site to which a major distributor wants to send traffic. As such they are demanding custom advertising tags. The problem is that this site will also be recieving traffic from other distribution channels, hence the need for unique hostnames and host-specific content. The host-specific content will be plugged into adslots on the pages. It's not clear to me that the OP wants separate instances of one webapp (one per host), or if he wants one instance of one webapp that services all hosts. We really need that clarified before any further suggestions can be made. I want multiple instances of 1 webapp, think of the webapp as a class, and the contexts as instances of that class. I'm almost certain that you cannot have shared instances a of webapp across multiple contexts, or least at least not across multiple hosts. I'm probably just going to sniff each request, although inefficient, it is the easiest to implement. Anyway the inefficiency is not very costly, just a simple string lookup in a db, the results of which will be cached by the lookupBean. On Thu, Jun 25, 2009 at 6:23 AM, André Warnier a...@ice-sa.com wrote: Caldarale, Charles R wrote: From: André Warnier [mailto:a...@ice-sa.com] Subject: Re: The best place for implementing context specific behavior? I believe (but we need a real expert here) that having multiple Host entries sharing the same appBase is a receipe for problems. It seems to work for most usages. As Mark pointed out, each Host or Context should have separate work directories to avoid conflicts with temp files, JSPs, etc. If it is really just to have a single copy of the code on disk however, you may be able to get away with having multiple (differently named) appBase attributes, but all symlinked to the same physical location That will make no difference, since the underlying location is the same for all. I must say that I don't really understand the requirement, unless your fruit webapp is really big (in disk size), or you have many different fruit hosts. It's not clear to me that the OP wants separate instances of one webapp (one per host), or if he wants one instance of one webapp that services all hosts. We really need that clarified before any further suggestions can be made. Agreed. But was is relatively clear is that, synthetically, he wants to do some kind of relatively heavy intialisation that is hostname-dependent, and would rather not have to redo it at each new request. For example - but just as an example - open a connection with a database, and read a row of a table, the exact row being accessed being dependent on the hostname addressed in the request; then, in a manner depending on the data read, initialise some persistent object that could be accessed subsequently by all servlets belonging to this webapp in this Host, for the lifetime of this webapp. So he would like to do this once (per hostname), and then be able at each request, to efficiently retrieve pointers to the appropriate thing that has been initialised once, from whichever servlet belongs to the webapp and is invoked in the context of this Host. What is also not clear yet, is if this initialisation could be done once, at Tomcat start, or would have to be redone if for instance the webapp is stopped and restarted, or unloaded and reloaded. Or, if these are individual webapps per Host, if one of these Host-specific webapps must be able to be stopped/started independently of the other Host-specific webapps. Or, to which extent this overlaps the idea of a session (as I understand it however, it does not, and the initialisation is to be valid for all subsequent requests to the same hostname, whether they belong to the same client session or not). To the above general requirement, for which possibly there would be several possible solutions, there is then an additional requirement added about there being a single webapp, or context, or whatever which I do not fully understand, but which may be valid and restrict the choices available. That's how I see it anyway. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: The best place for implementing context specific behavior?
You misunderstood the issue at hand. The host name I'm detecting is not the that of the viewer of my site, but my site, so there must be different host virtualhosts setup. On Thu, Jun 25, 2009 at 11:07 AM, Pid p...@pidster.com wrote: Jonathan Mast wrote: Chris, this is indeed a case of private labeling. My company has setup a site to which a major distributor wants to send traffic. As such they are demanding custom advertising tags. The problem is that this site will also be recieving traffic from other distribution channels, hence the need for unique hostnames and host-specific content. The host-specific content will be plugged into adslots on the pages. It's not clear to me that the OP wants separate instances of one webapp (one per host), or if he wants one instance of one webapp that services all hosts. We really need that clarified before any further suggestions can be made. I want multiple instances of 1 webapp, think of the webapp as a class, and the contexts as instances of that class. I'm almost certain that you cannot have shared instances a of webapp across multiple contexts, or least at least not across multiple hosts. I'm probably just going to sniff each request, although inefficient, it is the easiest to implement. Anyway the inefficiency is not very costly, just a simple string lookup in a db, the results of which will be cached by the lookupBean. If you're analyzing the host name per request and no other config is required, just point it all at the default host. You may not need to setup additional virtual hosts in server.xml. p On Thu, Jun 25, 2009 at 6:23 AM, André Warnier a...@ice-sa.com wrote: Caldarale, Charles R wrote: From: André Warnier [mailto:a...@ice-sa.com] Subject: Re: The best place for implementing context specific behavior? I believe (but we need a real expert here) that having multiple Host entries sharing the same appBase is a receipe for problems. It seems to work for most usages. As Mark pointed out, each Host or Context should have separate work directories to avoid conflicts with temp files, JSPs, etc. If it is really just to have a single copy of the code on disk however, you may be able to get away with having multiple (differently named) appBase attributes, but all symlinked to the same physical location That will make no difference, since the underlying location is the same for all. I must say that I don't really understand the requirement, unless your fruit webapp is really big (in disk size), or you have many different fruit hosts. It's not clear to me that the OP wants separate instances of one webapp (one per host), or if he wants one instance of one webapp that services all hosts. We really need that clarified before any further suggestions can be made. Agreed. But was is relatively clear is that, synthetically, he wants to do some kind of relatively heavy intialisation that is hostname-dependent, and would rather not have to redo it at each new request. For example - but just as an example - open a connection with a database, and read a row of a table, the exact row being accessed being dependent on the hostname addressed in the request; then, in a manner depending on the data read, initialise some persistent object that could be accessed subsequently by all servlets belonging to this webapp in this Host, for the lifetime of this webapp. So he would like to do this once (per hostname), and then be able at each request, to efficiently retrieve pointers to the appropriate thing that has been initialised once, from whichever servlet belongs to the webapp and is invoked in the context of this Host. What is also not clear yet, is if this initialisation could be done once, at Tomcat start, or would have to be redone if for instance the webapp is stopped and restarted, or unloaded and reloaded. Or, if these are individual webapps per Host, if one of these Host-specific webapps must be able to be stopped/started independently of the other Host-specific webapps. Or, to which extent this overlaps the idea of a session (as I understand it however, it does not, and the initialisation is to be valid for all subsequent requests to the same hostname, whether they belong to the same client session or not). To the above general requirement, for which possibly there would be several possible solutions, there is then an additional requirement added about there being a single webapp, or context, or whatever which I do not fully understand, but which may be valid and restrict the choices available. That's how I see it anyway. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: The best place for implementing context specific behavior?
Haha thanks, Andre, I'm not lost but it seems other people might be. I'm going to go ahead define separate hosts, although the Alias option mentioned might work, I don't know if it would preserve correctly the value returned by request.getLocalName() which is what I'm using for determining the host specific content, but if someone knows better than say so. The Alias element is kinda poorly documented on tomcat.apache.com, it only has a paragraph. Seems like a holdover from httpd configs On Thu, Jun 25, 2009 at 11:53 AM, André Warnier a...@ice-sa.com wrote: Jonathan, if by now you are a bit lost in the various options related to the hostname and why, just say so. I have a practised step-by-step explanation available. It's all pretty standard HTTP/name-based virtual hosts stuff, but it has many people confused. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
The best place for implementing context specific behavior?
I have a webapp that I would like to behave in a context (actually host)-specific manner. Where is the best place to initialize the context/host specific functionality? Let me demonstrate what I'm talking about. Lets say I have a webapp Fruit located in folder webapps/fruit. I want to define: apples.mysite.com bananas.mysite.com coconuts.mysite.com etc ... all of which point to webapps/fruit (these are hosts with a / context pointing to webapps/fruit as the docBase, to be more precise). When someone visits apples.mysite.com they see an apple, when they visit bananas.mysite.com they see a banana, and so on. Where in the fruit app is the best place for instance of Fruit to introspect itself (basically look for what host name it is defined under) and prepare accordingly? I've looked into using Context Parameters in the server.xml declarations but I would like to avoid this if possible b/c this functionally is more elegantly determined through introspection (the web-app saying what host do i belong to?). Of course I could always call request.getLocalName(), but that would be inefficient as it would have to be invoked on every request. I guess what I'm looking for someplace in the context initialization process where i could hook into and do my stuff and have it apply to the entire context throughout it's lifecycle. Can't seem to find it digging around the javax.servlet.* javadocs. thanks
Re: The best place for implementing context specific behavior?
Andre, its one single, physical app/docBase, mapped to multiple contexts (which happen to located on different virtual hosts). This is a requirement. The /META-INF/context.xml approach is ruled out by this requirement. My goal is to have a layer of code takes a the current host (eg. apples.mysite.com) looks it up in a database where it is linked to host-specific content. After this stage, the showFruit.jsp will display an Apple and so on. - have your webapp (actually I guess, the first servlet) in it's init() code, get the hostname from getServerName() and perform whatever setup it needs to. Then save this in an attribute of the ServletContext But where do I find this elusive init() method? On Wed, Jun 24, 2009 at 5:01 PM, André Warnier a...@ice-sa.com wrote: Hi. I am one of the least Tomcat and Java qualified people that regularly lurk on this forum, so don't take my word for any of what follows. Let's say that I am just trying to apply what I think I have learned here. And I am eager for contradiction, because it is said that this is how one learns. Jonathan Mast wrote: I have a webapp that I would like to behave in a context (actually host)-specific manner. Where is the best place to initialize the context/host specific functionality? Let me demonstrate what I'm talking about. Lets say I have a webapp Fruit located in folder webapps/fruit. I want to define: apples.mysite.com bananas.mysite.com coconuts.mysite.com etc ... all of which point to webapps/fruit (these are hosts with a / context pointing to webapps/fruit as the docBase, to be more precise). appBase ? Do you mean all Hosts point to the *same physical* webapps/fruit, or does each Host have its own copy in a separate directory ? When someone visits apples.mysite.com they see an apple, when they visit bananas.mysite.com they see a banana, and so on. Where in the fruit app is the best place for instance of Fruit to introspect itself (basically look for what host name it is defined under) and prepare accordingly? I've looked into using Context Parameters in the server.xml declarations That would probably better be in a /META-INF/context.xml, no ? (at least if these are distinct webapp/fruit) or see here for more complete info : http://tomcat.apache.org/tomcat-6.0-doc/config/context.html but I would like to avoid this if possible b/c this functionally is more elegantly determined through introspection (the web-app saying what host do i belong to?). Of course I could always call request.getLocalName(), I think you want getServerName(), or you'd always get the same DNS name/IP, no matter wich virtual Host is called.. but that would be inefficient as it would have to be invoked on every request. I guess what I'm looking for someplace in the context initialization process where i could hook into and do my stuff and have it apply to the entire context throughout it's lifecycle. Can't seem to find it digging around the javax.servlet.* javadocs. I reason as follows : - a webapp is run by a thread - a thread is started by a Connector - I don't think that a thread is Host-specific, in the sense that it can run one webapp for one Host, and the next instant run another webapp for another Host. What I'm saying is that I am not sure that above the Request level, you will find anything that is Host-persistent to keep your stuff in and retrieve it (I mean for webapps shared by several Hosts, which is probably a bad idea anyway). To this eager student thus, the correct way to do what I understand you want to do, seems to be : - have each Host have its own appBase (webapp dir), with in each a copy of your (identical) webapp code Fruit. - have your webapp (actually I guess, the first servlet) in it's init() code, get the hostname from getServerName() and perform whatever setup it needs to. Then save this in an attribute of the ServletContext - which should then be available at each subsequent execution of any servlet composing the webapp Inspired by the Servlet Spec 2.5, section 2.3 Servlet lifecyle, 2.3.2 Initialization. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Redeploy application
try: http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html On Wed, Jun 17, 2009 at 4:53 PM, Tokajac imre_to...@hotmail.com wrote: Hello, Whenever i want to deploy new version of application (that's VERY often), have to: stop tomcat; execute build.xml -ant script; start tomcat; Is there any way, target in ant, that can make this easier? Regards P.S. http://www.coderanch.com/t/449958/Tomcat/Redeploy-application#2003409 -- View this message in context: http://www.nabble.com/Redeploy-application-tp24081872p24081872.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Redeploy application
dude, step-by-step instructions are on that page, its actually one of the more clear and concise how-tos provided by tomcat. On Wed, Jun 17, 2009 at 5:21 PM, Tokajac imre_to...@hotmail.com wrote: http://localhost:8080/manager/deploy?path=/appname but i get: Access to the requested resource has been denied with user: tomcat; pass: tomcat Can you explain step-by-step the redeployment configuration, please? Regards Jonathan Mast-2 wrote: try: http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html On Wed, Jun 17, 2009 at 4:53 PM, Tokajac imre_to...@hotmail.com wrote: Hello, Whenever i want to deploy new version of application (that's VERY often), have to: stop tomcat; execute build.xml -ant script; start tomcat; Is there any way, target in ant, that can make this easier? Regards P.S. http://www.coderanch.com/t/449958/Tomcat/Redeploy-application#2003409 -- View this message in context: http://www.nabble.com/Redeploy-application-tp24081872p24081872.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- View this message in context: http://www.nabble.com/Redeploy-application-tp24081872p24082327.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: using static helper classes within servlets
Sid, what everyone is saying about my first reply to your post is correct, that code sample unnecessarily uses synchronization to achieve what static initialize could do less expensively. I wrote class awhile ago with paying much attention to the costs of synchronization. private static final SomeBean someBean = new SomeBean(); public static getSomeBean() { return someBean; } is a much better approach to the issue you are having and I will myself transition to this pattern the shortly. I should add that in my webapp, most references to Beans served by the lazy BeanBag are themselves statically initialized (because static methods make use of them) so this has probably shielded me from the costs of the accessor methods being synchronized. On Mon, Jun 15, 2009 at 1:25 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Christopher Schultz [mailto:ch...@christopherschultz.net] Subject: Re: using static helper classes within servlets You can get a significant performance improvement by doing this instead: private static final SomeBean someBean = new SomeBean(); public static getSomeBean() { return someBean; } Of course, if you're going for delayed/lazy instantiation, you're not going to get it, but you at least drop the penalty for synchronization. Using an initialize-on-demand holder class permits lazy instantiation: class MyClass { ... private static class LazySomethingHolder { public static final Something something = new Something(); } ... public static Something getInstance() { return LazySomethingHolder.something; } ... } The LazySomethingHolder will be loaded - but not initialized - when MyClass is loaded. Initialization will occur only when MyClass.getInstance() is invoked. The necessary synchronization during initialization is all handled internally by the JVM. - 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.
Re: using static helper classes within servlets
I've not done anything with EJBs and I'm not sure what exactly you mean by static properties. I have however dealt with reducing instantiations in servlets. I simply created a BeanBag class with static methods to each one of my beans; these are not proper beans, but where simply objects that were formerly used in JSP via the jsp:useBean directive. Here is the general pattern: class BeanBag { private static SomeBean someBean = null; public static synchronized getSomeBean() { if (someBean == null) someBean = new SomeBean(); return someBean; } } I have now numerous Servlets, JSPs and POJOs that use BeanBag to obtain singleton instances of my beans. Its worked great for me. On Sun, Jun 14, 2009 at 8:28 AM, Sid Sidney pvcsv...@yahoo.com wrote: HI, In my web app, my servlets user several delegate classes that connect to ejbs (session beans.) I was thinking about putting these delegates into a helper class as static properties. That way my servlets can just reference the same delegates. I don't want to have to create a new instance of a delegate with every request that my servlet(s) handles. However, I'm wondering if this will cause synchronization issues with multiple requests being handled, as our site handles a heavy load of requests. Any suggestions would be appreciated?
Re: Loading dynamically created content: An old chestnut but still a problem.
So you are actually storing the image data in the database, as opposed to the filepath? interesting... So your webapp accesses the image data as needed and writes it to imagecache dir? Is this feature not working? i don't understand what exactly the issue is that you are having. please explain. On Wed, Jun 10, 2009 at 9:41 AM, Lyallex lyal...@gmail.com wrote: apache-tomcat-6.0.16 jdk1.6.0_03 Dev box : Windows Deployment box: Linux Hi I've read some other posts that seem to be asking similar questions but I can't find the answer so far. maybe someone here would be kind enough to give me a hint I have a retail application that stores the product images in a database. Each product can have many images and products are being uploaded all the time. Fetching images from the database every time results in a clunky page load so I want to cache the images to disk the first time an item is accessed my cache manager checks the disk cache to see if images for that item are available. If not it loads them onto the disk. this happens in the servlet that serves the item details up so the images are in the disk cache before the request is forwarded to the view (jsp) In the jsp I access the images from the disk cache. The problem is, the first time I access the item details the images are written to the cache which resides directly under the context root but they are not loaded in the view. If I restart tomcat the images disply fine so I know all the caching is working correctly. I can't restart tomcat everytime I upload a new product so how can I force tomcat to recognise the new images 'on the fly' so as to speak? The application is running as the ROOT application on the server and is the only application being served. An example image might be ../apache-tomcat-6.0.16/webapps/ROOT/imagecache/830_main.jpg (example) I'm quite happy that the imagecache is deleted everytime I redeploy the application because the application is starting to stabilise and once I have this last problem ironed out I will only be doing irregular maintenance. The faster loading of images is more than enough compensation. I can't use symbolic links to place the imagecache outside the application space because I develop on Windows and deploy to Linux (historical, nothing I can do about it) Any ideas much appreciated. Many thanks lyallex - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat maxThreads Issue
I encountered a similar issue of numerous Httpd processes spawning b/c of Tomcat. The issue for me was that Tomcat was running out of memory, and Httpd for some reason thought spawning a bunch a threads would help ;) Do you know how much memory these instances of Tomcat are using? The default JVM memory is ridiculously low and requires the adjustment to higher maximum value for production servers. Grep heap catalina.out to see if tomcat is indeed running out of memory. On Wed, Jun 10, 2009 at 12:44 PM, Peter Crowther peter.crowt...@melandra.com wrote: OK, so that's a JRockit JVM, not a Sun JVM. Remind me not to point you at any more Sun documentation! As a rough look at that, there are a few threads in the HTTP connector thread pool, a bunch of threads reading data from JK connections, and one or two in your app code. I've never looked at the innards of JK, so will have to leave that to one of the JK experts to interpret. - Peter - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Loading dynamically created content: An old chestnut but still a problem.
Ok, so this approach of writing to disk after reading the database is not working at all. I thought you were saying previously that was working up to a point, but then failing for new products. I know its completely possible to add images the root of a Web-App folder after deployment and have Tomcat see them. Are you by chance running Tomcat behind Apache Httpd or some other server? On Wed, Jun 10, 2009 at 1:10 PM, Lyallex lyal...@gmail.com wrote: Hi I'll try to explain in as few words as possible. When I upload a new product I store the image data and the text in the database. I did this to try and separate the data from the application with the intention of eventually having the data reside on a separate device optimised for serving data ... well that was my original thinking anyway. At the moment, when I load an image I use a proxy servlet and extract the imageid from the 'Product' (p below) img src=ImageProxy?%=WebConstants.IMAGE_ID%=%=p.calculateImageId()%... etc '/ This gets the image from the database and displays it in the page. This is clunky and slow and the image is not cached by the browser So, when a user views an item detail I do something like this getProductDetails?productId='whatever' In the GetProductDetails servlet I check the disk cache to see if the image is there, if not I get it from the database an write it to the cache, just one database access as opposed to many, the next time anyone sees that item the images are already cached. now, in the jsp I can use img src=imagecache/%=p.getProductId()%_thumb.jpg ...' etc/ In other words, as opposed to getting an anonymous byte stream and displaying it in the browser I'm now accessing a named image and the browser caches it. It all works beautifully apart from the fact that it appears the DefaultServlet will not load resources that have been written to disk after the server has been started. If I restart the server I can see my images, but only the ones loaded thus far ... Anyway, I'm currently looking at the serveResource() method in the DefaultServlet to try and figure out if it is possible to configure it to load resoures that have appeared after the server has started ... it doesn't look like it is possible which is slightly depressing ... unless of course I am missing something. Surely this is not an unusual requirement, how do others deal with serving up images that have been uploaded after the server has started. Anyway Thanks for taking the time to reply lyallex 2009/6/10 Jonathan Mast jhmast.develo...@gmail.com: So you are actually storing the image data in the database, as opposed to the filepath? interesting... So your webapp accesses the image data as needed and writes it to imagecache dir? Is this feature not working? i don't understand what exactly the issue is that you are having. please explain. On Wed, Jun 10, 2009 at 9:41 AM, Lyallex lyal...@gmail.com wrote: apache-tomcat-6.0.16 jdk1.6.0_03 Dev box : Windows Deployment box: Linux Hi I've read some other posts that seem to be asking similar questions but I can't find the answer so far. maybe someone here would be kind enough to give me a hint I have a retail application that stores the product images in a database. Each product can have many images and products are being uploaded all the time. Fetching images from the database every time results in a clunky page load so I want to cache the images to disk the first time an item is accessed my cache manager checks the disk cache to see if images for that item are available. If not it loads them onto the disk. this happens in the servlet that serves the item details up so the images are in the disk cache before the request is forwarded to the view (jsp) In the jsp I access the images from the disk cache. The problem is, the first time I access the item details the images are written to the cache which resides directly under the context root but they are not loaded in the view. If I restart tomcat the images disply fine so I know all the caching is working correctly. I can't restart tomcat everytime I upload a new product so how can I force tomcat to recognise the new images 'on the fly' so as to speak? The application is running as the ROOT application on the server and is the only application being served. An example image might be ../apache-tomcat-6.0.16/webapps/ROOT/imagecache/830_main.jpg (example) I'm quite happy that the imagecache is deleted everytime I redeploy the application because the application is starting to stabilise and once I have this last problem ironed out I will only be doing irregular maintenance. The faster loading of images is more than enough compensation. I can't use symbolic links to place the imagecache outside the application space because I develop on Windows and deploy to Linux (historical, nothing I
Re: Tomcat maxThreads Issue
Well I'm not sure how to check the current memory settings but I sure know how to adjust them :) Presuming that you downloaded Tomcat directly and installed manually: open $TOMCAT/bin/catalina.sh Add the following somewhere near the top (I place mine after all the explanatory comments): JAVA_OPTS= -Xmx1024m This is tells java to allow a maximum of 1024 megabytes of memory to this instance of tomcat. Adjust appropriately. Please note: * the leading SPACE before the -Xmx. * this is not a labeled parameter, therefore no = btwn the option and value. On Wed, Jun 10, 2009 at 1:12 PM, Jones, Keven keven.jo...@ncr.com wrote: Thank you Tim I am going to attempt to set the maxThreads on 8011 to 600 and hope it helps. The config is 1 linux apache2 server with 4 linux tomcat servers and each tomcat server has 4 sepearte tomcat instances. So we have a total of 16 tomcat instances across 4 servers. Yes, there is a firewall between the web sever and the app(tomcat)/db(mysql) server. KJ -Original Message- From: Tim Funk [mailto:funk...@apache.org] Sent: Wednesday, June 10, 2009 1:02 PM To: Tomcat Users List Subject: Re: Tomcat maxThreads Issue Looking at the history of the thread - here are some guesses You have a connector on port 81 (http) and a connector on 8011 (ajp) and commented out connector for 443. The port 81 connector and commented out connector are set to 600 - which means absolutely nothing if apache is talking to tomcat via jk. Set |maxThreads on the connector for using port 8011 and life should be better. If there are mulitple apache servers in front of tomcat - you need to ensure you have (#apaches * max number connections per apache) threads available on each tomcat. The thread history seems to indicate you only have one apache with 100 workers max. So raising the maxThreads in tomcat from 200 to something higher is not needed. Is there a firewall between apache and tomcat? If so - it could mean that your firewall is timing out the connection and then bad things happen. | http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html -Tim - 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: What to upgrade?
I just completed (last week actually) a migration from JDK 1.4.2/Tomcat 5.5 to JDK 1.6/Tomcat 6. In terms of backward-compatibility, we had a problem with our TagLib packages. They would not compile under with whatever version of the Servlet Spec accompanies JDK 1.6. Those were the only compatibility issues we encountered. On Wed, Jun 10, 2009 at 4:33 PM, André Warnier a...@ice-sa.com wrote: Chetan Chheda wrote: ... Disclaimer : The following statements are to be taken in a banking perspective (past bonuses are no guarantee for future ones); each situation is slightly different; my own Tomcat applications are not very sophisticated; my servers are not highly loaded; YMMV. Having done the same a couple of times, for me this was a relatively painless (and quick) upgrade, both for the JVM and for Tomcat (from Tomcat 4.1 to 5.5)(no point in stopping at 5.0). I have Tomcat 5.5 running with a JVM 1.6 and do not remember having encountered any problems with that either, so you might as well skip the JVM 1.5 also. I believe Tomcat 6 has quite a few more changes compared to 4.1, so you may not want to risk that in one step. Save your old tomcat/conf files somewhere for future reference, then install the new JVM and the new Tomcat, with the standard new conf files for the new Tomcat. Make sure it runs with some example webapp. Then /manually/ introduce the needed changes to the new configuration, one by one, on the base of your old conf files, and check after each change. Do /not/ try to keep your old configs for the new Tomcat, or you will end up with a mess. You might even be able to do this on the same server in parallel, as long as you change the ports of your Connector's. As for mod_jk, apart from making sure that the right Apache jk worker connects to the right Tomcat, I don't think that there are any real config changes required. The newer mod_jk have quite a few new options though, which you should probably at least have a look at. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Authentication from the browser
Alec, so basically members of your client company should be able to have direct access to a servlet that is otherwise restricted to a handful of users who must authenicate themselves with a username/password login, right? One solution to this situation would be to create a simple servlet that sniffs incoming request IPs, if they match the range/set of IPs of your client, then you bypass the authenication mechanism of your existing servlet and give them a full view of whatever goodies your servlet has. If incoming requests don't match the IPs then bounce them off somewhere. However this approach is not a complete solution, a very interested party could observe your system and deduce that it was based upon privileged IPs and then spoof them. It all depends upon how important this servlet is you and your organization. If it is absolutely mission critical, then you'll want to use SSL and require logins. On Tue, Jun 2, 2009 at 4:01 PM, Alec Swan alecs...@gmail.com wrote: I may not be explaining it clearly. We have one corporate customer who is putting a link to our servlet on their intranet web page. Therefore, we know the domain name of the users who need custom authentication. We can also tell the customer to put whatever we need in the link, such as HTTP headers. Does this give you enough information to propose a solution? On Tue, Jun 2, 2009 at 12:22 PM, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Tue, Jun 2, 2009 at 11:03 AM, Alec Swan alecs...@gmail.com wrote: Hassan, I don't think that the goals are contradictory, because each goal applies to its own group of users: our customer users and everybody else. Customer users should not have to enter user name and password, but everybody else should. IOW, you want it protected, and you want it openly accessable. Sorry, that sounds contradictory to me :-) If you have a customer who would like to put a link on a web page to your servlet, that servlet's URL is now in the wild -- anyone who finds it can access it. I am glad that you made me think about this, because maybe it is possible to extend Tomcat authentication to also use client IP address or domain? How would you know a priori the IP or domain of the clients? -- Hassan Schroeder hassan.schroe...@gmail.com - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Is it possible to move Tomcat logfiles?
Did CentOS setup /var and /usr on different partitions? If so then maybe it would be a good idea to place the logs some where on /var. What else will this server be used for aside from the Webserver? If nothing else and if /var and /usr are on the same partition, then I wouldn't alter the default locations of the tomcat folders. On Sun, May 10, 2009 at 11:35 AM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2009/5/10 johnrock johnpi...@yahoo.com: I am setting up a CentOS 5 server running tomcat and wanted to know whether the best practice is to leave the Tomcat logfiles in their default location: /usr/share/apache-tomcat-6.0.18/logs or whether I should place them in another directory like /var/log/tomcat. Is this possible, and/or preferred? I am new to Linux, but my understanding so far was that changing data like logfiles should not be under /usr/ but instead under /var/. Is that a correct interpretation in this case? Thanks -- 1. the log folder contains: 1) log output By default java.util.logging (aka JULI) is used to write those logs, though there is possibility to use log4j. It is configured as described in http://tomcat.apache.org/tomcat-5.5-doc/logging.html For JULI the configuration file is logging.properties 2) catalina.out, that is redirected stdout, strerr of java process running the server Look into the shell script that starts Tomcat. That is where the redirection occurs. 2. I have configurations where log folder is stored in /var/log/... and the log folder of Tomcat is simply a symbolic link to that location. It works, and I think that would be one of the easiest ways to configure it. 3. If you are concerned about /usr vs. /var, you may want to pay attention to the possibility of separating CATALINA_HOME and CATALINA_BASE E.g., you may place conf, webapps, work etc. folders on /var, while bin, common, server remain on /usr. See RUNNING.txt in the distributive. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: SSL Mysterious Self Signed Certificate
Its my understanding that all Self-signed certs generate the creepy browser messages. Not sure though. Were the imported root certs issued by a well known CA? On Wed, May 6, 2009 at 10:43 PM, Andrews, Wayne wayne.andr...@sap.comwrote: Hi I have an issue whereby on a windows installation of Tomcat; I have a mysterious seflt signed certificate displayed within the browser. Despite the fact that I have created a new keystore and imported the relevant root certs and SSL cert and then redirected server.xml to point to the keystore Any ideas?: W.
Re: OT: GoDaddy Hosting and Tomcat
Well, you get what you pay for. My GoDaddy account costs $6.99 per month and I quickly found it inadequate for hosting serious Tomcat applications, just for the reasons you listed: very unintuitive control panels, 1-day lag in servlet (non)-deployment. I'm canceling the hosting portion of my GoDaddy account as soon as I get my old dell dimension 4600 ready for hosting my website :) But the $0.99 per year .info domain name is a pretty sweet deal i think. Basically, GoDaddy is a very affordable domain name retailer; their hosting is a mickey mouse LAMP-shop. My 65 year old father has his website hosted on GoDaddy, my dad isn't interested in enterprise-level web applications, he just wants a website. Thats what Godaddy's hosting is good for. On Mon, Apr 27, 2009 at 10:44 AM, George Sexton geor...@mhsoftware.comwrote: I thought I'd write up my experiences trying to get a servlet application running on GoDaddy. Perhaps it will save someone else some pain. I have a Java Servlet calendar application. It's a stable app and I've got at least a thousand of running copies. I was attempting to install it on GoDaddy's shared Linux hosting service which runs Tomcat 5.0.27. Reading the documentation on their site, it looked like all I had to do was upload the WAR file and wait until 1:00 AM Arizona time and the application should be deployed. I did this and waited. The next day, I found the application had not deployed. A call to technical support revealed that I had to go to a certain corner of the hosting control panel and enable Java language support. I did that and waited until the next day. This is one of the problems with their shared hosting account. ANY change takes until the next day to take effect. The next day, I looked, and the WAR file had been exploded but my App didn't work. Since my App has a dependency on the database, I uploaded a simple JSP to test the DB Connection. It worked. Attempts to view the error logs failed. I called GoDaddy support. The technician told me I need to enable error logging. He walked me through the control panel and I enabled error logging. I waited until the next day. The application still didn't work. When I tried to view the error logs, I got nothing. Another call to technical support revealed that the error logs I had enabled would not actually contain any Tomcat log data. I had my call escalated to a manager. I explained to him the reason I knew my application was not working. I told him the login page was not available. His response was Yeah, there's no file with that name. I told him that the URL was a virtual mapping created in the web.xml file. After literally an hour, they came back on-line and told me that they were going to open a trouble-ticket and call me back. Several hours later, I got an Email from support saying. It doesn't work because there's no file with that name. At this point, I had a funny feeling. I created a simple WAR file with one servlet and a web.xml deployment descriptor. The deployment descriptor mapped three URLs to the servlet: /MapTest.xyz /MapTest.jsp /MapTest.html I waited until the next day. Sure enough, I could access MapTest.xyz, and MapTest.jsp. Attempts to access MapTest.html generated a 404 Not Found error. This explains why my application was not running. All my servlets are mapped into URLs with extension of .html. This was a design decision because customers generally want the maximum visibility to search engines. So, what I found is that GoDaddy.com does not pass all requests into the servlet container. It attempts to service as many requests with Apache first, and then only passes the non-mapped requests into Tomcat. There are some 50 file extensions GoDaddy co-opts including .css, .xml, and .js. This configuration actually causes their deployment of Tomcat to be non-compliant with the Servlet API version 2.3 specification. Section SRV.11.2.1 says that explicit mappings in the deployment descriptor must take precedence over implicit mappings. Taken as a SYSTEM, their deployment of Apache Tomcat is non-compliant. My feeling is that ANY request that maps to a deployed context must be passed to the servlet container. Clearly, they are not doing that. So, after all the effort, I get to tell the customer that my application will not work on their hosting account. Rats. In general, even if your application isn't using servlet mapping I can't recommend them. Since it takes until the next day before you can re-deploy a WAR file, and there are no Tomcat logs available, it would be a really rotten experience. -- George Sexton MH Software, Inc. Voice: +1 303 438 9585 URL: http://www.mhsoftware.com/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
A sample workers.properties file
The Tomcat-Connector docs say that the source dist contains a sample workers.properties file, but neither Tomcat 6 nor Httpd 2.2 src archives contain such a file. Could someone please post a sample workers.properties file for the aforementioned Tomcat and Httdp versions? Thanks
Re: A sample workers.properties file
ok, i'll look, the docs don't explicitly say what source package the sample is in. thanks On Wed, Apr 22, 2009 at 2:48 PM, André Warnier a...@ice-sa.com wrote: Jonathan Mast wrote: The Tomcat-Connector docs say that the source dist contains a sample workers.properties file, but neither Tomcat 6 nor Httpd 2.2 src archives contain such a file. But the mod_jk connector download does, I am quite sure. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: A sample workers.properties file
yeah i downloaded the source and found the sample workers.properties files. The workers.properties.minimal has a bug in it, btw, the ajp13w worker is not in the worker.list and must be added manually. But it works otherwise. On Wed, Apr 22, 2009 at 2:52 PM, André Warnier a...@ice-sa.com wrote: André Warnier wrote: Jonathan Mast wrote: The Tomcat-Connector docs say that the source dist contains a sample workers.properties file, but neither Tomcat 6 nor Httpd 2.2 src archives contain such a file. But the mod_jk connector download does, I am quite sure. You /have/ downloaded the connector also, I presume ? http://tomcat.apache.org/download-connectors.cgi and binary releases. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Installing Tomcat
Yeah Selinux is a big pain from what I've read about it and I've given up on the machine on which it runs. As you may have guessed, I'm not in charge of the tech department of a secret government spy agency ;-) so I'll leave SELinux to the spooks who invented it. I've found another box on which I can install a fresh linux dist. Pondering whether to use Slackware, Gentoo or Cent By Jakarta-Whatever, I'm referring to the commons-daemon package, as indicated on the setup page: quote Download a commons-daemon binary from the Jakarta Commons download page, and place jsvc.tar.gz and commons-daemon.jar in the $CATALINA_HOME/bin folder. /quote Why can't they even link to this project? I just wish the docs were more detailed about why this kludgy trampoline is needed, there aren't any links to the Jsvc project either! No I'm not a big fan of C, C programming should be left to the hobbits who develop the OS and who know all the magical incantations needed to use it safely. thanks On Wed, Apr 15, 2009 at 1:12 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jonathan, On 4/14/2009 9:00 PM, Jonathan Mast wrote: I've pretty much concluded that the problem is that the machine in question is SELinux-enabled and that is cause of Tomcat's inability to access the 8080 port (even though I can see tomcat on the process list, a netstat -a indicates shows no entry for 8080). Ooooh... SELinux can be tough to deal with if you don't know what you're doing. It's /super/ restrictive, and rightly so. I would have expected an error message like cannot bind to port 8080 in your catalina.out file if you really couldn't bind to port 8080, though. 1) Why not run Tomcat as root? Security, security, security. There really is no need to run Tomcat as root, so why would you? If you have a misbehaving (or rogue) web application, it can really cause chaos if it's running as root. If you run it as a lowly common user, it can't do nearly so much damage. The same argument applies for not running MSIE on Windows as Administrator: if you get malware (and you /will/), you can't affect the machine's configuration, etc. unless you are an admin. We have Tomcat running as root on our current setup (Httpd 1.3.33, Tomcat 5.5, JDK 1.4), I presume Tomcat 6 (JDK 1.6) running by itself must be more secure than our current situation. Any comments? Yes, Tomcat alone should be more secure but there really is no reason to run Tomcat as root unless you are just really, really lazy. It's not that hard to run jsvc or set up iptables appropriately. 2) My problem with jsvc is multiple: a) it involves a language so evil it can only be referred to in paraphrase: the letter between B and D. Have you actually read the instructions for it? I must admit that I didn't download it and read the instructions, but the wep site says it pretty plain and simple: $ ./configure --with-java=/path/to/java $ make Oh! The horror! Have you ever built anything using C before? This is how much packages work, and they work really well using the 'configure' business. Okay, I broke down and downloaded it. Here are the instructions for building from the README file at the top-level of the tarball: cd src/native/unix; configure; make The only problem with that is they forgot to include the ./ in front of 'configure' for those who don't have '.' in the search path (which is actually most people). It took somewhere in the neighborhood of 3 seconds to complete both the 'configure' and 'make' steps for me. b) can't they even bother to link to the Jakarta-Whatever package that I must now download and lug around? I mean c'mon ;-[ What is Jakarta-Whatever? I don't see any dependencies of any kind, here. c) really, if all this stuff is the correct way to run Tomcat on linux, why doesn't come as part of the distribution? Because jsvc is someone else's project. I suppose Tomcat could bundle it into the distro, but they haven't chosen to do so. There are also lots of people who don't use it. For instance, I run Tomcat on non-privileged ports and use httpd to front it. So, bundling it would not help people like me at all (but certainly wouldn't hurt us). The biggest problem with this kind of bundling is the fact that *NIX systems are so varied in configuration that jsvc really must be built on each individual system (hence the super-simple 'configure/make' procedure above). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAknmFXEACgkQ9CaO5/Lv0PDLKACeNOWfXcT6TbJp9dw5ThuG0qRS CwUAoK7/K6wv7FrmlpqGaMjYqIzlfHaG =mHxZ -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h
Re: Installing Tomcat
Hey Chris, I've pretty much concluded that the problem is that the machine in question is SELinux-enabled and that is cause of Tomcat's inability to access the 8080 port (even though I can see tomcat on the process list, a netstat -a indicates shows no entry for 8080). My ultimate goal was to just run Tomcat 6 (with JDK 1.6) on this machine but I've given up on this particular machine for now. But I have some questions/comments: 1) Why not run Tomcat as root? We have Tomcat running as root on our current setup (Httpd 1.3.33, Tomcat 5.5, JDK 1.4), I presume Tomcat 6 (JDK 1.6) running by itself must be more secure than our current situation. Any comments? 2) My problem with jsvc is multiple: a) it involves a language so evil it can only be referred to in paraphrase: the letter between B and D. Have you actually read the instructions for it? If you're using BSD, issue 'make foo' being sure to type only with your toes, if Linux, issue 'makeamess foo' with your nose as typing implement b) can't they even bother to link to the Jakarta-Whatever package that I must now download and lug around? I mean c'mon ;-[ c) really, if all this stuff is the correct way to run Tomcat on linux, why doesn't come as part of the distribution? 3) N/A 4) I really want to avoid the complexity of httpd (see 2.a) On Fri, Apr 10, 2009 at 1:27 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jonathan, On 4/9/2009 11:20 AM, Jonathan Mast wrote: ok, here is the plain vanilla, immaculate server.xml, straight from a fresh untarring of the tomcat 6 dist that i just re-installed, its still not working. I didn't realize you were using an unmodified configuration. My initial reaction is that you'll have to modify the default configuration in order to make it fit your needs. Here are the active connectors configured in the server.xml you posted: HTTP/1.1 connector on port 8080 AJP/1.3 connector on port 8009 I should say that apache httpd 2.0 is already running on this machine and my www.mysite.com is reachable there, so I figured www.mysite.com:8080would take me to tomcat. Is that a correct assumption? IE. Should I be able to by httpd by tacking :8080 onto the url? Yes, going to http://www.mysite.com:8080/ should contact Tomcat, as long as your DNS resolution is working and there are no firewall issues. Tomcat may not start if something is already bound to port 8080, so you should make sure that Tomcat is starting correctly. See catalina.out for any messages to the contrary. catalina.out should be indicating which connectors are started when Tomcat starts up. If I kill apache httpd (I have no intention of using it going forward), will updating server.xml with port 80 rather than port 8080 automagically get everything to work, or is there other stuff I need to do before Tomcat will run as a standalone webserver? Running Tomcat on port 80 is problematic on *NIX systems unless you run Tomcat as root, which is not advised. See http://tomcat.apache.org/tomcat-6.0-doc/setup.html for some ideas for how to bind Tomcat to port 80 on *NIX. (This page shows information on jsvc). You can also use iptables to essentially do port-forwarding. Basically, your options on Linux are: 1. Run Tomcat as root (bad idea) 2. Use jsvc (you don't want to do this ... why?) 3. Use iptables to forward ports 4. Front Tomcat with something that can more easily bind to port 80 (httpd, etc.) But to answer your question: yes, running on port 80 will preclude your users from having to specify the port number in the URL. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAknfgW4ACgkQ9CaO5/Lv0PAE9QCdHBcwNoRMneWvLB8uYbA9r+Jd X1sAni8Jkkzg6dXmxcdaa00QweaemJrS =peWX -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Installing Tomcat
Has anyone figured out whats happening here? On Thu, Apr 9, 2009 at 11:20 AM, Jonathan Mast jhmast.develo...@gmail.comwrote: ok, here is the plain vanilla, immaculate server.xml, straight from a fresh untarring of the tomcat 6 dist that i just re-installed, its still not working. thanks On Wed, Apr 8, 2009 at 6:28 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jonathan, On 4/8/2009 1:29 PM, Jonathan Mast wrote: Furthermore, I can tell you that netstat -a indicated no listener for port 8080 and that that Catalina logs look ok. Seriously. Post. Your. Server. Dot. XML. File. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkndJQ8ACgkQ9CaO5/Lv0PC0dgCgmuaMEPpIUteUHtg8z0OUXLRV Y/UAoJeoGgajogSBhVoW01Rqwh1dS+up =xuuf -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Installing Tomcat
ok, here is the plain vanilla, immaculate server.xml, straight from a fresh untarring of the tomcat 6 dist that i just re-installed, its still not working. thanks On Wed, Apr 8, 2009 at 6:28 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jonathan, On 4/8/2009 1:29 PM, Jonathan Mast wrote: Furthermore, I can tell you that netstat -a indicated no listener for port 8080 and that that Catalina logs look ok. Seriously. Post. Your. Server. Dot. XML. File. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkndJQ8ACgkQ9CaO5/Lv0PC0dgCgmuaMEPpIUteUHtg8z0OUXLRV Y/UAoJeoGgajogSBhVoW01Rqwh1dS+up =xuuf -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org ?xml version='1.0' encoding='utf-8'? !-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -- !-- Note: A Server is not itself a Container, so you may not define subcomponents such as Valves at this level. Documentation at /docs/config/server.html -- Server port=8005 shutdown=SHUTDOWN !--APR library loader. Documentation at /docs/apr.html -- Listener className=org.apache.catalina.core.AprLifecycleListener SSLEngine=on / !--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -- Listener className=org.apache.catalina.core.JasperListener / !-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -- Listener className=org.apache.catalina.mbeans.ServerLifecycleListener / Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener / !-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html -- GlobalNamingResources !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / /GlobalNamingResources !-- A Service is a collection of one or more Connectors that share a single Container Note: A Service is not itself a Container, so you may not define subcomponents such as Valves at this level. Documentation at /docs/config/service.html -- Service name=Catalina !--The connectors can use a shared executor, you can define one or more named thread pools-- !-- Executor name=tomcatThreadPool namePrefix=catalina-exec- maxThreads=150 minSpareThreads=4/ -- !-- A Connector represents an endpoint by which requests are received and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html (blocking non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL HTTP/1.1 Connector on port 8080 -- Connector port=8080 protocol=HTTP/1.1 connectionTimeout=2 redirectPort=8443 / !-- A Connector using the shared thread pool-- !-- Connector executor=tomcatThreadPool port=8080 protocol=HTTP/1.1 connectionTimeout=2 redirectPort=8443 / -- !-- Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the JSSE configuration, when using APR, the connector should be using the OpenSSL style configuration described in the APR documentation -- !-- Connector port=8443 protocol=HTTP/1.1 SSLEnabled=true maxThreads=150 scheme=https secure=true clientAuth=false sslProtocol=TLS / -- !-- Define an AJP 1.3 Connector on port 8009 -- Connector port=8009 protocol=AJP/1.3 redirectPort=8443 / !-- An Engine represents the entry point (within Catalina) that processes every
Installing Tomcat
I'm trying to get Tomcat 6 running on a RedHat box. I don't want to build deamon with jsvc as the docs say I should do, at least not yet. Is this the extent of the official documentation for setting up Tomcat on Linux? I installed JDK 6 and Tomcat 6, defined JAVA_HOME and TOMCAT_HOME and setup have a Host and Context in server.xml for www.mysite.com. I invoke catalina.sh start and get a process running, but I can't reach mysite. I should say that apache httpd 2.0 is already running on this machine and my www.mysite.com is reachable there, so I figured www.mysite.com:8080 would take me to tomcat. Is that a correct assumption? IE. Should I be able to by httpd by tacking :8080 onto the url? If I kill apache httpd (I have no intention of using it going forward), will updating server.xml with port 80 rather than port 8080 automagically get everything to work, or is there other stuff I need to do before Tomcat will run as a standalone webserver? thanks,
Re: Installing Tomcat
Is this: http://tomcat.apache.org/tomcat-6.0-doc/setup.html the extent of the setup docs? I'm reaching it by editing the hosts file on my windoze machine to resolve all www.mysite.com requests back to an internal ip which is the machine in question. Tomcat is running as root or at least thats what ps auxf indicates. I rolled back to the original server.xml, restarted Tomcat and I'm still getting a Failed to Establish Connection Error in my browser for www.mysite.com:8080. But www.mysite.com is working. Furthermore, I can tell you that netstat -a indicated no listener for port 8080 and that that Catalina logs look ok. thanks, On Wed, Apr 8, 2009 at 12:24 PM, Peter Crowther peter.crowt...@melandra.com wrote: From: Jonathan Mast [mailto:jhmast.develo...@gmail.com] I'm trying to get Tomcat 6 running on a RedHat box. I don't want to build deamon with jsvc as the docs say I should do, at least not yet. Is this the extent of the official documentation for setting up Tomcat on Linux? You don't say what this is, so we can't help you. I installed JDK 6 and Tomcat 6, defined JAVA_HOME and TOMCAT_HOME and setup have a Host and Context in server.xml for www.mysite.com. I invoke catalina.sh start and get a process running, but I can't reach mysite. *Exactly* how are you trying to reach it? From what computer, and what are you trying as the address? If it's www.mysite.com, have you changed your hosts file or DNS so that it points to your computer rather than off into the Internet? What happens if you browse to http://localhost:8080? I should say that apache httpd 2.0 is already running on this machine and my www.mysite.com is reachable there, so I figured www.mysite.com:8080 would take me to tomcat. Is that a correct assumption? IE. Should I be able to by httpd by tacking :8080 onto the url? If you still have a default server.xml, this should work. However, you've changed your server.xml. You haven't bothered to post your new one, so we can't tell whether this would work or not. If I kill apache httpd (I have no intention of using it going forward), will updating server.xml with port 80 rather than port 8080 automagically get everything to work, or is there other stuff I need to do before Tomcat will run as a standalone webserver? With the default server.xml, simply changing 8080 to 80 (and ensuring the process at least starts as root, which is why jsvc is so important) will be all you need to do. With your server.xml? Nobody on the list will have any idea. Give us some more information, please - we're not psychic! - Peter - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RemoteAddrValve syntax
How do I specify wildcards in the RemoteAddrValue declaration? The Tomcat docs says it uses the java.util.regex package, so i wrote a test case like this: String patternStr = 192.168.*.*; String searchStr = 192.168.1.2; Pattern p = Pattern.compile(patternStr); Matcher m = p.matcher(searchStr); System.out.println(Does + patternStr); System.out.println(Match + searchStr); boolean b = m.matches(); System.out.println(Result: + b); Which returns true, however when I placed patternStr into my server.xml file (following the conventions in the Tomcat docs of escaping the . with \ ): Valve className=org.apache.catalina.valves.RemoteAddrValve allow=192\.168\.*\.*/ It didn't match, ie. I couldn't get in. I hard coded my current ip into the above value and it worked, but I need to match any 192.168.*.* address. How do specify this in server.xml? Thanks Setup: Java 1.4.2 Tomcat 5.5
Re: RemoteAddrValve syntax
I looked at the javadocs for the RemoteAddrValve and they provided no further clarity on the syntax issue. You're right, my test case mistakenly returned a false positive, .* could match anything its true and their is no common sense wildcard in the Java Regex package. I looked at the javadoc for the regex package and found it a little too pedantic. I thought javadocs were supposed to be human-readable ;-) thanks for the help On Sun, Apr 5, 2009 at 2:41 PM, André Warnier a...@ice-sa.com wrote: André Warnier wrote: [...] To match any address starting with 192.168., use Valve className=org.apache.catalina.valves.RemoteAddrValve allow=192\.168\..*/ or (if you want to be really finicky about it) Valve className=org.apache.catalina.valves.RemoteAddrValve allow=192\.168\.\d{1,3}\.\d{1,3}/ What is not very clear in the on-line Tomcat documentation, is whether a remote client address of 192.168.1.2 would be translated to the string 192.168.1.2 by Tomcat prior to matching in the Valve, or to for example 192.168.001.002. Maybe the Valve source code is clearer ? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
HELP!!! cannot reach my site!
I restarted tomcat after making some changes and now I my main webpage is down. The www.mysite.com returns a blank page. I didn't touch the code-base of the main website before the restart, that service, which is on a different host (foo.mysite.com) works fine. Looking at apache and tomcats logs, i'm getting status code 200 when i request my homepage, but 0 length content. It like Tomcat won't write to replies. Graphics (which are handled by Apache) are showing 0 content length. All the other hosts on my site are working. What gives? Apache 1.3 Tomcat 5.5 Java 1.4.2
Re: HELP!!! cannot reach my site!
Well the I figured it out. I forgot that I had updated (yesterday) the codebase on www.mysite.com to use jsp-api.jar and servlet-api.jar., but hadn't restarted Tomcat at that time. Previously it was using servlet.jar. After I deleted jsp-api.jar and servlet-api.jar and placed servlet.jar back in it worked. This is a JDK 1.4 issue. I'm absolutely furious that Tomcat did not say (almost) anything in its logs. I'll get back to the almost part tommorrow. Now thats its fixed I'm gonna try to relax, probably with the help of some tennessee whiskey ;-) thanks for replying on a weekend On Sun, Mar 29, 2009 at 7:49 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: yassine.elas...@gmail.com [mailto:yassine.elas...@gmail.com] On Behalf Of Yassine Subject: Re: HELP!!! cannot reach my site! Looking at apache and tomcats logs, i'm getting status code 200 when i request my homepage, but 0 length content. It like Tomcat won't write to replies. what does tomcat's logs says? Probably nothing. I've had this situation happen when I disabled both autoDeploy and deployOnStartup in the Host element; at that point there are no webapps available, and no means of deploying any (at least, none that I've found). - 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: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: FW: very off topic marketing question
I would argue that, architecturally, this kind of work doesn't belong in the request processing portion of the application. I generally do this kind of thing with cron jobs. Otherwise, you can have HTTP requests kicking-off lots of long-running processes. That may be possible in Java, but I'm not sure it's always advisable. True, in general, but not just any HTTP request can spawn this thread. The component is invoked via a GUI that is secured, so only someone with the appropriate credentials can start the blast. Furthermore the component has additional sanity-checks just in case someone tries spawning multiple threads (which would break the constraint on per second requests). Also the processing this thread does is episodic, not regular, so if I couldn't invoke it via the management GUI, then i'd have to log into the server and execute a bash scriptor some other one-off kludge thats slap-dash and hard to maintain :-( On Tue, Mar 24, 2009 at 11:25 AM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jonathan, On 3/20/2009 7:53 PM, Jonathan Mast wrote: Meh. Most Java webapps aren't multithreaded anyway in the sense that each request lives in its own little world and usually runs start to finish with no other threading involved. Just this week I added threading to a component of my web-app. I had some what dreaded it, but found that it took me only a half-hour and about 10 extra lines of code, here's a synopsis: Thread t = new Thread(new Runnable() { public void run() { ...blast() } }, Blast Thread); t.start(); Where blast() iterates thru several thousand records, which are sent to a third-party site for processing. The third-party site allows no more than 5 connections per second, so I just call Thread.sleep(1000) on every 5th record. It is very simple, very elegant and very fast now that some much load has been moved off the main http thread. I would argue that, architecturally, this kind of work doesn't belong in the request processing portion of the application. I generally do this kind of thing with cron jobs. Otherwise, you can have HTTP requests kicking-off lots of long-running processes. That may be possible in Java, but I'm not sure it's always advisable. On the other hand, a background thread (in the same JVM) that serially processes some jobs scheduled by request processors (say, like sending an email message) is often a good idea. Just as long as you don't run new Thread().start() during request handling, which is a bit scary. My question is: how would this be accomplished in PHP? Would I need to recompile the whole php server with a special thread package or what? I have no idea. I wasn't saying that you can do that in PHP (or, at least, you can't fire-off background threads during request processing)... I was saying that you shouldn't do that in /any/ language, so the fact that PHP can't do it isn't really that relevant. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAknI+3sACgkQ9CaO5/Lv0PD+nwCgsCnQrQmKxAZQEN3wVap5Knxz zr0AoLKsUjDYMvCWQMxRb2Pe8ib/r88L =O3Ls -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Upgrading to Java 1.5
Yeah I executed the jdk_1.5.bin file from Sun. Didn't change anything else and restarted tomcat. Its up and running but I haven't had time to double check that it is still running with v1.4 JVM (which it should, because I haven't changed anything else). I'm running Slackware Linux. So am I now like Frodo in Lord of the Rings? About to be dissolved by the evil Chuck-spider's venom? ;-) On Tue, Mar 24, 2009 at 5:30 AM, André Warnier a...@ice-sa.com wrote: Caldarale, Charles R wrote: From: Jonathan Mast [mailto:jhmast.develo...@gmail.com] Subject: Re: Upgrading to Java 1.5 Will the java 1.5 installer do anything under-the-hood that could prevent the v1.4.2 JDK from working? I suppose that depends on the installer being used. I've certainly had multiple functional levels of a JDK installed simultaneously on both Linux and Windows, so there's nothing intrinsically wrong with doing that. To the OP : careful now. Chuck is sitting there like a spider, baiting you, and getting ready to jump on you the minute your next post indicates that you are under Linux and installing your java package with the standard platform installer ... ;-) Well, are you ? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Upgrading to Java 1.5
I'm working in a Java 1.4.2, Apache 1.3.33, Tomcat 5.5, Linux environment. I want to migrate to Java 1.5. Is it possible to do this vis-a-vis Tomcat by just altering what the /usr/local/java link points to? Or will I need to do more under-the-hood changes?
Re: Upgrading to Java 1.5
Thanks Chuck, one more thing. I know this is very basic, but let me ask: Will the java 1.5 installer do anything under-the-hood that could prevent the v1.4.2 JDK from working? I plan doing a lot of back and forth testing between the JDKs so they must both able to run. On Mon, Mar 23, 2009 at 2:34 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Jonathan Mast [mailto:jhmast.develo...@gmail.com] Subject: Upgrading to Java 1.5 I want to migrate to Java 1.5. Is it possible to do this vis-a-vis Tomcat by just altering what the /usr/local/java link points to? You'll also need to remove the compatibility package that you installed in order to run Tomcat 5.5 with the 1.4 JRE. The compatibility package consists of: bin/jmx.jar common/endorsed/xercesImpl.jar common/endorsed/xml-apis.jar Leaving them around can cause classloading problems under a 1.5 JRE. - 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: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] of very off topic marketing question
OK, so what would it look like? Show me a comparable snippet of PHP code. How does one enable this feature if its off by default? Why is it off by default? I guessing it opens up security issues and/or has side effects. Not conducive to enterprise-level computing, imho. What is PEAR? Is that like the standard JavaSE library? The last time I was on php.net it seemed to be something that must be downloaded separately from the php server. relies on OS abilities. Does this mean my PHP code would have to tailored to Windows, MacOSX, or Linux? Please clarify. On Sat, Mar 21, 2009 at 7:50 AM, Joseph Millet joseph.mil...@gmail.comwrote: [...] Where blast() iterates thru several thousand records, which are sent to a third-party site for processing. The third-party site allows no more than 5 connections per second, so I just call Thread.sleep(1000) on every 5th record. It is very simple, very elegant and very fast now that some much load has been moved off the main http thread. My question is: how would this be accomplished in PHP? Would I need to recompile the whole php server with a special thread package or what? One would use PHP PCNTL functions such as C-like fork(), it comes with any PHP but is not active by default and you'd find some wrapper libraries such as PEAR's PHP_FORK in order to help have a higher level of abstraction, so that you'd may write it just pretty much the same as you did in java. Of course this relies on OS abilities. On Sat, Mar 21, 2009 at 12:02 PM, André Warnier a...@ice-sa.com wrote: Peter Crowther wrote: [...] I'm also particularly amused by the topmost set of bars in figure 2, given how proud the perl-ites are of their RE library and performance ;-). You didn't expect for a minute that this would remain unanswered, did you ? First, the perl-ites would answer that the comparison being with PHP, it is of little relevance. Everyone knows that PHP is for the script-kiddies, while Real Programmers use perl. Second, they would tell you that in the same memory space used by one Tomcat and one Java servlet, they could run 10 parallel Apache servers with mod_perl to do the same thing, and still have a couple of them spare to serve the static content and collect the data to display those tables in real-time. Finally, they would tell you that while Tomcat is still warming up in order to run the comparison, they themselves are waiting for you at the bar, and are already pretty warmed up themselves. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: FW: very off topic marketing question
Meh. Most Java webapps aren't multithreaded anyway in the sense that each request lives in its own little world and usually runs start to finish with no other threading involved. Just this week I added threading to a component of my web-app. I had some what dreaded it, but found that it took me only a half-hour and about 10 extra lines of code, here's a synopsis: Thread t = new Thread(new Runnable() { public void run() { ...blast() } }, Blast Thread); t.start(); Where blast() iterates thru several thousand records, which are sent to a third-party site for processing. The third-party site allows no more than 5 connections per second, so I just call Thread.sleep(1000) on every 5th record. It is very simple, very elegant and very fast now that some much load has been moved off the main http thread. My question is: how would this be accomplished in PHP? Would I need to recompile the whole php server with a special thread package or what? On Fri, Mar 20, 2009 at 4:50 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ilya, Don't get me wrong... I loves me some Java. But... On 3/20/2009 11:55 AM, Ilya Kazakevich wrote: If you are going to move to php, be ready to: 1) loose tools like log4j. log4p? 2) meet API, 10% of which uses OOP and exceptions, and 90% is procedure / errors based. This does really suck. It's going back and using C when you've become sooo used to exceptions. 3) you would not have namespaces. Meh. I suppose on a large (huge?) project this could be a problem. You can always namespace your files by using subdirectories. Oh, wait. You weren't suggesting that you use objects in PHP were you? Ha ha ha ha. Oh, maybe you were. Sorry. 4) because of dynamic typization, you would be able to find some types of errors only in runtime. Java is not safe from runtime errors; they're just (mostly) not the kinds of errors that can be prevented using static type-checking. I've come-around on this one: static typing is just one way of doing things. Ruby's mix-ins are very attractive for those of us who have had trouble breaking-into a class hierarchy. :) 5) no multithreading Meh. Most Java webapps aren't multithreaded anyway in the sense that each request lives in its own little world and usually runs start to finish with no other threading involved. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAknEAZ0ACgkQ9CaO5/Lv0PA66ACfYgElGkBrKzxS2Lp9ABhW9ZZU UDgAn0eFpdBXzUCcda4G2LOE5733XSgL =X7eW -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Access log behavior
We're using the AccessLogValve extensively and I'm wondering if anyone can tell me what happens when an active (ie. today's) access log file is deleted? Will Tomcat handle this gracefully or go bonkers? I occasionally delete some log files that are active but are unimportant, when that happens i restart Tomcat just to be safe but I'd rather not have to do this. My setup is: Linux Java 1.4.2 Tomcat 5.5.17
[OT] Using jsp/serlvets to track clicking
[Sorry for this non-Tomcat specific question, but Sun Forums didn't help me much with this one] I would like to know how to imitate the click of link in JSP or serlvet, in order to track clicks. I have pages with links containing tel protocol URIs like this: Click a href=tel:55here/a to listen! I want to replace the above with something like this: Click a href=call_tracking.jsp?pn=55here/a to listen! And have call_tracking.jsp do its tracking stuff and then spawn a phone call, just like the first example does. I do not want to bother the user with another page, hence the need to accomplish the click action programmatically. I presume this feat is achievable via Response header magic, I just don't know the right incantation ;-) I should add that this is not necessarily a TEL-specific question, I am looking for a generic, protocol-independent mechanism for mimicking a click. Thanks
Why is my page repeatedly invoking itself?
Here's my setup: Java 1.4.2 Tomcat 5.5.17 Windows XP I'm developing in NetBeans 6.5 (which is invoking Tomcat) The page just reads from a database and stuffs the results into a table. I noticed that the page was taking forever to load, so i placed logging statements in it, at the beginning of the page (before the db is accessed) and in the middle (where the results are unrolled into a table). Upon looking at the log file i could see that the page was being invoked hundreds of times. There is no pattern discernible from the log file, the entries are mostly like this: begin page print row print row print row print row begin page print row print row begin page and so on, no real pattern. Despite being invoked (or whatever) hundreds of time, the page looks alright once it finally finishes, which i find rather strange. I've done many pages like this, some of are much more complex and they all work fine. And I know its not a problem with the DB api, i created a test page that calls the exact same method, unrolls the returned array and does a println for each item, and it works fine. any help would be appreciated
Re: Inner class trouble in JSP
I can't help with the inner class issue other than to say that perhaps you should move away from using inner classes in JSP totally. I don't understand how you are using these inner classes, could you please explain? On Sat, Jan 24, 2009 at 1:32 PM, Qiao Jin bra...@gmail.com wrote: I am using Tomcat 6.0.18 with JDK 1.5.0_17 on CentOS 5. I am getting a compiling error on the following code in a jsp page that uses an inner class. I remember I used to be able to do this with a different container (implementing JSP 1.2 and JDK 1.4). %! private class Test { String name = null; public Test(String n) { this.name = n; } String getName() { return this.name; } } static Test test = new Test(foobar); % %= test.getName() % With Tomcat, I am getting the following error: org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 15 in the jsp file: /test.jsp No enclosing instance of type test_jsp is accessible. Must qualify the allocation with an enclosing instance of type test_jsp (e.g. x.new A() where x is an instance of test_jsp). 12: } 13: } 14: 15: static Test test = new Test(foobar); 16: % 17: 18: %= test.getName() % Changing the code as following worked: static Test test = new test_jsp().new Test(foobar); My questions: I suppose this is a change from jdk 1.4 to 1.5? Doesn't this make the JSP page container dependent? I think that the naming convention of a JSP page's class is implementation specific. Having an inner class in a JSP page sometimes is pretty convenient for organizing some light data used in the page, such as menu text. Is there another alternative other than having a regular class? Any input would be appreciated. Thanks. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: GenericType error?
You were right, the copy of blah.jsp on production server had been corrupted by SVN (there was a conflict when I checked blah out). It wasn't a Tomcat issue at all. I only thing is that the corruption (actually SVN's DIFF notation) was nowhere near line 28, it was further down in the file. Perhaps Tomcat could have been helpful in indicating this. Thanks On Thu, Jan 22, 2009 at 5:05 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Jonathan Mast [mailto:jhmast.develo...@gmail.com] Subject: Re: GenericType error? Well I do need to get my wisdom teeth removed ;) I did that 35 years ago; nothing to look forward to, other than to get it over with. I don't see how this is relevant though. It was relevant (before you provided additional information), since some language constructs are only available in 1.5 or 1.6 JREs. The fact that it works on an exact clone of the production box seems to me to point to corruption in the Tomcat distribution Which says the clone isn't quite exact. Are you by any chance accidentally using gcj on the failing system? (temp/ or work/ dirs maybe?). You can always clean out those directories completely and see if it has an effect. This project works on my Windows machine ( I run it inside of Netbeans). What happens if you run Tomcat directly on the Windows box, not from NetBeans? Btw, other aspects of the project are working correctly, just blah.jsp seems to be the problem. Can you post at least the part of blah.jsp around line 28, if not all of it? What happens if you try to pre-compile blah.jsp? http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html#Web%20Application%20Compilation - 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: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Java Crash
that is almost certainly an Apple Java issue. If by charting, you mean graphics, then even more so. The Java2D api on Mac still has bugs that will crash. But you can't be certain unless you test ur webapp on a windows machine. On Fri, Jan 23, 2009 at 11:03 AM, Stephen Caine step...@commongrnd.comwrote: All, Whenever I attempt to access a charting jsp, I get an invalid memory access error and the JVM just crashes. Here are the relevant portions of the java crash log. Any thoughts would be appreciated. Is this an Apple Java issue?? Stephen Caine CommonGround Softworks, Inc. ___ Process: java [67620] Path: /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java Identifier: java Version: ??? (???) Code Type: X86-64 (Native) Parent Process: launchd [1] Date/Time: 2009-01-21 14:53:08.281 -0500 OS Version: Mac OS X Server 10.5.5 (9F33) Report Version: 6 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0001b6f272f8 Crashed Thread: 28 Application Specific Information: Java information: Exception type: Bus Error (0xa) at pc=0x0001010a633d Java VM: Java HotSpot(TM) 64-Bit Server VM (1.6.0_07-b06-57 mixed mode macosx-amd64) Heap PSYoungGen total 690496K, used 680383K [0x00018a56, 0x0001b500, 0x0001b500) eden space 684160K, 98% used [0x00018a56,0x0001b37a0de0,0x0001b418) from space 6336K, 99% used [0x0001b418,0x0001b47aeeb0,0x0001b47b) to space 8384K, 0% used [0x0001b47d,0x0001b47d,0x0001b500) PSOldGentotal 1398144K, used 1296068K [0x00013500, 0x00018a56, 0x00018a56) object space 1398144K, 92% used [0x00013500,0x0001841b11d0,0x00018a56) PSPermGen total 437248K, used 431571K [0x00010500, 0x00011fb0, 0x00013500) object space 437248K, 98% used [0x00010500,0x00011f574c70,0x00011fb0) Virtual Machine Arguments: JVM Args: -Xserver -Xms2048m -Xmx2048m -XX:+MaxFDLimit -XX:MaxPermSize=768m -XX:+UseParallelGC -Djava.awt.headless=true -Djava.endorsed.dirs=/Applications/Qilan 3/Tomcat_Qilan//common/endorsed -Dcatalina.base=/Applications/Qilan 3/Tomcat_Qilan/ -Dcatalina.home=/Applications/Qilan 3/Tomcat_Qilan/ -Djava.io.tmpdir=/Applications/Qilan 3/Tomcat_Qilan//temp Java Command: org.apache.catalina.startup.Bootstrap start Launcher Type: SUN_STANDARD Physical Memory: Page Size = 4k, Total = 2048M, Free = 1811M - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: PostgreSQL vs MySQL with Tomcat
Perhaps I should explain more about how my rewrite sans JOINs works: The reports read from a log table with this schema: PK | ref_PK1 | ref_PK2 | ref_PK3 | start_time | stop_time Where ref_PK# is the primary key of another table. These 3 other tables are very shallow (row count 100). The log table is very deep (row count 100,000). The web app, when started, reads the 3 shallow tables into memory (3 hash maps). (And btw: the database code is NOT intertwined with the Serlvet code, thank you very much :) To run a report: the user enters the start and stop times, along with some other options. The report sends the options to db accessor class which runs a query that only references the log table. The results (an array of Log objects) are rendered as an HTML table (it also does Excel). The ref_PK# values are matched against their respective hashmaps to produce human readable data. This approach proved much faster than using the JOINs. I'm not saying that there is no place for using JOINs, just that you need to think about where to place the processing load. Our database is very busy with writes, all of which have priority over reads, hence the desire to move as much load off of it as possible. Furthermore, the data in 3 shallow tables doesn't change once inserted. But in other projects where I employ caching, the caches Timeout after certain periods of time. Also these other caches load incremently (as needed) instead of preloading, which is what the report app does. Finally, I am very busy with other responisibilites at my job, and do not have time to dig into heiroglyphics of database optimization which is very vender specific and as such further binds your organization to that vendor. thanks On Fri, Jan 23, 2009 at 12:52 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chris, Chris Wareham wrote: By the way, if it's not static data your caching, how's your messaging system? Without one how are you going to maintain the integrity of your caches? Even with one, can you tolerate a race condition between the data being modified in the database and the notifications causing all your caches to be updated? Er... write-through cache? Presumably, Leon is talking about a one-box wonder. Before everyone starts yelling about how stupid everyone else's ideas are, maybe we should just let this one go in the interests of civility. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkl6A+UACgkQ9CaO5/Lv0PCWdACdH0d9og7mrxwSzfZyn5hmzzo+ 9AsAoKmNOfAlMiX6jkRcbUof72goMM9T =nOJX -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
GenericType error?
I have a webapp that is giving me this error: description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 28 in the jsp file: /blah.jsp Generated servlet error: Syntax error on tokens, GenericType expected instead An error occurred at line: 28 in the jsp file: /blah.jsp Generated servlet error: Syntax error on token ., ; expected An error occurred at line: 28 in the jsp file: /blah.jsp Generated servlet error: Syntax error on tokens, Expression expected instead An error occurred at line: 28 in the jsp file: /blah.jsp Generated servlet error: Syntax error on tokens, delete these tokens org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375) 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) . and so on Line 28 happens to correspond to the beginning of the Scriptlet expression in blah.jsp This project works on my Windows machine ( I run it inside of Netbeans). It also works on a clone of the production machine. What is causing this error? Thanks
Re: GenericType error?
Sorry: OS: linux JVM: 1.4.2 Tomcat: 5.5.17 On Thu, Jan 22, 2009 at 4:03 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Jonathan Mast [mailto:jhmast.develo...@gmail.com] Subject: GenericType error? What is causing this error? It's caused by not telling us anything about the Tomcat version or the JVM you're using, and precious little about the platforms you're running on. - 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: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: PostgreSQL vs MySQL with Tomcat
Perhaps the discussion should move back towards how Tomcat interacts with databases. This thread seems to be damning MySQL for not having super advanced features, some of which should perhaps not even be in the purview of the database layer, but more appropriately belong at the application layer (ie. Tomcat). For example, I rewrote a report generator for my company. The existing generator, a PHP + MySQL setup, was insanely slow and difficult to maintain being that it consisted of 1 php page containing hundreds of lines of code. I rewrote it in jsp + POJO and the new version runs much faster, because it doesn't have a single query with a JOIN clause in it. The old generator had super complex queries that took forever to run and placed an enormous amount of load on the database server. I achieved that same result of a JOIN by pushing that functionality up to the Java layer. Sure we can argue about which DBMS has the fastest JOINs but nonetheless it remains that JOIN queries will always be computationally expensive compared to single table queries. Well thats my 2 cents :) On Thu, Jan 22, 2009 at 7:39 AM, Jim Cox shakahsha...@gmail.com wrote: When creating tables with referential integrity in MySQL you still get gems like, e.g.: mysql create table jimtest ( colA varchar(32) NOT NULL, CONSTRAINT fk1 FOREIGN KEY(colA) REFERENCES jimtest2(colA) ON DELETE CASCADE ); ERROR 1005 (HY000): Can't create table './test/jimtest.frm' (errno: 150) Same indecipherable error for non-existent referenced table, or column type mismatch, or a missing index. Admittedly, you learn what to look for after a while, but the error message sucks. On Wed, Jan 21, 2009 at 11:06 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rusty, Rusty Wright wrote: I think the biggest gripe I've had with mysql is the problem where I was violating a unique constraint and it was giving me some generic (completely useless) error; HY001 I think. I've always found the error messages themselves very informative. For instance, if I attempt to insert a record into a table with an FK that doesn't match, MySQL's command-line interface gives me this message: ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`database/target_table`, CONSTRAINT `name_of_foreign_key_constraint` FOREIGN KEY (`column_name`) REFERENCES `source_table` (`column_name`)) Perhaps Connector/J doesn't give quite such useful error messages, but I seem to recall something nice like Foreign key constraint check failed. I have found that every database has stupid error codes and you basically have to code your app around tables of db-specific error codes if you want to give your users (or log files) anything better than the driver-supplied error messages. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkl38NUACgkQ9CaO5/Lv0PCwAgCggKgAfu/ZZ+ClRAGtEuM4+xyK e7EAn0R/4fyPgBfhxSB51um5ZW63jZzL =xo6L -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: GenericType error?
Well I do need to get my wisdom teeth removed ;) Linux: Slackware 10.2.0 Tomcat: as downloaded from tomcat.apache.org Windows: XP service pack 2, Netbeans 6.5, Tomcat 5.5, the project has its Source code and JVM level set to 1.4.2, which is installed along with 1.5, and 1.6. I don't see how this is relevant though. This project been developed in on this machine since day 1. The fact that it works on an exact clone of the production box seems to me to point to corruption in the Tomcat distribution (temp/ or work/ dirs maybe?). Furthermore here is the deployment sequence (again this has been standard procedure for months now): kill httpd and tomcat wait until all its thread have died rm -r apache/htdocs/blah rm -r tomcat/work/Catalina/www.mysite.com/blah/ build blah restart httpd + tomcat Btw, other aspects of the project are working correctly, just blah.jsp seems to be the problem. Another thing: 2 contexts are pointing to blah, again nothing new here. (and i'm deleting the work/ dir for both) Thanks for enduring On Thu, Jan 22, 2009 at 4:15 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Jonathan Mast [mailto:jhmast.develo...@gmail.com] Subject: Re: GenericType error? Sorry: OS: linux JVM: 1.4.2 Tomcat: 5.5.17 (This is like pulling teeth.) Which Linux? Is it a real Tomcat, or a 3rd-party repackaged one? Which Windows is the compilation working on? Which Tomcat and JVM is installed on the Windows box? - 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: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: PostgreSQL vs MySQL with Tomcat
Our organization has products backed by both databases and we are almost entirely shielded from the database details in Tomcat. I don't really see how it should matter in terms of Tomcat (or any Web container). I'm thinking this is more a Java issue than a Tomcat issue. The main differences we've encountered is that the MySQL implementation of JDBC requires some extra parameters to be passed along when connections are made, otherwise the ResultSet will fail on particular conditions. But this is an database layer issue, and the db layer exists independently of the web apps. Our observation of the MySQL vs Postgre debate is this: (btw we use versions 5.0 and 8.1 respectively) * Postgre has more features (sequences and triggers) but also an enormous amount of complexity * MySQL has much finer authorization control, but lacks some of the big-boy features such as triggers ** of course a lot has changed in the newer versions of both of these DBMS On Thu, Jan 15, 2009 at 5:20 PM, Ken Bowen kbo...@als.com wrote: Hi all (especially Chris -- very informative long post today on Tomcat/MySQL): For a several reasons (including the apparent infinite default for connection timeout), I'm contemplating switching one or two projects from MySQL to PostgreSQL. I'd like to gather opinions on the tradeoffs, including: Unfortunately, MySQL isn't really that tunable. On the other hand, MySQL requires very little in the way of tuning! I created a couple of proof-of-concept projects with PostgreSQL for someone about six months ago, and the only really puzzling thing what how to set up sequences corresponding to MySQL's AUTOINCREMENT (I'm not sure I've really wrapped head around it completely anyway). For those small projects, it worked well, but there was no stress involved. I'd like to hear about people's experiences and what they think are the strengths and weaknesses of each DBMS for use behind Tomcat. Thanks much in advance, Ken Bowen - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Can Tomcat be used to host socket servers?
Is it possible to use Tomcat to host socket servers? Or is Tomcat a strictly 1 port operation? thanks
Re: Can Tomcat be used to host socket servers?
Well what I want is to have a dedicated port for a socket, I just want all the application infrastructure to be handled by Tomcat rather than a writing a custom solution. Not sure if dynamically rewriting server.xml is the way to go. My guess would by a Valve/Connector type thing, but I'm just not that familiar with Tomcat. I can't be only one who has had this issue. The situation is that we have some existing programs (written in C) that are socket servers. I want to redo them in Java, and having Tomcat host them would be great because I could focus solely on the parts of the program than do request processing and leave the housekeeping to Tomcat. In other words, I want to write servlets that are faux-sockets. On Wed, Jan 14, 2009 at 10:33 AM, Martin Gainty mgai...@hotmail.com wrote: In other words instead of committing to single port request TC use a port range for connector? You might be able to accomplish the task by developing an algorithm which rewrites server.xml with 'unused port' Not sure if this has been accomplished ? Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Date: Wed, 14 Jan 2009 09:20:27 -0500 From: jhmast.develo...@gmail.com To: users@tomcat.apache.org Subject: Can Tomcat be used to host socket servers? Is it possible to use Tomcat to host socket servers? Or is Tomcat a strictly 1 port operation? thanks _ Windows Live™: Keep your life in sync. http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009
Re: Can Tomcat be used to host socket servers?
Thanks for cogent reply, Chuck :) By socket servers, I mean the existing programs are bound to a particular port number and just sit there waiting for requests. The port numbers are arbitrary, and I'm not knowledgeable enough of networking to know whether they use HTTP or not. I'll probably just write stand alone Java sockets servers and simply bounce incoming requests over to a servlet I'll develop to do the heavy liffting. The reason I would have liked Tomcat to handle the whole shebang is that now I'll have to adjust each system that hosts these sockets to automatically invoke them when they restart. Kinda tedious. Thanks again On Wed, Jan 14, 2009 at 4:35 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Jonathan Mast [mailto:jhmast.develo...@gmail.com] Subject: Re: Can Tomcat be used to host socket servers? Not sure if dynamically rewriting server.xml is the way to go. Pretty much guaranteed not to be, since that would require stopping and restarting Tomcat. The situation is that we have some existing programs (written in C) that are socket servers. It's not clear to me exactly what you mean by are socket servers. Do you mean they simply do a listen/accept on a server socket, waiting for connection requests from some client? If so, what protocol is being used? If it's not HTTP (or AJP), Tomcat won't help you. Handling server sockets in Java borders on the trivial; using Tomcat just for that would be massive overkill. - 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: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
replacement for useBean directive
OK I know this isn't Tomcat-specific, but my post on Sun Forums didn't get much of a reply, so I thought I'd try it here. I'm in the process of translating a series of JSPs into straightout servlets and I have a question about how I should replicate the functionality of the useBean directive in my Servlet. I have a set of Beans that mediate between the JSP and a database (actually btwn JSP and a class that accesses the db). These beans cache results from the database, cutting back on back and forth traffic. They timeout after varying periods of time, flush their memory (hashmaps) and then reload as needed. I've used the useBean directive with no problem, it's just that now the project has grown in complexity to where it needs to be re-written as a set Servlets. My solution for replacing the useBean functionality has been a BeanBag class with the following form: class BeanBag { private static AppleBean appleBean = null; private static BananaBean bananaBean = null; public static AppleBean getAppleBean() { if (appleBean == null) { appleBean = new AppleBean(); } return appleBean; } . and so on } In the Servlet code, I just obtain a bean like this: AppleBean appleBean = BeanBag.getAppleBean(); My question is: where (or if) should I implement the synchronization? The generated servlets that Tomcat creates for the useBean directive uses Synchronized Statements, like this: synchronized (application) { appleBean = (com.fruitsalad.AppleBean) _jspx_page_context.getAttribute(appleBean, PageContext.APPLICATION_SCOPE); if (appleBean == null){ appleBean = new com.fruitsalad.AppleBean(); _jspx_page_context.setAttribute(appleBean, appleBean, PageContext.APPLICATION_SCOPE); } } But wouldn't making the methods in BeanBag synchronized be a better approach? Thanks
Re: replacement for useBean directive
Thanks Chuck, just one more question: do I really need synchronization at all? These Beans basically work like this: getApple(int appleID) { purgeIfTimeout(); //calls appleMap.clear() if we've timed out if (appleMap.containsKey(String.valueOf(appleID)) { return (Apple)appleMap.get(String.valueOf(appleID); } else { Apple a = FruitDB.getApple(appleID); //this is where the database interaction takes place if (a != null) appleMap.put(String.valueOf(appleID), a); return a; } } Is synchronization really called for here, either around the getITEM() methods inside the beans or around the methods in BeanBag that return the bean? On Tue, Jan 6, 2009 at 11:14 AM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Jonathan Mast [mailto:jhmast.develo...@gmail.com] Subject: replacement for useBean directive wouldn't making the methods in BeanBag synchronized be a better approach? Definitely. Centralize the required synchronization rather than burdening each caller with it. - 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: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Can I specify virtual hosts in JKMounts?
I'm using Apache+Tomcat (1.3.33, 5.5.17) and I have servlet named bar, with no file extension in its name. bar is in a folder named foo which is reachable by 2 virtual hosts: www.mysite.com/foo/bar foo.mysite.com/bar I know to how tell apache that request for /bar on the WWW virtual host should be handled by Tomcat: JkMount/foo/*ajp13 Simple enough, but can I also specify foo.mysite.com as well, like this? JkMount foo.mysite.com/* ajp13 I searched around and it none of the documentation seems to explicitly say whether or not virtual hosts can be used in JkMount directives. Thanks
Re: Can I specify virtual hosts in JKMounts?
Thanks for the response, I didn't know JkMount directives could be placed within VirtualHost declarations. Our httpd.conf uses the following: IfModule mod_jk.c JkWorkersFile/usr/local/tomcat/conf/workers.properties JkLogFilelogs/jk.log JkLogLevelerror JkMount/*.jspajp13 JkMount/servlet/*ajp13 /IfModule This is located beneath all our VirtualHost declarations, I presume it must be declared before the virtualhost stuff, in order for the JkMount directive to be recognized, correct? And won't all the VirtualHost decls have to be within the IfModule ... tags? Thanks On Tue, Dec 2, 2008 at 11:45 AM, André Warnier [EMAIL PROTECTED] wrote: Jonathan Mast wrote: I'm using Apache+Tomcat (1.3.33, 5.5.17) and I have servlet named bar, with no file extension in its name. bar is in a folder named foo which is reachable by 2 virtual hosts: www.mysite.com/foo/bar foo.mysite.com/bar I know to how tell apache that request for /bar on the WWW virtual host should be handled by Tomcat: JkMount/foo/*ajp13 Simple enough, but can I also specify foo.mysite.com as well, like this? JkMount foo.mysite.com/* ajp13 (Note that above, you are not just re-directing bar to Tomcat, you are redirecting much more) I'm guessing a number of things here, but you seem to talk about VirtualHosts in Apache, apparently something like this : VirtualHost *:80 ServerName www.mysite.com ... /VirtualHost VirtualHost *:80 ServerName foo.mysite.com ... /VirtualHost So why not then VirtualHost *:80 ServerName www.mysite.com JkMount /foo/bar ajp13 JkMount /foo/bar* ajp13 /VirtualHost VirtualHost *:80 ServerName foo.mysite.com JkMount /bar ajp13 JkMount /bar* ajp13 /VirtualHost If it makes it easier, and at least in Apache 2.x, you can also use sections like Location /foo/bar SetHandler jakarta-servlet ... /Location as a kind of alias for your JkMount directives. This is a bit harder to find in the documentation, but it appears here : http://tomcat.apache.org/connectors-doc/reference/apache.html Using SetHandler and Environment Variables (at the very end) - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do i specify the filename for a binary file generated by a JSP?
I am writing a report generator that has the ability to generate Excel files. The user clicks on a link (exporter.jsp), the page's content-type has been set to application/vnd.ms-excel which naturally prompts the user to either save to a file or open directly in Excel. It works fine, but requires the user to manually rename the generated file from exporter.jsp to whatever.xls. Furthermore, Firefox will not let you rename the file in save dialog box, it just automatically saves the file as exporter.jsp, you must rename it from the file browser. How do specify the output file name from within JSP? Btw, right clicking and selecting save link as allows for specifying the file name, but the file that is created is empty. Thanks
Re: Context level logging
Well I did everything I said I would above and Catalina.out kept on receiving the System errors and the specified file didn't receive anything. So I guess it was a failure. I do believe you can specify in the web app deployment descriptor more detailed logging, but I haven't had time to test it out. Sorry I couldn't help ya out more. Good luck On Mon, Nov 10, 2008 at 10:30 AM, blacksheep [EMAIL PROTECTED] wrote: I wonder you came up with a solution ? Jonathan Mast-2 wrote: OK, i have a webapp which has it's own context element. I want all the System.out and System.err stuff from this webapp to go to it's own special log file as opposed to catalina.out. My reading of the Tomcat docs (version 5.5) seems to indicate that I can do this by following these steps: 1. set the swallowOutput attribute to true in the Context entry in server.xml 2. add the following to the logging.properties file: 6FOOAPP.org.apache.juli.FileHandler 6FOOAPP.org.apache.juli.FileHandler.level = FINE 6FOOAPP.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 6FOOAPP.org.apache.juli.FileHandler.prefix = FOOAPP. org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/FOOAPP].level = FINE org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/FOOAPP].handlers = 6FOOAPP.org.apache.juli.FileHandler 3. restart Tomcat Is this correct? The last 2 lines of the edit I really don't understand. thanks -- View this message in context: http://www.nabble.com/Context-level-logging-tp17630343p20422122.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Are multiple contexts of the same code code base visible to each other?
Suppose I have 1 webapp named code-stuff that sits in my webapps directory. Now lets say i set up 2 subdomains of my website, foo.mysite.comand bar.mysite.com and each have an context that points to code-stuff. Will code in these two contexts be visible to each other? I know Tomcat copies to its work/ directory to 2 copies of code-stuff, but I want to know whether in memory, Tomcat has 2 separate instances of code-stuff running? Tomcat 5.5 Java 1.4.2 Thanks, jhm
Re: Are multiple contexts of the same code code base visible to each other?
OK, thats what I thought. The problem that I'm worried about is how a certain class in my webapp is going to behave when 2 instances are of it are running. I have a class called MultiLogger I use like this: MultiLogger logger = MultiLogger.getInstance(com.mysite.stuff.foo.log); getInstance(path) checks a static hashmap for path, if it exists then that instance of MultiLogger is returned, if path is not in the hashmap, then a new instance of MultiLogger is spawned, added to the map, and returned. How will 2 copies of MultiLogger handle 2 requests for com.mysite.stuff.foo.log ? thanks On Fri, Oct 24, 2008 at 1:17 PM, Serge Fonville [EMAIL PROTECTED]wrote: Unless specifically coded to do so, no thread can talk to another by default since there is no way of talking to another instance with an unknown name or identifier On Fri, Oct 24, 2008 at 7:09 PM, Jonathan Mast [EMAIL PROTECTED]wrote: Suppose I have 1 webapp named code-stuff that sits in my webapps directory. Now lets say i set up 2 subdomains of my website, foo.mysite.comand bar.mysite.com and each have an context that points to code-stuff. Will code in these two contexts be visible to each other? I know Tomcat copies to its work/ directory to 2 copies of code-stuff, but I want to know whether in memory, Tomcat has 2 separate instances of code-stuff running? Tomcat 5.5 Java 1.4.2 Thanks, jhm
Why isn't my welcome file being read?
I have an context on Tomcat that is receiving some traffic and returning 404 errors. The request is logged in Apache as GET /foo/ with no file being specified. I've specified in the WEB-INF/web.xml file that the welcome file should be index.jsp yet I am still getting 404s. It should be noted that the server-wide, custom 404.html is served up when requesting this url in the browser. Is this the correct method to route incoming requests for a directory to a specific file? Apache 1.3.33 Tomcat 5.5 Java 1.4.2 Thanks
Re: Why isn't my welcome file being read?
Yeah I figured that Apache was not forwarding it onto Tomcat, however I have other urls that also don't specify a file, and these *are* automagically forwarded to a JSP. I presume it is something called JK that does the connection to Tomcat, I'm obviously not too familiar with Apache. How do tell Apache to forward all incoming requests for /foo/ onto Tomcat, which would then know to serve /foo/index.jsp ? Thanks On Wed, Oct 22, 2008 at 10:44 AM, Caldarale, Charles R [EMAIL PROTECTED] wrote: From: Jonathan Mast [mailto:[EMAIL PROTECTED] Subject: Why isn't my welcome file being read? The request is logged in Apache as GET /foo/ with no file being specified. The real question is: What's being logged in Tomcat? Likely that httpd is never passing the request on to Tomcat. What are you using to connect httpd to Tomcat, and how is it configured? - 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]
Re: [a little OT] Can I get Millisecond precision in Access Logs?
Ok, so I see that will have to roll my own PreciseAccessLogValve. So how do I integrate with Tomcat? Do i just write my code, jar it and place in the Tomcat's common/lib, and simply reference the classname like I do the built-in accesslogvalve? On Tue, Sep 16, 2008 at 4:40 PM, Mark Thomas [EMAIL PROTECTED] wrote: David Fisher wrote: Mark, Interesting but shouldn't the getDate method be slightly different: if ((systime - currentDate.getTime()) 1000) { In this line if currentDate is at millisecond 900 then the next second starts with the millisec and that is 100 ms later. long cachedtime = currentDate.getTime(); if ((systime - cachedtime 999 - cachedtime%1000) { Yes, I know it is a quibble about what is probably fuzzy logic. But I'm just a guy who learned to typeset using integers in ebcdic at 300 dpi in Fortran and IBM Sys 370 Assembler and this is a classic next pixel problem with proportional width characters at a small font size. You are right this isn't perfect. I'd need to do some performance tests so see how much slower the more correct code is. To be perfectly honest, I can live with the current implementation and don't feel the urge to scratch this particular itch. Of course, that shoudn't stop anyone else who fancies taking a look at this. Patches that improve the implementation without adding much (actually any in this case) overhead welcome. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Can I get Millisecond precision in Access Logs?
Is it possible to obtain timestamps with millisecond precision in access logs? I don't see anything about specifying the date-time stamps on AccessLogValve page and was wondering if there wasn't a way to get this data. Tomcat 5.5 Thanks
Re: Can I get Millisecond precision in Access Logs?
Ah, but %D is the time taken to process the request in ms. It's not the timestamp. On Tue, Sep 16, 2008 at 3:14 PM, David Fisher [EMAIL PROTECTED]wrote: It is. The docs are here: http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/valves/AccessLogValve.html I use Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=unity_access. suffix=.log pattern=%h %v %t %s %b %D %{RUNNING}c %r/ The AccessLogValve must be used and it is the %D spec that show milliseconds. Tomcat 5.5.x Regards, Dave On Sep 16, 2008, at 11:39 AM, Jonathan Mast wrote: Is it possible to obtain timestamps with millisecond precision in access logs? I don't see anything about specifying the date-time stamps on AccessLogValve page and was wondering if there wasn't a way to get this data. Tomcat 5.5 Thanks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
specifying a custom access log pattern
Hi, I was wondering what the exact syntax for specifying a custom access log pattern in the server.xml is. Here is a snippet from which contains my custom format: Valve className=org.apache.catalina.valves.AccessLogValue prefix=foo. suffix=.accesslog directory=/usr/local/tomcat/logs/context_logs/ pattern=%h %t %m %U %H %s %b %{User-Agent}i %{Referer}i %D %I / my question is: how should a I handle the nested double quotes in the pattern attribute? How should i escape them? I presume as-is, this will cause Tomcat quite some trouble. thanks, Tomcat 5.5
Yet another context logging question
Hello all, I have Context named foo whose path is /foo and whose docbase is DOCS/foo. foo has it's own AccessLogValve Foo has a subdirectory bar which I would now like to be it's own Context and AccessLogValue. My question is: Will defining a context /foo/bar at DOCS/foo/bar, with it's own LogValue, keep Foo's LogValve from capturing requests for Bar's files? Java 1.4.2 Tomcat 5.5 Thanks, jhm
Re: apparent problem with work/ directory
I planned on doing that. However I'm concerned about the meantime between deleting the wepapp subdirectory inside work/ and restarting. This webapp receives alot of traffic, what will Tomcat do when it gets a request for that webapp, after the work/...WEBAPP directory is deleted? Might it actually derive the correct jsp servlet and therefore not require a restart? Or will it throw errors? And if so, will those errors be limited to that webapp or could if affect other webapps? Thanks On Sat, Aug 30, 2008 at 11:13 AM, H. Hall [EMAIL PROTECTED] wrote: Ken Bowen wrote: When I run into behavior that sounds like what you describe, I manually delete TOMCATwork/Catalina/localhost/APPNAME before restarting. --Ken Yep, me too. Has rarely happened, usually one jsp is the problem and I delete its associated class file and the jsp will then compile ok. --HH On Aug 29, 2008, at 5:00 PM, Jonathan Mast wrote: I refactored the POJO side of a webapp I have. I basically moved some objects referenced by the JSPs into a new package. I updated the jsps accordingly, by importing the new package with the PAGE directive at the top. I deleted the old version of the webapp, rebuilt it, and restarted tomcat. It then started spewing errors, generated from the jsp's, about not being able to find the old classes. I am convinced that the errors lies in the work/ directly, specifically the derived java sources of the jsp were not updated when I restarted Tomcat. I know the problem is not in the webapp itself because i tested it out on my Windoze box before deploying to Linux where the problem occured. My question is: how do I force Tomcat to delete the work directory upon restarting or when I'm building from Ant? Thanks, Tomcat 5.5.17 Java 1.4.2 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- H. Hall ReedyRiver Group LLC http://www.reedyriver.com - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
apparent problem with work/ directory
I refactored the POJO side of a webapp I have. I basically moved some objects referenced by the JSPs into a new package. I updated the jsps accordingly, by importing the new package with the PAGE directive at the top. I deleted the old version of the webapp, rebuilt it, and restarted tomcat. It then started spewing errors, generated from the jsp's, about not being able to find the old classes. I am convinced that the errors lies in the work/ directly, specifically the derived java sources of the jsp were not updated when I restarted Tomcat. I know the problem is not in the webapp itself because i tested it out on my Windoze box before deploying to Linux where the problem occured. My question is: how do I force Tomcat to delete the work directory upon restarting or when I'm building from Ant? Thanks, Tomcat 5.5.17 Java 1.4.2
Re: How to programmatically add parameters to ServletRequest objects?
| This is really the only way to do it. The other option is to create a | new request object and stuff your own parameters into it (or, better | yet, wrap the original request and add your parameters only to the wrapper). How would I do this? This is basically what Jakarta Commons HTTPClient package (org.apache.commons.httpclient.*) offers, correct? I thought such manipulation would be achievable without additional packages. | Why do you believe that adding parameters to the URL is not scalable? Well, its not scalegent, to coin a term; String munging is expensive (scalability), and StringBuffer sb = new StringBuffer(); sb.append(page.jsp?).append(foo=).append(bar).append(color=).append(myColor).etc() is rough to look at (elegent). Why not just: HashMap myParams = new HashMap(); myParams.put(foo, bar); ... pageContext.forward(page.jsp, myParams) ? much more efficient and elegent, imho. I understand that it all eventually boils down to a bunch of String munging, but the above hypothetical method could take of it that for us and would really make my life easier ;-) thanks On Wed, Aug 6, 2008 at 1:17 PM, Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jonathan, Jonathan Mast wrote: | I can't figure out how to use the pageContext.forward() method like it's | equivalent script element: Do you mean that you want to add parameters to a forwarded URL without using JSP? | How do I pass the name-value pair foo:bar using pageContext.forward()? I | thought there would be a method like forward(String path, Map params) but | there isn't. Right: you just forward to another URL. | Nor is there a setParameter(name, value) method available on ServletRequest | or ServletResponse (both of which are passed onto the page pointed to in | pageContext.forward(). Right. The request is supposed to be read-only (ignore attributes ;). | I don't want to put the parameters in the url itself (ie page.jsp?foo=bar) | this approach is not scalable. This is really the only way to do it. The other option is to create a new request object and stuff your own parameters into it (or, better yet, wrap the original request and add your parameters only to the wrapper). Why do you believe that adding parameters to the URL is not scalable? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkiZ3KwACgkQ9CaO5/Lv0PA+cQCgs/6qvuqQEcK24o6fId1K3kgs OkMAn3HqZ2E12xFeevo8eKii7yYiKj2p =Cixo -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]
Problem with Custom Access Log Format
Hi all, I'm using AccessLogValves to log access to contexts and I'm using the combined pattern documented here: http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html#Access%20Log%20Valve However, I would like to define a custom pattern for logging this information. The problem is that I don't see a pattern code that corresponds to the User-Agent or to the Referrer. These values are automagically included when using the combined pattern, but I have a sneaky feeling that these values are accessible directly. Or perhaps I'm mis-reading the documentation. Anyways, any help in uncovering the User-Agent and Referrer values would be appreciated. Thanks Tomcat 5.5 Java 1.4.2
Wholesale HTTP parameter redirection
I have a page which now receives quite a few parameters, eg. page.jsp?abc=fooxyz=bar ... This page redirects via response.sendRedirect(). I want to know how I can forward every parameter onto the redirect page, without having to extract each one individually and rebuilding them in the url I place into sendRedirect(). Thanks
Re: Wholesale HTTP parameter redirection
I thought a forward would require the same type of individual parameter extraction and rebuilding. Please let me know how to do this in bulk. Thanks. On Wed, Jul 16, 2008 at 12:27 PM, Hassan Schroeder [EMAIL PROTECTED] wrote: On Wed, Jul 16, 2008 at 9:13 AM, Jonathan Mast [EMAIL PROTECTED] wrote: This page redirects via response.sendRedirect(). I want to know how I can forward every parameter onto the redirect page, without having to extract each one individually and rebuilding them in the url I place into sendRedirect(). Is there a reason it /has/ to be a redirect, rather than a forward? If not, you'd bypass the whole issue... -- Hassan Schroeder [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]
Strange JSP compilation error
I have jsp that started giving me this error when I added another mundane else if clause to a long section of such clauses: Generated servlet error: Syntax error, insert } to complete Block Generated servlet error: Syntax error on token }, delete this token Generated servlet error: Syntax error, insert } to complete ClassBody The code is syntactically correct because the editor gave me now errors when I composing it. The If-Else go like this: % if (foo) { % jsp:forward ... ... % } else if (bar) { % jsp:include ... and so on. Have a I ran into a limit on such constructions? Tomcat 5.5.17 Java 1.4.2 Thanks
Re: Servlet.jar
Don't forget to include jsp-api.jar in your build process as well, as its contents were formerly contained by servlet.jar. On Mon, Jul 14, 2008 at 2:51 PM, Stephen Nelson-Smith [EMAIL PROTECTED] wrote: It is lib/servlet-api.jar Thank you - perfect. S. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Excess whitespace generated
I'm writing a jsp to return out a simple xml document and it is being preceded by quite a few line breaks, causing my test parser to fail. The page simply calls out.println(xmlstring); Is there another way to control precisely the contents returned by a JSP? I thought there would be a setContent method in the implicit response object, but there isn't.