RE: Custom Error Messages (5xx and 4xx)
Rob, I feel for you, I experienced the frustrations of the zero size response/blank page several times, each times with a different root cause. I have used several approaches in the past: 1) first make sure the 500 page itself isn't causing the problem. Use a plain JSP instead to see if you still get a blank response. 2) do you have any servlet filter? Make sure to exclude your error pages from being processed by the filters. 4) Increase logging levels for TOMCAT to DEBUG, but be prepared, it generate a LOT of output. 3) As last attach a debugger to the tomcat process and break on any Exception thrown. This can be time consuming since a lot of Exception can be thrown even during normal execution... Sorry if this is so generic... I hope you find a solution to your problem. Florian -Original Message- From: Rob Mercer [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2008 2:13 PM To: Tomcat Users List Subject: RE: Custom Error Messages (5xx and 4xx) Correction, the 404 error pages now seem to work, but the 500 error page is not being produced on an error -Rob -Original Message- From: Rob Mercer [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2008 2:09 PM To: Tomcat Users List Subject: RE: Custom Error Messages (5xx and 4xx) First off, thank you for your responses, I've worked on this a little more and am still have problems getting the error message pages to even appear when the server side error is generated. Below is my web.xml !-- Use Documents saved as *.xhtml for Facelets-- context-param param-namejavax.faces.DEFAULT_SUFFIX/param- name param-value.xhtml/param-value /context-param context-param param-namefacelets.VIEW_MAPPINGS/param-name param-value*.xhtml/param-value /context-param !-- Error configuration -- error-page error-code404/error-code location/error_pages/404.xhtml/location /error-page error-page error-code500/error-code location/error_pages/500.xhtml/location /error-page Please let me know if I missed anything relevant. Currently when an error (500) is generated all I get is a blank white screen :(. I can go directly to the error pages both logged into the system and not and I get the nice little Something has gone wrong .. custom error page that I've setup for this test... Any ideas? -Rob -Original Message- From: Kirchhoff, Florian [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2008 10:20 AM To: Tomcat Users List Subject: RE: Custom Error Messages (5xx and 4xx) Rob, First you need to gather the information about the exception, then send it to who needs to know. You might want to be proactive and send it to the support team regardless of what the users want... One thing to lookout for is that depending on where you exception is thrown the implicit exception variable may not be the one you're looking for and you have to unwind the calling stack to find the root cause. That's what Tomcat's default error page does. I found it instructive to study the source of the ErrorReportValve in subversion: http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/ org/apache/ca talina/valves/ErrorReportValve.java Look into the report method to see how to use exception.getCause() to get to the root cause. I hope you find this useful. Florian -Original Message- From: Serge Fonville [mailto:[EMAIL PROTECTED] Sent: Monday, November 03, 2008 4:44 PM To: Tomcat Users List Subject: Re: Custom Error Messages (5xx and 4xx) Hi, Look at http://java.sun.com/developer/EJTechTips/2003/tt0114.html, especially the text The string isErrorPage=true causes the Web container to define a new implicit variable, exception, that the JSP page can use in scriptlets or in custom tags. For example, the error page for the current example uses the exception object to report the name of the class that caused the exception: Basically when at the top of the jsp you specify isErrorPage=true, you have a variable exception that contains the thrown exception Hope this helps Regards, Serge Fonville On Mon, Nov 3, 2008 at 10:31 PM, Rob Mercer [EMAIL PROTECTED]wrote: Hey all, I'm trying to setup custom error messages in Tomcat 6.0.14. I've got the following entry in web.xml: !-- Error configuration -- error-page error-code404/error-code location/error_pages/404.jsf/location /error-page error-page error-code500/error-code location/error_pages/500.jsf/location /error-page And I've got a much less scary set of pages setup but I was wondering
RE: Custom Error Messages (5xx and 4xx)
Rob, First you need to gather the information about the exception, then send it to who needs to know. You might want to be proactive and send it to the support team regardless of what the users want... One thing to lookout for is that depending on where you exception is thrown the implicit exception variable may not be the one you're looking for and you have to unwind the calling stack to find the root cause. That's what Tomcat's default error page does. I found it instructive to study the source of the ErrorReportValve in subversion: http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/ca talina/valves/ErrorReportValve.java Look into the report method to see how to use exception.getCause() to get to the root cause. I hope you find this useful. Florian -Original Message- From: Serge Fonville [mailto:[EMAIL PROTECTED] Sent: Monday, November 03, 2008 4:44 PM To: Tomcat Users List Subject: Re: Custom Error Messages (5xx and 4xx) Hi, Look at http://java.sun.com/developer/EJTechTips/2003/tt0114.html, especially the text The string isErrorPage=true causes the Web container to define a new implicit variable, exception, that the JSP page can use in scriptlets or in custom tags. For example, the error page for the current example uses the exception object to report the name of the class that caused the exception: Basically when at the top of the jsp you specify isErrorPage=true, you have a variable exception that contains the thrown exception Hope this helps Regards, Serge Fonville On Mon, Nov 3, 2008 at 10:31 PM, Rob Mercer [EMAIL PROTECTED]wrote: Hey all, I'm trying to setup custom error messages in Tomcat 6.0.14. I've got the following entry in web.xml: !-- Error configuration -- error-page error-code404/error-code location/error_pages/404.jsf/location /error-page error-page error-code500/error-code location/error_pages/500.jsf/location /error-page And I've got a much less scary set of pages setup but I was wondering if there was a way to get the stack trace and error message information to shoot to the support team if the user clicked an email the support team about this error message. Any ideas on how I'd go about that? Additionally, is there a way to setup a 5xx page? Just a page that handled all 500 pages? Like a web.xml shorthand? Thanks ahead of time! Rob M This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. - 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: disabling webapps in Tomcat 5.5
To the best of my knowledge I don't think you can pick and choose. But you can stop tomcat from autodeploying apps (see below) and deploy the applications you want using the Manager or the client deployer (http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html). To disable autodeploy, you may want to take a look at: http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html#Deployment%2 0on%20Tomcat%20startup and check your conf/server.xml for the Host element and the autoDeploy and deployOnStartup attributes (http://tomcat.apache.org/tomcat-5.5-doc/config/host.html) to prevent Tomcat from deploying *any* web apps automatically. I hope this helps. Florian -Original Message- From: pedro76 [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 28, 2008 7:58 AM To: users@tomcat.apache.org Subject: disabling webapps in Tomcat 5.5 Hi all. Is there a way to configure my Tomcat 5.5 installation to not deploy some of the applications that lie in the webapps directory? I don't want to touch anything inside those webapps for different reasons. Thanks in advance, R -- View this message in context: http://www.nabble.com/disabling-webapps-in-Tomcat-5.5-tp17511003p1751100 3.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] This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. - 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: web.xml documentation
For Tomcat 5.5, that implements the Servlet 2.4 specifications which you can download at: http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html you're looking for the deployment descriptor sections that describe web.xml. But it's a bit dry (unless you enjoy reading XML schemas). For Tomcat 6.0 that implements the Servlet 2.5 specs: http://jcp.org/aboutJava/communityprocess/mrel/jsr154/index2.html But as Steve says, for the basics you can find something more accessible, this query will return a couple of useful references: http://www.google.com/search?hl=enq=Servlet+Web.xml+tutorial Good luck Florian -Original Message- From: Steve Ochani [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 27, 2008 4:45 PM To: Tomcat Users List Subject: Re: web.xml documentation On 27 May 2008 at 17:24, Marcos Molina wrote: Hi people, Can anyone tell me where can i read something of how web.xml file works ? I try search but not found nothing good. Thanks a lot. It's detailed in the Java Servlet Specification available at www.jcp.org but the basics are in almost any good java servlet tutorial/book. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. - 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: Defining JDBC Data source
Sushil, As it turns out, this is really a Spring question... I encountered a similar problem (see http://preview.tinyurl.com/2gge34) all you need to do is, set the reference-ref property of JndiObjectFactoryBean to true: bean id=the_dataSource class=org.springframework.jndi.JndiObjectFactoryBean property name=jndiName value=myJDBC / property name=resourceRef valuetrue/value /property /bean The explanation can be found in Spring JavaDoc: http://static.springframework.org/spring/docs/2.5.x/api/org/springframew ork/jndi/JndiObjectFactoryBean.html then you should be able to use the same configuration in WL and Tomcat. I hope this helps. Florian -Original Message- From: Sureka, Sushil [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2008 6:33 PM To: Tomcat Users List Subject: Defining JDBC Data source We are trying to port an application from Weblogic to Tomcat. Our JDBC entry looks like this bean id=the_dataSource class=org.springframework.jndi.JndiObjectFactoryBean property name=jndiName value=myJDBC / /bean The weblogic works fine with setup. The jdbc datasource is setup through weblogic console. On Tomcat, we noticed that we would have to modify the above entry like this bean id=the_dataSource class=org.springframework.jndi.JndiObjectFactoryBean property name=jndiName value=java:/comp/env/myJDBC / /bean But the above setup won't work for Weblogic. Any way we can reconcile the difference. The Tomcat context.xml file contains an entry llike Context Resource name=myJDBC auth=container ./ /context Sushil This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JDBC driver JARs in a shared production environment
Hi everybody, Question: if you cannot place the JDBC driver jars in CATALINA_HOME/commons/lib, where can you put them? Here is the context of my question: * A production environment where each application runs in a separate instance of Tomcat * Each application has it's own $CATALINA_BASE and pointing to same $CATALINA_HOME. * OS is RH Red Hat Enterprise Linux 4 * Tomcat 5.5.* is used as bundled by RH. Last but not least: * Deploying the JDCB drivers used by each applications to $CATALINA_HOME/commons/lib is not possible. So my question is, what is the better alternative: 1) Place the JDBC jars in $CATALINA_BASE/jdbc and modify the start-up script to include these jars on the CLASSPATH? 2) Deploy the JDBC jars in the WAR file (e.g. WEB-INF/lib/jdbc) and modify the start-up script to include these jar on the CLASSPATH? 3) Deploy the JDBC jars and commons-dbcp.jar in the WAR in WEB-INF/lib? 4) other? This is a real problem we're faced with and I would really appreciate some input on the best possible alternative. Thanks, Florian This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. - 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: JDBC driver JARs in a shared production environment
jfk, thank you for the feedback. What I found out is that the only way to get the JDBC driver in WEB-INF/lib to be found by the classloader is if you also place a copy of commons-dbcp.jar in your WAR AND you modify your context.xml to include this attribute: factory=org.apache.commons.dbcp.BasicDataSourceFactory I guess this scenario is exactly why the Tomcat dev team has to repackage the DBCP code into naming-factory-dbcp.jar. BTW the RH distribution of Tomcat also omits naming-factory-dbcp.jar, forcing you to use the factory attribute above, even when you don't include commons-dbcp.jar in your WAR. Florian -Original Message- From: Katilie, John [mailto:[EMAIL PROTECTED] Sent: Friday, February 22, 2008 2:20 PM To: Tomcat Users List Subject: RE: JDBC driver JARs in a shared production environment It makes sense to put the JDBC driver jars in the war but I had problems when I had a resource like the following in my context.xml: Resource name=jdbc/database url=jdbc:mysql://localhost:3306/art driverClassName=com.mysql.jdbc.Driver username=art password=art validationQuery=select 1 type=javax.sql.DataSource maxIdle=2 maxWait=5000 maxActive=4 / And doing a JNDI lookup for the Datasource. I ended up getting Class Not Found exceptions until I moved the Jar files into the Common Tomcat Lib directory. This was with Tomcat 6.0.14 and it was about 4-6 months ago. I've never got back into looking at it closer. Just food for thought. jfk -Original Message- From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] Sent: Friday, February 22, 2008 12:30 PM To: Tomcat Users List Subject: RE: JDBC driver JARs in a shared production environment From: Kirchhoff, Florian [mailto:[EMAIL PROTECTED] Subject: JDBC driver JARs in a shared production environment Question: if you cannot place the JDBC driver jars in CATALINA_HOME/commons/lib, where can you put them? 1) Place the JDBC jars in $CATALINA_BASE/jdbc and modify the start-up script to include these jars on the CLASSPATH? 2) Deploy the JDBC jars in the WAR file (e.g. WEB-INF/lib/jdbc) and modify the start-up script to include these jar on the CLASSPATH? NEVER, NEVER, NEVER set CLASSPATH for use with Tomcat. 3) Deploy the JDBC jars and commons-dbcp.jar in the WAR in WEB-INF/lib? Yes. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. - 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: JDBC driver JARs in a shared production environment
Chuck, thank you for your prompt feedback. I have a couple of follow-up questions below: 3) Deploy the JDBC jars and commons-dbcp.jar in the WAR in WEB-INF/lib? Yes. Great, that's what'll do. But is there anything one must be careful about in this case? For example should a particular version of DBCP be used for a given version of Tomcat? Question: if you cannot place the JDBC driver jars in CATALINA_HOME/commons/lib, where can you put them? 1) Place the JDBC jars in $CATALINA_BASE/jdbc and modify the start-up script to include these jars on the CLASSPATH? 2) Deploy the JDBC jars in the WAR file (e.g. WEB-INF/lib/jdbc) and modify the start-up script to include these jar on the CLASSPATH? NEVER, NEVER, NEVER set CLASSPATH for use with Tomcat. Although I know this to be a bad idea; I've seen many post telling users NOT to change the CP, however I want to be able to justify why this shouldn't be done (convince ops folks). Do you know of any documented discussion (the classpath how-to doesn't seem to address this). Thanks, Florian 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] This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. - 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: Multiple instances problem...
Hi Peter, are you making sure to use different ports for each instance for Shutdown, HTTP/HTTPS and AJP? Florian -Original Message- From: Peter Björkman [mailto:[EMAIL PROTECTED] Sent: Sunday, March 11, 2007 6:22 PM To: users@tomcat.apache.org Subject: Multiple instances problem... Hi! I'm setting up an environment where I need a lot of differens web containers running, and part of that is setting up tomcat5.0 to run multiple instances. I tried to find a startup/stop script and this is what I came up with: #!/bin/bash RETVAL=$? # Installation directory export CATALINA_HOME=/app/webcontainers/tomcat50 # Configuration directory export CATALINA_BASE=/etc/webcontainers/tomcat50/dev case $1 in start) if [ -f $CATALINA_HOME/bin/startup.sh ]; then echo $Starting Tomcat /bin/su tomcat $CATALINA_HOME/bin/startup.sh fi ;; stop) if [ -f $CATALINA_HOME/bin/shutdown.sh ]; then echo $Stopping Tomcat /bin/su tomcat $CATALINA_HOME/bin/shutdown.sh fi ;; *) echo $Usage: $0 {start|stop} exit 1 ;; esac exit $RETVAL As you see I have tomcat installed under: export CATALINA_HOME=/app/webcontainers/tomcat50 And the base for this instance is: export CATALINA_BASE=/etc/webcontainers/tomcat50/dev I then want to start a new instance on: export CATALINA_BASE=/etc/webcontainers/tomcat50/live but that won't work, it randomly starts, stopping stops all instances and the general behaviour is strange. Any ideas? Can you point me to a better startup script Regards Peter Björkman PETER BJÖRKMAN - SYSTEM ARCHITECT josh / together is better / www.josh.se sveavagen 59 / 113 59 stockholm / sweden phone +46 (0)8 650 21 07 / mobile +46 (0)709 687 884 ### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. For more information, connect to http://www.f-secure.com/ This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]