Re: Tomcat Performance Turning.
Hello Christopher, On Fri, Sep 2, 2011 at 11:52 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Leon, On 9/2/2011 4:19 PM, Leon Rosenberg wrote: holywarfrom my experience there is no need for apache in your setup anyway /holywar. Uh, load-balancing? Aeh... loadbalancer? There are both, soft and hardware solutions. regards Leon - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5hUDgACgkQ9CaO5/Lv0PBfhQCdFwEDvm37L9QTe6FBns88RKLg 7ukAnikbIxI+y/oaskk/Zv/Y4aKPpYD9 =Dc+M -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat Performance Turning.
Hello Talha, On Fri, Sep 2, 2011 at 11:34 PM, Talha Fazal tfa...@credera.com wrote: Q. Have you tried running directly against tomcat without apache inbetween? A. Yes; this resolves the performance bottleneck. Than its pretty clear where to search, isn't it? Q. holywarfrom my experience there is no need for apache in your setup anyway /holywar. A. :-) The reasons for having apache in front: A) Create a DMZ and protect Tomcat from being exposed to outside attacks; You know that httpd does nothing but forwards each and single request to tomcat? So you are not really protect them, you just add another (time consuming) layer. B) Load balancing. You mentioned that you have 2 httpd servers, so all the traffic to 6 (or was it eight) tomcat servers are going through the two httpds? And how do you loadbalancer the 2 httpd servers? Regards Leon Thanks Leon! -Original Message- From: Leon Rosenberg [mailto:rosenberg.l...@gmail.com] Sent: Friday, September 02, 2011 3:19 PM To: Tomcat Users List Subject: Re: Tomcat Performance Turning. Hello Talha, On Fri, Sep 2, 2011 at 6:16 PM, Talha Fazal tfa...@credera.com wrote: PLEASE SEE MY ANSWERS BELOW IN UPPER CAPS. ONE IMPORTANT OBSERVATION: Even though, tomcat's response time is decent, for some reason, apache is taking a lot longer to serve requests. We are using mod_jk with Tomcat using AJP1.3 protocol in the connector setting in server.xml. We plan to try mod_proxy_ajp and mod_proxy instead of mod_jk. Any thoughts here? Interesting observation. Have you tried running directly against tomcat without apache inbetween? holywarfrom my experience there is no need for apache in your setup anyway /holywar. In the past we used both mod_jk and mod_proxy_ajp, and even mod_proxy_ajp is somewhat faster, the difference where never 17 seconds. Your best guess would probably be to test without httpd to rule out if tomcat or httpd is the bottleneck. regards Leon Thanks, -Original Message- From: R Batchelor [mailto:rsbat...@yahoo.com] Sent: Friday, September 02, 2011 10:10 AM To: Tomcat Users List Subject: Re: Tomcat Performance Turning. Have you ruled out issues with db connection pooling? NO. IN FACT, THERE ARE KNOWN DBCP CONNECTION POOLING DEADLOCK ISSUES IN TOMCAT 6.0.26 [https://issues.apache.org/jira/browse/DBCP-270]. I AM LOBBYING TO UPGRADE TO TOMCAT 7.0.20 AND USE THE JDBC CONNECTION POOL INSTEAD OF DBCP CONNECTION POOL. You might consider setting your dbcp maxWait to 8000 or less and watch for timeout waiting for idle object exceptions. Also, you could monitor database connections/active-users on the DB side to see if your dbcp pools are max'd but all the database users/connections are idle. These can be symptoms of an application mis-managing its dbcp pools. I WILL DEFINITELY TRY THIS OUT. THANKS! From: Leon Rosenberg rosenberg.l...@gmail.com To: Tomcat Users List users@tomcat.apache.org Sent: Friday, September 2, 2011 7:55 AM Subject: Re: Tomcat Performance Turning. Hello Talha, well... the quickshots are through. You should really create some threaddumps after each other (for example with jstack) and try to find out which thread is slowing the app down. For starters you could try with code you changed for tomcat adaptations if any. The problem seems to lie beneath the surface, so you will have to start performance monitoring and look into the inside. However, time difference of 17 seconds must be something very very obvious like a synchronized block in a valve/filter, db lock (have you checked the db locks?), or an if (tomcat) Thread.sleep(1000L*60*17); regards Leon On Fri, Sep 2, 2011 at 4:21 PM, Talha Fazal tfa...@credera.com wrote: Hi Leon, Please see any answers in CAPS below. -Original Message- From: Leon Rosenberg [mailto:rosenberg.l...@gmail.com] Sent: Friday, September 02, 2011 9:06 AM To: Tomcat Users List Subject: Re: Tomcat Performance Turning. Hello Talha, seems that your tomcats are fine. Question, you mention that the tomcat do not perform, but you don't tell us how you come to this conclusion except for cpu load. ANSWER: LOOKING INTO THE TOMCAT ACCESS LOGS, THE RESPONSE TIME (%D) IS HORRIBLE). What is the difference in response times between weblogic and tomcat? ANSWER: FOR PAGES THAT WEBLOGIC SERVES IN 500 ms ON AVERAGE, TOMCAT IS TAKING 17000 ms ON AVERAGE. Maybe your tomcat just perform the job MUCH faster ;-) The thread dump you posted in another reply indicates that your tomcats are idling. Do you have manager installed? NO. With manager you could monitor active connections and requests. Do you have probe installed? YES, WE HAVE IT INSTALLED. A LOT OF THREADS ARE IDLING IS WHAT WE OBSERVE. Finally, if you really want to profile your application, do you have moskito installed? :-) (the one i initially wrote -moskito.anotheria.net, therefore the shameless
RE: Servlet 3.0 File Upload
You need to add a line in in your form: input type=text name=filename / Then in your servlet GetPost() method you put this filename in a variable: String filename; filename = req.getParameter(filename); Then instead of part.write(samplefile); do: part.write(filename); Jonathan Soons From: Ole Ersoy [ole.er...@gmail.com] Sent: Friday, September 02, 2011 6:50 PM To: Tomcat Users List Subject: Servlet 3.0 File Upload Hi, I have a working file upload servlet, with the exception that it calls the uploaded file samplefile instead of using the name of the file. So if I upload different files, they all overwrite each other. Any ideas on how to fix this? I used this tutorial to get it working: http://www.servletworld.com/servlet-tutorials/servlet3/multipartconfig-file-upload-example.html TIA, - Ole - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: CGIServlet - php
Thanks Hassan: I could use all the luck I can get. I was on NetBeans a couple years back but had to bail when they pretty much abandoned web developers. Oracle put the nail in the coffin but it all began with the killing of Woodstock and the Visual Development Environment and that is on Sun. Looking back I never should have jumped on that Woodstock ride. Too soon old, too late smart. TC -- View this message in context: http://old.nabble.com/CGIServlet---php-tp32390310p32392261.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: Servlet 3.0 File Upload
Hi, -Original Message- From: Jonathan Soons [mailto:jso...@juilliard.edu] Sent: Saturday, September 03, 2011 2:24 PM To: Ole Ersoy; Tomcat Users List Subject: RE: Servlet 3.0 File Upload You need to add a line in in your form: input type=text name=filename / Then in your servlet GetPost() method you put this filename in a variable: String filename; filename = req.getParameter(filename); Then instead of part.write(samplefile); do: part.write(filename); Doesn't that mean that the user has to enter the filename by himself? What I usually do to get the filename is: Part uploadPart = request.getPart(uploadfield); // get the Part String contDispoHeader = uploadPart.getHeader(Content-Disposition); // get Content-Disposition header String uploadFilename = null; if (contDispoHeader != null) { try { uploadFilename = new ContentDisposition(contDispoHeader).getParameter(filename); } catch (ParseException e) { } } Note that ContentDisposition class is from JavaMail package (javax.mail.internet.ContentDisposition). Browser usually send filenames in the filename parameter of a Content-Disposition header. Regards, Konstantin Preißer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Performance for many small requests
Some good advice in this thread already, but given the power of server there should be no problem serving even more requests ( as long as they are small, not bound by CPU or I/O). I'd start looking at JVM GC properties. Turn on gc logging with -Xloggc:/someplace/gclog_tomcat.txt -XX:+PrintGCDetails ( or some verbose / timestamped variant of this ) And see what your gc pauses look like, how frequent young gen / full gc are. With hundreds of requests coming in every sec, you get into situation where garbage collection pause will create a burst of requests once its done ( and there is a risk that those burst objects will get promoted to old gen! ) and cause stampede if server is near limits already. Generally You want your requests to never hit old gen memory in JDK and get collected in some magic parallel young gen GC collector ( -XX:+UseParNewGC, -XX:NewSize=??? -XX:MaxNewSize=??? -XX:SurvivorRatio=??? are worth checking / or even trying G1C in JDK7 if You feel adventurous ). As already was mentioned - finetuning JVM params is good idea, but only after checking GC logs. Only thing i recommend outright is pinning JVM heap with matching -Xmx and -Xms directives - or else JVM will keep allocating/deallocating memory from OS, potentially creating fragmentation issues in long term. And there is a question of 64bit JVM, unless you need Java heap above ~1.5G, 32bit JVM should do just fine, otherwise you are just paying huge tax in memory usage and CPU cache/TLB misses. -XX:+UseCompressedOops can help to remove some of this tax, but in my opinion using 64bit JVM with such a small heap is only needed if performance testing shows gains versus 32bit JVM. -- View this message in context: http://old.nabble.com/Performance-for-many-small-requests-tp32372424p32392622.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: CGIServlet - php
2011/9/3 throwsCode donmillho...@yahoo.com: I do not quite understand you. I'm trying to implement PHP on tomcat 7.0.20 with no luck. Does anyone know how I can tell whether the CGIServlet is running? I uncommented all of the sections indicated in the Tomcat document. What sections? What document did you read? Have you see FAQ pages on our Wiki? IIRC somebody has described how he did run PHP with Tomcat. There should also be several discussions in the archives of this mailing list. BTW, in the manager webapp if you click on Server Status and then on Complete Server Status link, that page lists all active servlets in every webapp. Though I think I am making the right call, I am receiving a 400 error. CALL made form file 'index.html' ?php include 'cgi-bin/echoInfo.php'; ? What is relation between index.html, the code fragment above and php. index.html would be a static file, wouldn't it? Why then php code is there? FILE located in directory WEB-INF/cgi/echoInfo.php ?php phpinfo(); ? One other thing that concerns me. In every other option for running php including Apache there is some direction with regard to where you must place the php.ini file. The only thing that CGIServlet does is running external programs and catching their output, using java.lang.Runtime.exec(). You may see the source code. Someone wrote that php.ini is sought in 1. Current working directory ( System.getProperty(user.dir) will tell you what it is) 2. In directory specified by PHPRC environment variable. ( You may set and export one in $CATALINA_BASE/bin/setenv.sh ) 3. In system-specific directory specified when compiling the PHP engine itself. ( Somewhere in /etc ) I have found no direction for the php.ini file in the Tomcat documentation or on the Internet for specifically Tomcat. Does anyone know how Tomcat or Eclipse, is pointed at the php.ini file? Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Form Authentication and status (response) code
2011/9/2 Mabry Tyson ty...@ai.sri.com: Summary: When requiring form authentication, Tomcat responds to an unauthenticated GET request with a HTTP status code of 200 (OK) and the login page. I believe that to be in violation of the HTTP standards. The problem: Software makes a GET request to a web server. It gets back a 200 status code. By RFC 2616, that code indicates the request has succeeded. The software then takes the resulting page as the successful response to the GET request. However, in some cases this response is NOT a successful response but is instead a login form. By using a 200 status code, Tomcat is misrepresenting that the login form is the response to the request. My believe is a 4xx code (client error) is appropriate, or possibly a 3xx code (Redirection) might be appropriate. Unfortunately, the RFC indicates that a 401 (Unauthorized) response MUST have a header that is only appropriate for basic or digest authentication. So a status code of 401 is not legal in this situation. neither is 403 or 404. Plus add to that that certain web browser (IE) has a habit to display his own error page instead on the one provided by the server. The response code 200 tells that server is returning some valid data (a HTML page) that has to be displayed to the user. There might be other headers along that (e.g. to forbid caching). What is your software trying to do? It is trying to crawl the web site? Maybe you can detect the presence of login form on the HTML page that is returned to you? P.S. For anyone maintaining the examples, shouldn't vendor examples demonstrate the best practices? I'd suggest you indicate the Content-Type and the charset. The best way to make examples better is to prepare and propose patches (through Bugzilla). Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Servlet 3.0 File Upload
You need to add a line in in your form: input type=text name=filename / Then in your servlet GetPost() method you put this filename in a variable: String filename; filename = req.getParameter(filename); Then instead of part.write(samplefile); do: part.write(filename); Letting the remote user control the name of the file that is written to disk exposes a potential security risk. Due to bad configuration, the posted name may allow the caller to save arbitrary files anywhere they wish. The server should generate the name that is used to save the file to remove this risk Chris
RE: Performance for many small requests
From: Darius D. [mailto:darius@gmail.com] Subject: Re: Performance for many small requests in my opinion using 64bit JVM with such a small heap is only needed if performance testing shows gains versus 32bit JVM. The main advantage of using a 64-bit JVM is the increased number of registers available in the x86-64 architecture, which can result in vastly reduced memory references. Whether or not that's important to overall performance is highly dependent on the application, of course. - 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: Performance for many small requests
n828cl wrote: From: Darius D. [mailto:darius@gmail.com] Subject: Re: Performance for many small requests in my opinion using 64bit JVM with such a small heap is only needed if performance testing shows gains versus 32bit JVM. The main advantage of using a 64-bit JVM is the increased number of registers available in the x86-64 architecture, which can result in vastly reduced memory references. Whether or not that's important to overall performance is highly dependent on the application, of course. Yeah, but I'd err on 32bit JVM side :) Gains from more registers are very specific, but penalty from increased cache/TLB misses is big, and if you start hitting hard page faults ( that would have been avoidable due to lower heap size with 32bit JVM ) - even one of those will erase all gains :) There are reasons why Linux and other stuff is shipped compiled optimized for size, not with some fancy -O666 option. -- View this message in context: http://old.nabble.com/Performance-for-many-small-requests-tp32372424p32392870.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: Performance for many small requests
On 9/3/2011 1:15 PM, Darius D. wrote: n828cl wrote: From: Darius D. [mailto:darius@gmail.com] Subject: Re: Performance for many small requests in my opinion using 64bit JVM with such a small heap is only needed if performance testing shows gains versus 32bit JVM. The main advantage of using a 64-bit JVM is the increased number of registers available in the x86-64 architecture, which can result in vastly reduced memory references. Whether or not that's important to overall performance is highly dependent on the application, of course. Yeah, but I'd err on 32bit JVM side :) Gains from more registers are very specific, but penalty from increased cache/TLB misses is big, and if you start hitting hard page faults ( that would have been avoidable due to lower heap size with 32bit JVM ) - even one of those will erase all gains :) Then why shouldn't I just double my heap size? Wouldn't that eliminate the risk of increased cache misses? I was just using the settings from my 32-bit installation, but have plenty of RAM to allow me to increase the memory settings if that would help. Dave - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Performance for many small requests
David Kerber wrote: On 9/3/2011 1:15 PM, Darius D. wrote: n828cl wrote: From: Darius D. [mailto:darius@gmail.com] Subject: Re: Performance for many small requests in my opinion using 64bit JVM with such a small heap is only needed if performance testing shows gains versus 32bit JVM. The main advantage of using a 64-bit JVM is the increased number of registers available in the x86-64 architecture, which can result in vastly reduced memory references. Whether or not that's important to overall performance is highly dependent on the application, of course. Yeah, but I'd err on 32bit JVM side :) Gains from more registers are very specific, but penalty from increased cache/TLB misses is big, and if you start hitting hard page faults ( that would have been avoidable due to lower heap size with 32bit JVM ) - even one of those will erase all gains :) Then why shouldn't I just double my heap size? Wouldn't that eliminate the risk of increased cache misses? I was just using the settings from my 32-bit installation, but have plenty of RAM to allow me to increase the memory settings if that would help. Dave Umm, sorry, it seems that 64 vs 32bit discussion has thrown this thread of track. In your case it probably makes little difference. I'd definately start by profiling and looking at gc logs. As a side note - (CPU)cache/TLB misses have nothing to do with heap size. Too big heap size can be as bad as too low ( by stealing memory from OS that could have been used for file caches and other apps and increasing GC pauses ). -- View this message in context: http://old.nabble.com/Performance-for-many-small-requests-tp32372424p32392937.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: Servlet 3.0 File Upload
Hi, -Original Message- From: cjder...@gmail.com [mailto:cjder...@gmail.com] On Behalf Of chris derham Sent: Saturday, September 03, 2011 6:51 PM To: Tomcat Users List Subject: Re: Servlet 3.0 File Upload Letting the remote user control the name of the file that is written to disk exposes a potential security risk. Due to bad configuration, the posted name may allow the caller to save arbitrary files anywhere they wish. The server should generate the name that is used to save the file to remove this risk Chris Yes, the user could supply a name like ../../badfile.exe (even in the Content-Disposition header) to inject a file anywhere in the file system. Of course, one shouldn't use the supplied filename to save the file on the server. I usually make a DB entry with the supplied filename stored in a text field, and use the ID of the entry to generate a filename where the actual file contents are stored. The supplied filename is then only for displaying purposes. Regards, Konstantin Preißer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Performance for many small requests
From: David Kerber [mailto:dcker...@verizon.net] Subject: Re: Performance for many small requests Then why shouldn't I just double my heap size? Wouldn't that eliminate the risk of increased cache misses? As Darius stated, this part of the discussion is probably completely irrelevant to any performance issues you have. Regardless, doubling the heap size will likely _increase_ the cache misses, since you now have a larger target space being accessed through a fixed size cache space. This level of refinement is a real juggling act; unless your cores are staying very busy, it's unlikely to have any measurable effect. You need to collect more data so you can start ruling out causes, and GC information is probably the easiest to start with. - 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: CGIServlet - php
Wow thanks Konstantin a lot of good questions and suggestions. Please give me some time to put together a cogent reply. I have looked at hundreds of documents and thousands of Internet pages so it will take me some time to filter the ones that I thought applied and actually tried. With regard to Tomcat 7 the main document is CGI How To (very small) this I believe I implemented, no joy. The second document that had some value was the CGIServlet Class document. I did go through FAQ and copied some stuff but its not at my finger tips, I'll include the references in my reply. With regard to your comments on php.ini it is exactly this lack of clarity that frustrates me. You start moving each of these pieces of the puzzle to different places in the system based on well meaning comments from the Internet or any other source and you are sure to become lost. Basically its a hope I get the right combination approach. Don't get me wrong I am most thankful for the suggestions but it is not the kind of direction I hope to get from an Apache project. I know the CGIServlet document defines itself as a beta effort - which apparently it has been for four or five years. I think its time for Tomcat to decide emough already our core target market does not need this capability, drop it; or maybe it is important to a significant portion of our market, support it. Living in the land of in between is serving no one well. My desire is to make this capability available in my development environment (Eclipse / Tomcat). Essentially I want to test as much of the php component/application as I can before deploying them to a client's production environment which I doubt will be Tomcat. Much thanks, please expect a reply to your questions by Monday. TC -- View this message in context: http://old.nabble.com/CGIServlet---php-tp32390310p32393205.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: CGIServlet - php
On 1:59 PM, Konstantin Kolinko wrote: 2011/9/3 throwsCodedonmillho...@yahoo.com: I do not quite understand you. I'm trying to implement PHP on tomcat 7.0.20 with no luck. Does anyone know how I can tell whether the CGIServlet is running? I uncommented all of the sections indicated in the Tomcat document. What sections? What document did you read? Have you see FAQ pages on our Wiki? IIRC somebody has described how he did run PHP with Tomcat. There should also be several discussions in the archives of this mailing list. BTW, in the manager webapp if you click on Server Status and then on Complete Server Status link, that page lists all active servlets in every webapp. Though I think I am making the right call, I am receiving a 400 error. CALL made form file 'index.html' ?php include 'cgi-bin/echoInfo.php'; ? What is relation between index.html, the code fragment above and php. index.html would be a static file, wouldn't it? Why then php code is there? FILE located in directory WEB-INF/cgi/echoInfo.php ?php phpinfo(); ? One other thing that concerns me. In every other option for running php including Apache there is some direction with regard to where you must place the php.ini file. The only thing that CGIServlet does is running external programs and catching their output, using java.lang.Runtime.exec(). You may see the source code. Someone wrote that php.ini is sought in 1. Current working directory ( System.getProperty(user.dir) will tell you what it is) 2. In directory specified by PHPRC environment variable. ( You may set and export one in $CATALINA_BASE/bin/setenv.sh ) 3. In system-specific directory specified when compiling the PHP engine itself. ( Somewhere in /etc ) I have found no direction for the php.ini file in the Tomcat documentation or on the Internet for specifically Tomcat. Does anyone know how Tomcat or Eclipse, is pointed at the php.ini file? Best regards, Konstantin Kolinko I believe if you can get phpinfo() to run, it will provide you with the path to the php.ini file in use. -Terence Bandoian - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat 7.0.16 won't execute my JSP pages
Hello Tomcat users. I have been a happy Tomcat user since Tomcat 4.x, this will be my first post in a long time. We updated from Tomcat 6.x to Tomcat 7.0.4 a few months ago. This worked just fine. When I updated to Tomcat 7.0.20 last week, I discovered that our JSP pages aren't being executed , rather the server sends back our JSP code to the user. That is not really the desired effect. After some testing, I discovered that this problem was first introduced with Tomcat 7.0.16. Everything works fine in Tomcat 7.0.14. There is no error being logged by Tomcat. Our Application is programmed, built and compiled in Netbeans. It is distributed via a WAR file. The only special parts of our web.xml relating to JSP, are that we execute jnlp files using the JSP engine (we have dynamic java web start files). /servlet-mapping servlet-namejsp/servlet-name url-pattern*.jnlp/url-pattern /servlet-mapping/ There is no error message. I can see the hits in the localhost_access_log In the root directory, the index.jsp is executing correctly! Actually I managed to solve the problem by adding a servlet mapping for jsp. / servlet-mapping servlet-namejsp/servlet-name url-pattern*.jnlp/url-pattern /servlet-mapping/ /servlet-mapping servlet-namejsp/servlet-name url-pattern*.jsp/url-pattern /servlet-mapping /Interestingly this problem doesn't occur, when both of these sevlet mappings are deleted. It seems that Tomcat up to 7.0.16 always had a default mapping for *.jsp and that from Tomcat 7.0.16 this default mapping only exists, if there are no other jsp mappings. In my case I need both mappings, to ensure that both *.jsp and *.jnlp files are executed as jsp. I haven't tried to find the code that changed, it doesn't really bother me having one more mapping in my web.xml# So maybe this will help some other Tomcat user. Martin - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: CGIServlet - php
Even if you don't want to run in Resin, studying (open source) Quercus should give you the details/direction you want: http://www.caucho.com/resin-3.0/quercus/ --Ken On Sep 3, 2011, at 3:16 PM, Terence M. Bandoian wrote: On 1:59 PM, Konstantin Kolinko wrote: 2011/9/3 throwsCodedonmillho...@yahoo.com: I do not quite understand you. I'm trying to implement PHP on tomcat 7.0.20 with no luck. Does anyone know how I can tell whether the CGIServlet is running? I uncommented all of the sections indicated in the Tomcat document. What sections? What document did you read? Have you see FAQ pages on our Wiki? IIRC somebody has described how he did run PHP with Tomcat. There should also be several discussions in the archives of this mailing list. BTW, in the manager webapp if you click on Server Status and then on Complete Server Status link, that page lists all active servlets in every webapp. Though I think I am making the right call, I am receiving a 400 error. CALL made form file 'index.html' ?php include 'cgi-bin/echoInfo.php'; ? What is relation between index.html, the code fragment above and php. index.html would be a static file, wouldn't it? Why then php code is there? FILE located in directory WEB-INF/cgi/echoInfo.php ?php phpinfo(); ? One other thing that concerns me. In every other option for running php including Apache there is some direction with regard to where you must place the php.ini file. The only thing that CGIServlet does is running external programs and catching their output, using java.lang.Runtime.exec(). You may see the source code. Someone wrote that php.ini is sought in 1. Current working directory ( System.getProperty(user.dir) will tell you what it is) 2. In directory specified by PHPRC environment variable. ( You may set and export one in $CATALINA_BASE/bin/setenv.sh ) 3. In system-specific directory specified when compiling the PHP engine itself. ( Somewhere in /etc ) I have found no direction for the php.ini file in the Tomcat documentation or on the Internet for specifically Tomcat. Does anyone know how Tomcat or Eclipse, is pointed at the php.ini file? Best regards, Konstantin Kolinko I believe if you can get phpinfo() to run, it will provide you with the path to the php.ini file in use. -Terence Bandoian - 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: Performance for many small requests
-Original Message- From: Darius D. [mailto:darius@gmail.com] Sent: Saturday, September 03, 2011 1:36 PM As a side note - (CPU)cache/TLB misses have nothing to do with heap size. Too big heap size can be as bad as too low ( by stealing memory from OS that could have been used for file caches and other apps and increasing GC pauses ). The Linux JVM has a nice option -XX:+UseLargePages to help avoid TLB misses on heap accesses. It's good for modest gains, and has the side effect of locking the heap into memory. I tend to use it on systems with large heaps. Not much you can do about cache misses though, besides getting processors with more cache. -Jeff - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
servlet unavailable
Posner to users show details 8:16 PM (2 minutes ago) Hello all: I am hoping someone can help with this. Tomcat 6.0.28 keeps giving me, saying 'Servlet Front Controller is not available' I am using struts 1, the jar file is struts-core-1.3.10 located in install_dir/myapp/WEB-INF/lib Please help ?xml version=1.0 encoding=UTF-8? web-app version=2.5 xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; listener listener-classcom.listeners.TrailsContextListener/listener-class /listener context-param param-name trailsDBConnName /param-name param-value jdbc:mysql://localhost:3306/trailsDB /param-value /context-param !--Define the controller servlet -- servlet servlet-nameFrontController/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class !-- Name the Struts configuration file -- init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param !-- Guarantees that this servlet is loaded on startup I'm hoping that this won't interfere with my -- !--listener declaration above since that also needs to be initialized first before anything runs -- load-on-startup2/load-on-startup /servlet servlet-mapping servlet-nameFrontController/servlet-name url-pattern*.do/url-pattern /servlet-mapping !-- These other servlets will become Actions, and go in struts-config.xml file -- !-- I'll leave them here but commented out for now in case you need to see them servlet servlet-nameShow Bikes/servlet-name servlet-classcom.bikes.controller.BikeModelsServlet/servlet-class /servlet servlet-mapping servlet-nameShow Bikes/servlet-name url-pattern/getBikes.do/url-pattern /servlet-mapping servlet servlet-nameDisplay Characteristics/servlet-name servlet-classcom.bikes.controller.DisplayModelRatingsServlet/servlet-class /servlet servlet-mapping servlet-nameDisplay Characteristics/servlet-name url-pattern/getModelInfo.do/url-pattern /servlet-mapping -- !-- Leaving this as is for now -- welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list /web-app Reply Forward Ada
Virtual hosts on Tomcat 7 for 3 webapps
Hi there I have a server that runs 3 different web apps on the same ip but each on its own port. eg ip:8080, ip:8081 and ip:8082. All apps should run simultaneously and have their own folders. Can a single Tomcat support the 3 of them and can i use virtual hosts on Tomcat alone ? Thanks Sent from my iPhone - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Virtual hosts on Tomcat 7 for 3 webapps
why you don't use virtualhost over apache ? it's easier do it with it. Un saludo 2011/9/3 Ioannis Parapontis parapont...@gmail.com Hi there I have a server that runs 3 different web apps on the same ip but each on its own port. eg ip:8080, ip:8081 and ip:8082. All apps should run simultaneously and have their own folders. Can a single Tomcat support the 3 of them and can i use virtual hosts on Tomcat alone ? Thanks Sent from my iPhone - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Virtual hosts on Tomcat 7 for 3 webapps
On Sat, Sep 3, 2011 at 2:51 PM, Ioannis Parapontis parapont...@gmail.com wrote: I have a server that runs 3 different web apps on the same ip but each on its own port. eg ip:8080, ip:8081 and ip:8082. All apps should run simultaneously and have their own folders. Can a single Tomcat support the 3 of them and can i use virtual hosts on Tomcat alone ? Yes. You don't need Apache httpd in front of Tomcat, and you don't even need to run on separate ports if you use named virtual servers. -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/hassanschroeder twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Performance for many small requests
Jeff Sturm wrote: The Linux JVM has a nice option -XX:+UseLargePages to help avoid TLB misses on heap accesses. It's good for modest gains, and has the side effect of locking the heap into memory. I tend to use it on systems with large heaps. Not much you can do about cache misses though, besides getting processors with more cache. Yeah, Large(Huge) pages is big, free 10-15% perf if app is memory heavy. And as a bonus you also reduce the size of kernel page translation tables ( works wonders if you are using for example Oracle that is using shared mem for instances, savings can be up to gigabytes on big systems ). Even greater news is that recent Linux kernel versions ( i think 2.6.38 and above ) have so called Transparent Huge Pages - that basically enable them with some magic for all processes, giving 95% of HugePages benefits without LargePages penalties (heap locking/pinning and app specific config). So users of virtualisation, databases and JVMs with large heaps can rejoice :) -- View this message in context: http://old.nabble.com/Performance-for-many-small-requests-tp32372424p32393854.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: Virtual hosts on Tomcat 7 for 3 webapps
Thanks for the responses. The reason i do not use apache is that the server that runs my 3 apps works better with Tomcat. So it would be useful if some guidelines are provided on how i should do this. Sent from my iPhone On 4 Σεπ 2011, at 1:01, Manuel Fernández Panzuelamanuelfernandezpanzu...@gmail.com wrote: why you don't use virtualhost over apache ? it's easier do it with it. Un saludo 2011/9/3 Ioannis Parapontis parapont...@gmail.com Hi there I have a server that runs 3 different web apps on the same ip but each on its own port. eg ip:8080, ip:8081 and ip:8082. All apps should run simultaneously and have their own folders. Can a single Tomcat support the 3 of them and can i use virtual hosts on Tomcat alone ? Thanks Sent from my iPhone - 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: Virtual hosts on Tomcat 7 for 3 webapps
On Sat, Sep 3, 2011 at 3:25 PM, Ioannis Parapontis parapont...@gmail.com wrote: So it would be useful if some guidelines are provided on how i should do this. They are; see the documentation's virtual hosting how-to :-) -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/hassanschroeder twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: CGIServlet - php
- Original Message - From: throwsCode donmillho...@yahoo.com To: users@tomcat.apache.org Cc: Sent: Saturday, September 3, 2011 11:44 AM Subject: Re: CGIServlet - php Wow thanks Konstantin a lot of good questions and suggestions. Please give me some time to put together a cogent reply. I have looked at hundreds of documents and thousands of Internet pages so it will take me some time to filter the ones that I thought applied and actually tried. With regard to Tomcat 7 the main document is CGI How To (very small) this I believe I implemented, no joy. The second document that had some value was the CGIServlet Class document. I did go through FAQ and copied some stuff but its not at my finger tips, I'll include the references in my reply. With regard to your comments on php.ini it is exactly this lack of clarity that frustrates me. You start moving each of these pieces of the puzzle to different places in the system based on well meaning comments from the Internet or any other source and you are sure to become lost. Basically its a hope I get the right combination approach. Don't get me wrong I am most thankful for the suggestions but it is not the kind of direction I hope to get from an Apache project. I know the CGIServlet document defines itself as a beta effort - which apparently it has been for four or five years. I think its time for Tomcat to decide emough already our core target market does not need this capability, drop it; or maybe it is important to a significant portion of our market, support it. Living in the land of in between is serving no one well. My desire is to make this capability available in my development environment (Eclipse / Tomcat). Essentially I want to test as much of the php component/application as I can before deploying them to a client's production environment which I doubt will be Tomcat. Much thanks, please expect a reply to your questions by Monday. TC -- OK, this is unbelievably ugly, insecure (according to the PHP web site), and all around unpleasant. I would certainly run an Apache HTTPD server with the PHP module added. I would also use NetBeans. NetBeans 6.9.1 and 7.0.1 both have pretty good support for PHP, including code completion, various frameworks (Zend, Symfony, Smarty), and documentation help. That being said, here's how to get it running under the following environment. You're on your own for Eclipse. Environment: OS: Fedora 15 JDK/JRE: 1.6.0_26 Tomcat: 7.0.19 PHP: 5.3.6 NetBeans: 7.0.1 A. Getting php-cgi set insecurely First of all, you'll need to use php-cgi in order to deal with all of the HTML header information. With most modern PHP installations this presents a problem under anything other than Apache HTTPD. Due to security constraints, cgi.force_redirect is compiled in to prevent people from calling php scripts directly. See: http://php.net/manual/en/security.cgi-bin.php http://php.net/manual/en/security.cgi-bin.force-redirect.php Initially I thought you could get around this by editing php.ini, but this did not appear to work (note - this may be due to me leaving rw permissions on php.ini). Also, you would have to either alter the system-wide php.ini (not recommended) or add another init-param in web.xml to point php-cgi to the altered php.ini. However, what does work is setting an environment variable and making php-cgi aware of this. To do this: 1. Create a file called setenv.sh in $CATALINA_HOME/bin if you don't already have one. 2. Add the following: REDIRECT_STATUS=0 export REDIRECT_STATUS You'll need to start Tomcat with the startup and shutdown scripts unless Eclipse does the right thing with setenv.sh B. Configure context.xml From the Tomcat documentation at: http://tomcat.apache.org/tomcat-7.0-doc/cgi-howto.html you'll need to set priviledged=true in context.xml. 1. Create a context.xml file in META-INF of your web application project 2. Put the following minimal content in the file ?xml version=1.0 encoding=UTF-8? Context privileged=true/ C. Configure web.xml I put everything into my web application's web.xml since I didn't want this capability across all of my applications. I basically copied the section from $CATALINA_HOME/conf/web.xml and made some changes. Here's what I came up with. servlet servlet-namecgi/servlet-name servlet-classorg.apache.catalina.servlets.CGIServlet/servlet-class init-param param-namedebug/param-name param-value0/param-value /init-param init-param param-namecgiPathPrefix/param-name param-value//param-value /init-param init-param param-nameexecutable/param-name param-value/usr/bin/php-cgi/param-value /init-param init-param param-namepassShellEnvironment/param-name param-valuetrue/param-value /init-param
Re: CGIServlet - php
- Original Message Edited - From: Mark Eggers its_toas...@yahoo.com To: Tomcat Users List users@tomcat.apache.org Cc: Sent: Saturday, September 3, 2011 3:53 PM Subject: Re: CGIServlet - php C. Configure web.xml I put everything into my web application's web.xml since I didn't want this capability across all of my applications. I basically copied the section from $CATALINA_HOME/conf/web.xml and made some changes. Here's what I came up with. servlet servlet-namecgi/servlet-name servlet-classorg.apache.catalina.servlets.CGIServlet/servlet-class init-param param-namedebug/param-name param-value0/param-value /init-param init-param param-namecgiPathPrefix/param-name param-value//param-value /init-param init-param param-nameexecutable/param-name param-value/usr/bin/php-cgi/param-value /init-param init-param param-namepassShellEnvironment/param-name param-valuetrue/param-value /init-param load-on-startup5/load-on-startup /servlet servlet-mapping servlet-namecgi/servlet-name url-pattern*.php/url-pattern /servlet-mapping A few notes are in order. 1. In order to not mangle paths, I set the cgiPathPrefix to / This means that the search path will be /WebApp/ and I can place PHP files in whatever directory makes sense for the application. And this was just plain wrong. Leave the default so that you're a bit more protected. In other words: init-param param-namecgiPathPrefix/param-name param-value/WEB-INF/cgi/param-value /init-param The servlet mapping will then work fine. Directories under WEB-INF/cgi will work as you would expect with the mapping given above. Sigh . . . sorry 'bout the other cgiPathPrefix init-param. . . . . just my two cents. /mde/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Virtual hosts on Tomcat 7 for 3 webapps
- Original Message - From: Ioannis Parapontis parapont...@gmail.com To: Tomcat Users List users@tomcat.apache.org Cc: Sent: Saturday, September 3, 2011 3:25 PM Subject: Re: Virtual hosts on Tomcat 7 for 3 webapps T hanks for the responses. The reason i do not use apache is that the server that runs my 3 apps works better with Tomcat. So it would be useful if some guidelines are provided on how i should do this. Sent from my iPhone See the following Wiki entry for setting up virtual hosts. While it's geared towards a development environment, if you add the hosts to DNS it should work find in a production environment. http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts . . . . just my two cents. /mde/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Servlet 3.0 Part Header Keys
Hi, Anyone know if the the keys for the various javax.servlet.http.Part headers are available as constants anywhere? I'd like to do something like: part.getHeader(Part.FILENAME);...instead of part.getHeader(filename); TIA, - Ole - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: CGIServlet - php
Terence, Ken, Mark thanks for all your input. Much to consider. Mark your the first person who replied who sounds like they have actually run php and tomcat. Despite your concerns, this gives me the confidence that i can get it running with all this help. Perhaps I'm wrong but I don't think at this point I need to concern myself with the lack of security as it relates to Tomcat. I am setting up a pure development environment. I don't know what the production server environment will be. I will of course pay attention to the many security risks defined in the PHP manual. Zend Debugging is setup and working as far as phpScript is concerned. If I can get the Tomcat piece to work I think I will have a good development environment. I'll let everyone know how this all turns out in the next couple days. Thanks much. TC -- View this message in context: http://old.nabble.com/CGIServlet---php-tp32390310p32394151.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: CGIServlet - php
- Original Message - From: throwsCode donmillho...@yahoo.com To: users@tomcat.apache.org Cc: Sent: Saturday, September 3, 2011 5:13 PM Subject: Re: CGIServlet - php Terence, Ken, Mark thanks for all your input. Much to consider. Mark your the first person who replied who sounds like they have actually run php and tomcat. Despite your concerns, this gives me the confidence that i can get it running with all this help. Just tried it for the first time before writing the mail message. So yep - it works here, your mileage may vary. /mde/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
[Servlet 3.0] Monitoring File Upload Progress
Hi, Anyone know whether it's possible to monitor progress of a file upload? TIA, - Ole - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
CRLF Stripped in Tomcat Response Header
Hi All! First, let me assure everyone that I am not a hacker, exactly the opposite, but I have a related problem. I am in the process of implementing code that protects against header manipulation. I created a filter that strips line feed and carriage return characters from requests to avoid header splitting. The thing is, I want to test it, and can't recreate the issue with Tomcat. When I insert this code in my jsp: String attack = name=Bad Hacker\r\nHTTP/1.1 404 Page not found\r\n...; response.setHeader(Set-Cookie, attack); The returned request is returned like this: Set-Cookie: author=Wiley Hacker HTTP/1.1 404 Page not found ...\r\n As you can see all the CRLF have been replaced with whitespaces. I'm assuming Tomcat is doing this, but I can't find where, even after looking through the code and reading the documentation. Does anyone know anything about this? Is there any way to turn this off? I can't test my code when it's in place. Alternatively if anyone has any other solution as to how to test it, I would be most grateful. Thanks! Btw, I'm using Tomcat 6.0.32