Re: RequestDispatcher and [contentType] question...
Yansheng Lin wrote: Hi, You are confused with request and response. The request is shared by the forwarding jsp and the forwarded jsp, not the response(well kind of, but not until it's being generated). You will have to explicitly set the response contentType to utf-8 in the forwarded page. -Yan I see what you mean. How I put it together in my mind--naively I can't say--is that the servlet begins constructing a response buffer to the request and the contentType gets set by res.setContentType(). Shortly following this, the request and response are forwarded for additional processing by a JSP page. Upon which the response buffer is cleared as it has not been committed. Since no attribute to the page directive is provided in the JSP, the default behavior is to set the contentType to text/html;charset=ISO-8859-1. The response returns to the controlling servlet and gets committed to the client, having overwritten the original call to setContentType. Lesson learned: if one forwards control to a JSP page, the page directive must set contentType and/or pageEncoding, either electively or by requirement, otherwise the JSP defaults will supersede any work done prior to the forwarding of the request. Thank you, Yansheng. Tim -Original Message- From: Timothy Stone [mailto:[EMAIL PROTECTED] Sent: April 15, 2004 14:45 To: Tomcat Users List Cc: [EMAIL PROTECTED] Subject: Re: RequestDispatcher and pageEncoding question... Timothy Stone wrote: Timothy Stone wrote: List, A servlet I am debugging and trying to understand sets the response's contentType as follows: response.setContentType( text/html;charset=UTF-8 ); Shortly following the following forward is done: request.getRequestDispatcher( jspPage ).forward( request, response ); response.getWriter().flush(); The JSP forwarded gets the response with the contentType set, but commiting the response seems to reset the contentType to text/html;charset=ISO-8859-1, the default. The JSP in the forward does not set a pageEncoding attribute in the page directive, so I'm pointing the finger there at the moment. Can someone outline what is going on behind the scenes of the requestDispatcher call that would be reseting the response's contentType? From the documentation: ...Uncommitted output in the response buffer is automatically cleared before the forward. So, is the call to response.setContentType() being reset on the forward()? Can anyone elaborate? I see that nearly exactly what I'm experiencing was discussed last year regarding the behavior as seen through Struts. No resolution given. http://marc.theaimsgroup.com/?l=tomcat-userm=106323343414285w=2 I'll continue to watch this new thread for suggestions. Again, with many thanks, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RequestDispatcher and pageEncoding question...
List, A servlet I am debugging and trying to understand sets the response's contentType as follows: response.setContentType( text/html;charset=UTF-8 ); Shortly following the following forward is done: request.getRequestDispatcher( jspPage ).forward( request, response ); response.getWriter().flush(); The JSP forwarded gets the response with the contentType set, but commiting the response seems to reset the contentType to text/html;charset=ISO-8859-1, the default. The JSP in the forward does not set a pageEncoding attribute in the page directive, so I'm pointing the finger there at the moment. Can someone outline what is going on behind the scenes of the requestDispatcher call that would be reseting the response's contentType? Many thanks in advance, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestDispatcher and pageEncoding question...
Timothy Stone wrote: List, A servlet I am debugging and trying to understand sets the response's contentType as follows: response.setContentType( text/html;charset=UTF-8 ); Shortly following the following forward is done: request.getRequestDispatcher( jspPage ).forward( request, response ); response.getWriter().flush(); The JSP forwarded gets the response with the contentType set, but commiting the response seems to reset the contentType to text/html;charset=ISO-8859-1, the default. The JSP in the forward does not set a pageEncoding attribute in the page directive, so I'm pointing the finger there at the moment. Can someone outline what is going on behind the scenes of the requestDispatcher call that would be reseting the response's contentType? From the documentation: ...Uncommitted output in the response buffer is automatically cleared before the forward. So, is the call to response.setContentType() being reset on the forward()? Can anyone elaborate? Again, Many thanks in advance, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestDispatcher and pageEncoding question...
Timothy Stone wrote: Timothy Stone wrote: List, A servlet I am debugging and trying to understand sets the response's contentType as follows: response.setContentType( text/html;charset=UTF-8 ); Shortly following the following forward is done: request.getRequestDispatcher( jspPage ).forward( request, response ); response.getWriter().flush(); The JSP forwarded gets the response with the contentType set, but commiting the response seems to reset the contentType to text/html;charset=ISO-8859-1, the default. The JSP in the forward does not set a pageEncoding attribute in the page directive, so I'm pointing the finger there at the moment. Can someone outline what is going on behind the scenes of the requestDispatcher call that would be reseting the response's contentType? From the documentation: ...Uncommitted output in the response buffer is automatically cleared before the forward. So, is the call to response.setContentType() being reset on the forward()? Can anyone elaborate? I see that nearly exactly what I'm experiencing was discussed last year regarding the behavior as seen through Struts. No resolution given. http://marc.theaimsgroup.com/?l=tomcat-userm=106323343414285w=2 I'll continue to watch this new thread for suggestions. Again, with many thanks, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FAIL - Application at context path /[context] could not be started ???
Yansheng Lin wrote: What's the console output? how far did you get before you encounter that specific error? Sounds to me like a mis-configuration of the context path problem. You sure you have the right deploy descriptor in your war file? well, it some sort of directory problem. damn if I can figure it out. ... 2004-03-03 16:26:21 HTMLManager: list: Listing contexts for virtual host 'localhost' 2004-03-03 16:30:01 HTMLManager: install: Installing web application at '/foo' from 'file:///home/tstone/jwerk/blojsom/war' 2004-03-03 16:30:01 StandardHost[localhost]: Installing web application at context path /foo from URL file:/home/tstone/jwerk/blojsom/war 2004-03-03 16:30:01 StandardContext[/foo]: Resources start failed: java.lang.IllegalArgumentException: Document base /home/tstone/jwerk/blojsom/war does not exist or is not a readable directory at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext. java:193) ... *The very same app runs from /tmp* Any ideas... as I said, I 777 the dev tree, no luck. Many thanks, Tim -Original Message- From: Timothy Stone [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 2:11 PM To: Tomcat Users List Subject: Re: FAIL - Application at context path /[context] could not be started ??? Timothy Stone wrote: List, I did an archive search. Nothing meaningful returned, so I'm posting what must be a regular question. I can get a development tree to install via the Manager interface, but I can't get it started. This seems to be a UNIX problem at the moment. For example on Windoze: Install directory or WAR file located on server Context Path (optional): /foobar XML Configuration file URL: WAR or Directory URL: file:c:/path/to/foobar/dev will load and start. The very same application on Linux/Mac OS X: Install directory or WAR file located on server Context Path (optional): /foobar XML Configuration file URL: WAR or Directory URL: file:/home/user/path/to/foobar/dev will load, but consistently fails to start. The error, not explained in the Manager documentation anywhere BTW : FAIL - Application at context path /foobar could not be started What I can't figure out is this very application will work with the catalina.ant tasks! Windoze or Unix. So the problem seems to be with the HTML interface. So, what's the trick? Anyone? Oh, I did 777 the dev tree. Didn't help. :( Many thanks, Tim No one can field this? Maybe I'm too close. Nothing is working now. Not the ant task not the manager interface. Nothing. The answer is not obvious to me. Nothing seems to be logging anywhere for me to debug it. Many thanks again, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[CLOSED] Re: FAIL - Application at context path /[context] could not be started ???
Timothy Stone wrote: Yansheng Lin wrote: What's the console output? how far did you get before you encounter that specific error? Sounds to me like a mis-configuration of the context path problem. You sure you have the right deploy descriptor in your war file? well, it some sort of directory problem. damn if I can figure it out. ... 2004-03-03 16:26:21 HTMLManager: list: Listing contexts for virtual host 'localhost' 2004-03-03 16:30:01 HTMLManager: install: Installing web application at '/foo' from 'file:///home/tstone/jwerk/blojsom/war' 2004-03-03 16:30:01 StandardHost[localhost]: Installing web application at context path /foo from URL file:/home/tstone/jwerk/blojsom/war 2004-03-03 16:30:01 StandardContext[/foo]: Resources start failed: java.lang.IllegalArgumentException: Document base /home/tstone/jwerk/blojsom/war does not exist or is not a readable directory at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext. java:193) ... *The very same app runs from /tmp* Any ideas... as I said, I 777 the dev tree, no luck. My home directory is correctly set by default to 700. Meaning /home is neither world readable or executable. Opps! Setting /home/tstone to 755 fixed the problem. Doh! But that is not a recommended solution. :D Moving the dev tree somewhere safer for 755. Many thanks again! Thanks for the patience as well. Tim Many thanks, Tim -Original Message- From: Timothy Stone [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 2:11 PM To: Tomcat Users List Subject: Re: FAIL - Application at context path /[context] could not be started ??? Timothy Stone wrote: List, I did an archive search. Nothing meaningful returned, so I'm posting what must be a regular question. I can get a development tree to install via the Manager interface, but I can't get it started. This seems to be a UNIX problem at the moment. For example on Windoze: Install directory or WAR file located on server Context Path (optional): /foobar XML Configuration file URL:WAR or Directory URL: file:c:/path/to/foobar/dev will load and start. The very same application on Linux/Mac OS X: Install directory or WAR file located on server Context Path (optional): /foobarXML Configuration file URL: WAR or Directory URL: file:/home/user/path/to/foobar/dev will load, but consistently fails to start. The error, not explained in the Manager documentation anywhere BTW : FAIL - Application at context path /foobar could not be started What I can't figure out is this very application will work with the catalina.ant tasks! Windoze or Unix. So the problem seems to be with the HTML interface. So, what's the trick? Anyone? Oh, I did 777 the dev tree. Didn't help. :( Many thanks, Tim No one can field this? Maybe I'm too close. Nothing is working now. Not the ant task not the manager interface. Nothing. The answer is not obvious to me. Nothing seems to be logging anywhere for me to debug it. Many thanks again, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FAIL - Application at context path /[context] could not be started ???
List, I did an archive search. Nothing meaningful returned, so I'm posting what must be a regular question. I can get a development tree to install via the Manager interface, but I can't get it started. This seems to be a UNIX problem at the moment. For example on Windoze: Install directory or WAR file located on server Context Path (optional): /foobar XML Configuration file URL: WAR or Directory URL: file:c:/path/to/foobar/dev will load and start. The very same application on Linux/Mac OS X: Install directory or WAR file located on server Context Path (optional): /foobar XML Configuration file URL: WAR or Directory URL: file:/home/user/path/to/foobar/dev will load, but consistently fails to start. The error, not explained in the Manager documentation anywhere BTW : FAIL - Application at context path /foobar could not be started What I can't figure out is this very application will work with the catalina.ant tasks! Windoze or Unix. So the problem seems to be with the HTML interface. So, what's the trick? Anyone? Oh, I did 777 the dev tree. Didn't help. :( Many thanks, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Windows XP, TC 4.1.29 and logging question (catalina.out)...
List, I must be too close to the problem, having a background in managing Tomcat on Linux, I can't seem to figure out what is so drastically different about Tomcat on Windows that logging doesn't behave the same. Specifically: c:\%tomcat_home%\bin\startup.bat runs in a separate window (expected) but only the following logs are being generated: localhost_examples* localhost_admin* localhost_log* 'catalina* is conspicuously missing. However, the Logger is defined in the server.xml file! There is some standard out logging going on, but not to a file. What directive am I missing? The archives didn't seem to answer my question directly. The server.xml file seems to implied that the global logger could be overridden, but I have not explictly stated any such overriding the server.xml is out-of-the-box. Many thanks in advance. Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connecting Tomcat to Apache
Yiannis Mavroukakis wrote: Install the pcre (Perl Compatible Regular Expressions)libs..either via rpm *retch* or download and build the source from sourceforge(http://sourceforge.net/projects/pcre/) Yiannis PCRE should build out of the box in Red Hat 8+. It did on Mac OS X. For Mac OS X, it was as simple as: $./configure --enable-utf8 $make $make install NB: I enabled utf8 for my use, it may not be appropriate for your environment, but I'm using a webapp with very specific support for UTF-8. $ locate pcre will list all of the possible matches for pcre, including the libpcre and libpcreposix libraries that the configure will look for. $ man pcretest AND $ pcretest are also helpful the former providing detailed information about its use (not relevant to this topic, but nice to know) and the latter will output the version installed (my RH8 box has v3.9, the current version is v4.4 | v4.5, the pcre website is not united on this) then drop you into a regex interface. ^C will exit. That said make sure that both libpcre and libpcreposix are available as the configure is going create Makefiles with the flags -lpcre and -lpcreposix. Hope This Helps, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connecting Tomcat to Apache
David Grant wrote: Hello, I am using a preety good but rather old HOWTO and I now need to connect apache to tomcat, so that apache acts as the web server and tomcat handles jsp's and servlets. I've tested it all up to this point and everything is up and running. I am using IBM Java2 1.4.1, tomcat 5.0.16, and apache 2.0+. Can anyone tell me whether some of this functionality is built-in at this point and just needs configuring or can someone recommend a good connector I can download. The old howto I have is recommending mod_jk? The John Turner stuff is always recommended. Also, here's a link for building on Linux from the JTC FAQ. Worked great for me: http://marc.theaimsgroup.com/?l=tomcat-userm=105103815630094w=2 Good Luck, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jk2 for Apache 2.0.43 (and only 2.0.43)
Brennon Obst wrote: Why does it say the following. start This is the 2.0.2 release of JK2 You'll find here binaries for Apache 1.3, 2.0 and IIS. Build under Windows XP, Apache 1.3.27 and 2.0.43, IIS 5.1 * isapi_redirector2.dll is for Microsoft's IIS web server * mod_jk2-1.3.27.dll is for Apache 1.3.x * mod_jk2-1.3.27-jni.dll is for Apache 1.3.x with JNI supported * mod_jk2-2.0.43.dll is for Apache 2.0.43 (and only 2.0.43) end When the main releases for Apache are 2.0.47 and .48 ? The JTC connectors, as I recall (it may have changed), are user contributed. I've often wondered about this myself, the mod_jk2 builds lag several Apache releases behind. Possibly because experience proves out my own and while the statement and only 2.0.43 makes an admin question its use, it acts maybe as a disclaimer. The JTC maintainers may be able to elaborate. My current experience is has been the x.42 builds will work in x.47+ of Apache (I'm using x.42 on my Windoze boxes with success against x.48 of Apache currently). If I had VC++ and some Windoze dev. experience I might try a newer build and submit. But I have neither, the tools or the dev. experience. Is this random or does that mean it wont work for my version of Apache ? Brennon Obst HTH, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: virtual hosting and tomcat wt Apache 2 and JK2
Brennon Obst wrote: Dear usergroup, ... When I activated the apache--tomcat connection it took over ALL of the virtual hosts and was routing them through Tomcat, does anyone know how to stop that? Is it my Apache 2 and JK2 connectors, where do I turn now? Thank you in advance, I saw this link outside the thread. Posted by Frankl Martina. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18472 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Successful build of mod_jk2 on Mac OS X Panther
List, I have successfully built mod_jk2 on Mac OS X Panther (10.3.2). I document my success at: http://forums.serverlogistics.com/viewtopic.php?t=644 *where comments are welcome.* NB: My success in part may be due to using ServerLogistic's Complete Apache 2.0.48 distro, so it is somewhat specific to this Apache build, however, I intend to extend my experience with an Apache build from source on Mac OS X, something that I have done serveral times on Linux. For posterity and convenience, I'm including my notes posted at ServerLogistics here: How did you build mod_jk2 for Mac OS X? I answer my own question but solicit review and feedback as IANAUD (I Am Not A UNIX Developer). I made best guesses about what should be done to fix build errors I encountered from my experiences with building software on Linux. !!! I have not tested this build in a test or production environment very extensively. Make sure you have installed the Developer Tools for Panther. You will find these on the XCode CD. The following guide may require that you have installed Complete Apache 2.0.48 from ServerLogistics. [Complete Apache 2.0.48] http://www.serverlogistics.com/apache2.php#download 1. Download and unpack the JTC source. Where you download it to is not important, but will be referred to later as ${JTC_SRC_ROOT}. Code: % tar xvzf ${JTC_SRC}.tar.gz [JTC_SRC] http://jakarta.apache.org/site/sourceindex.cgi 2. Download and unpack the PERL Compatability Regular Expression Library. Again, I will refer to it as ${PCRE_SRC_ROOT}. I used v4.4. It is stated on the home page (1/7/2004) as the most recent version. However, FTP has a v4.5 available. Code: % tar xvzf ${PCRE_SRC}.tar.gz [PCRE_SRC] http://www.pcre.org/ 3. PCRE builds out-of-the-box on Mac OS X Panther. I built the default configuration save support for UTF-8. Code: % cd ${PCRE_SRC_ROOT} % ./configure --enable-utf8 ... ... % make % make install This installs the pcre libs in /usr/local/lib. One can use the --prefix=[DIR] flag during configure if wanted. ./configure --help explains this and much more. 4. I originally said something about the Apache Portable Runtime. APR is included with Complete Apache 2.0.48. See note above about installing Complete Apache2 before continuing further. 5. Fix ${JTC_SRC_ROOT}/jk/native2/buildconf.sh. Mac OS X does not have the libtoolize tool, but a generic libtoolize. vi/bbedit the first line and replace libtoolize with glibtoolize. Code: % cd ${JTC_SRC_ROOT}/jk/native2 vi buildconf.sh 6. Run the fixed buildconf.sh. Code: % ./buildconf.sh 7. Now you're ready to run the configure script. Code: % ./configure \ --with-apxs2=${APACHE_ROOT}/bin/apxs \ --with-tomcat41=${TOMCAT_ROOT} \ --with-java-home=/Library/Java/Home \ --with-jni \ --with-pcre [from Tomcat User and Jakarta Tip] http://marc.theaimsgroup.com/?l=tomcat-userm=105103815630094w=2 The configure script is going to create a bunch of Makefiles. The Makefiles do not seem to account for the idiosyncroacies of Mac OS X Panther. You have to find references to -lcrypt. The -lcrypt flag is not supported in Mac OS X. These functions are builtin to the OS and found in unistd. [lcrypt flag support notes] http://developer.apple.com/technotes/tn2002/tn2071.html#Section17 Also, configure is going to build a libtool in the current directory, but the Makefiles are going to reference the libtool found in /Library/Apache2. I don't know why. So we need to edit this variable too. 8. Two files are of interest... ${JTC_SRC_ROOT} /jk/native2/server/apache2/Makefile and ${JTC_SRC_ROOT} /jk/native2/server/apache2/Makefile.in. Find the JK_LDFLAGS and remove -lcrypt references. Also replace the LIBTOOL value with LIBTOOL=../../libtool . 9. Now you're ready to make. Code: % cd ${JTC_SRC_ROOT}/jk/native2 % make 10. Hopefully you should have a successful build. 11. At the end of make there is a request that one invoke libtool to finish with: Code: libtool --finish ... This has never work for me so I just manually copy the files. Code: % cp ${JTC_SRC_ROOT}/jk/build/jk2/apache2/mod_jk2.so ${APACHE_ROOT}/modules % cp ${JTC_SRC_ROOT}/jk/build/jk2/apache2/jkjni.so ${TOMCAT_ROOT}/server/lib Double check your module permissions! 12. The rest of the configuration is well documented at Jakarta. I'm very interested in feedback and will attempt to answer questions when possible. Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Building jakarta-tomcat-connectors-jk2-2.0.2-src [HOW?]
Carlos Cajina - Hotmail wrote: Hi everyone. Tryin' to build mod_jk2 for my Slackware box (version 9.1 with reiserfs) I've come to a dead-end, and I would appreciate any help since the documentation I've looked into (including the mailing lists) seems to be out of date regarding the building process for version 2.0.2 of the Jakarta-Tomcat-Connectors. ...snip... This worked like a charm for me... http://marc.theaimsgroup.com/?l=tomcat-userm=105103815630094w=2 Also see Ian Harwood's work: http://marc.theaimsgroup.com/?l=tomcat-userm=107321319222031w=2 I also got it to build on Mac OS X Panther: http://forums.serverlogistics.com/viewtopic.php?t=644 Hope any of these helps. Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache2 + Tomcat4 + mod_jk2 success
...snip instructions... Ian, Thank you! Just want'd to pass along some notes from the field on this: 1. Works on RHL8 (psyche). 2. Config: Binary Tomcat in /usr/local/jakarta-tomcat-4.1.29 Source build of Apache 2.0.48 in /usr/local/httpd-2.0.48 # maybe not the most effective/efficent build invocation $ ./configure \ --prefix=/usr/local/httpd-2.0.48 \ --mandir=/usr/local/man \ --enable-mods-shared=all \ --enable-file_cache=shared \ --enable-cache=shared \ --enable-disk_cache=shared \ --enable-mem_cache=shared \ --enable-deflate=shared \ --enable-ext_filter=shared \ --enable-proxy=shared \ --enable-proxy_connect=shared \ --enable-proxy_ftp=shared \ --enable-proxy_http=shared JTC source in /usr/local/src/jakarta-tomcat-connectors-jk2-2.0.2-src Download at: http://jakarta.apache.org/site/sourceindex.cgi 3. I *did not* have to modify source of jk_channel_socket.c and jk_pool.c as described. Hmmm...may be artifacts of CVS the source? Now, I'll give this a try at home in Mac OS X Panther. But I'm not holding my breath. Having a bitch of a time getting that to work. :) Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to set the user runnig tomcat ? ( + start/stop problem)
Julien, If I can just provide you some feedback, at least if only to let you know that someone is reading and following this thread. :) I'm am trying to do the same, not on Linux but Mac OS X. I'm very interested in this as well. That said, allow me to provide some comments on your post: Julien Oix wrote: I used to run a tomcat 4.1.18 rpm on a linux top box, where I put the TOMCAT_USER variable in a tomcat4.conf file ( nobody user in my case ...) As an RPM, the tomcat4.conf file probably provides variables that are passed to the init.d scripts for startup and shutdown. Now i try to upgrade to 4.1.29 full archive (jakarta-tomcat-4.1.29.tar.gz) and I didn't see any doc's on configuring this variable .. As noted, the tomcat4.conf file is a Linux convention, likely for convenience. This file is not going be in the binary distribution of Tomcat from Jakarta. I would like to request a copy of both the conf file and the init.d script loaded by the RPM. It may provide clues valuable in your quest and my quest on Mac OS X. In Mac OS X, similar to the init.d scripts, a script is placed in a StartupItems folder and executed as root. However, as one might guess, this results in the process being owned by root. I have not found a working method of changing this, including, as you suggest below: Is the only solution to execute the startup.sh script as the running user ? ( the command line under a root session could be : su - nobody -c $CATALINA_HOME/bin/startup.sh ) Thus, the reason I request the conf and init.d script files. Valuable clues may be found in each that could help us both. Another problem: I start tomcat with the method up in the message: [EMAIL PROTECTED] # su - nobody -c $CATALINA_HOME/bin/startup.sh Using CATALINA_BASE: /var/tomcat Using CATALINA_HOME: /var/tomcat Using CATALINA_TMPDIR: /var/tomcat/temp Using JAVA_HOME: /usr/java/java [EMAIL PROTECTED] # ps -aux -- gives the process ran by nobody ... [EMAIL PROTECTED] # su - nobody -c $CATALINA_HOME/bin/shutdown.sh Using CATALINA_BASE: /var/tomcat Using CATALINA_HOME: /var/tomcat Using CATALINA_TMPDIR: /var/tomcat/temp Using JAVA_HOME: /usr/java/java Catalina.stop: java.net.ConnectException: Connection refused java.net.ConnectException: Connection refused ...snip stacktrace... And the tomcat processes are always running ... Any ideas ? ( i added the correct env in /etc/profile for every user) I'm not sure why you would not be able to stop the process as started. Hmmm... Look forward to hearing from you and others. Warmest Regards, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Starting Tomcat as nobody...
On Nov 21, 2003, at 9:42 PM, Timothy Stone wrote: Now, how do I start Tomcat as said user? It seems defeatist, at best, to have to login as root to start Tomcat. If I set permissions say 750 (rwxr-x---, this permission is shown in the aforemention Mac OS X directory listing) when I login as a administrative user... % sudo -u nobody /path/to/startup.sh This seems to work. Pros, Cons? Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Starting Tomcat as nobody...
I have been devouring /Tomcat: TDG/ by Brittain and Darwin. I have regularly been using Tomcat for years, but some of security tips found in this book are valuable gems indeed. One such as installing Tomcat as a low- or non-privileged user like nobody. I know about the nobody user, starting Apache in this fashion however is handled for by the binary, first as root to bind to port 80, then as nobody for requests. (I'm aware of the work going on with commons-daemon, it is covered in TC:TDG. However, I'm more focused on getting a binary install of Tomcat running as nobody.) Specifically I'll quote the book here... First, switch to the user that you'd like to run Tomcat as. This will ensure that all of Tomcat's files will start out with the correct Unix file permissions. For security reasons, you sohuld probably run Tomcat as the nobody user or create a new tomcat user with similarly low privileges. We suggest settin that user's login shell to /bin/false and locking the user's password so that it can't be guessed. Later, under notes on installing on Mac OS X, the authors offer a directory listing showing a Tomcat install under the nobody user. Okay, so I know the su - [username] -s [shell] command. But how do I log in as a user without knowing, or the user having, a password? My best first guess is, su as root then: % su Password: #su -m nobody -s /bin/bash Thoughts? Okay, say the above is legit and Tomcat installed (tar -zvfx ...) as said user. Now, how do I start Tomcat as said user? It seems defeatist, at best, to have to login as root to start Tomcat. If I set permissions say 750 (rwxr-x---, this permission is shown in the aforemention Mac OS X directory listing) when I login as a administrative user... I'm doing development here, so maybe this is overkill, but developing closer to the production environment could be argued as a good thing. Much thanks in advance for answers and thoughts, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: mod_jk2, load balancing and TC:TDC
-Original Message- From: Timothy Stone [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2003 5:45 PM To: [EMAIL PROTECTED] Subject: mod_jk2, load balancing and TC:TDC What's not clear in the book, or the documentation, is if mod_jk2 on a given httpd instance autodiscovers other tomcat? The workers2.properties file given is not clear either. I think it's implied, but poorly. Is this a black mark on an otherwise great book? Possibly. I think what is being unsaid, is that both HTTPD's workers2.properties files provide tomcatIds that point to the jvmRoutes of the respective tomcat. Can anyone clarify? The book otherwise teases me as I have a production environment that could greatly benefit from upgrading to mod_jk2 v. mod_jk and the topology outlined in the book /TC:TDC/. Ralph Einfeldt wrote: httpd instance doesn't autodiscover the other tomcat, you have to configure it. I would suggest the following: - define distinct propertie fieles for each mod_jk - define 2 workers for each mod_jk - each worker points to one tomcat - set the lbFactor for worker1 to 0 for one mod_jk - set the lbFactor for worker2 to 0 for the other mod_jk - define a unique jvmRout for each tomcat (engine element in server.xml) One additional recommendation: First setup one apache with two tomcats and loadbalancing: http://www.ubeans.com/tomcat/ http://raibledesigns.com/tomcat/index.html (An updated version of the first link for the apache 2) If that works, try to setup the second apache. BTW: In this case it doesn't matter if you use mod_jk or mod_jk2, both are capable of doing this kind of loadbalancing. Ralph, thank you. I have a working production environment using the UBeans tutorial. But I think I was looking to update its design a bit. If I have the following servers, REED and DOUTRICH, then I need to *update* my worker.properties file as such: #-- # Tomcat Server One: REED #-- worker.TomcatREED.port=8009 worker.TomcatREED.host=10.102.1.4 worker.TomcatREED.type=ajp13 # Specify the load balance factor when used with # a load balancing worker # Note: # lbfactor must be 0 # Low lbfactor means less work done by the worker. worker.TomcatREED.lbfactor=100 #-- # Tomcat Server Two: DOUTRICH #-- worker.TomcatDOUTRICH.port=8009 worker.TomcatDOUTRICH.host=10.102.1.5 worker.TomcatDOUTRICH.type=ajp13 worker.TomcatDOUTRICH.lbfactor=100 I think I had questions about the use of port and host properties. But your suggestions seem to validate what I was thinking needed to be done. Since the loadbalanced Tomcats are on distinct servers I can use 8009 on DOUTRICH and 8009 on REED. I have to make sure that my host properties is distinct! (I would likely change them for distinguishing reasons however.) I could drop this config (with a little more detail into each apache (one on REED and one on DOUTRICH) and the tomcats would find each other. This would elimate the a point of failure I now have on each Apache server. * What I have right now is two (2) environments of the UBeans model. Imagine if you will: For those without the book, here's the ASCII: +--+ +---| tc0a | + +--++ |+--+ /\-- + +| ||--+ --\+ | +httpd0+-mjk+ |+--+ / Internet /---+---++---| tc0b | \__ -- + | +--+ \/ + | + | +--+ + |+---| tc1a | + | +--++ |+--+ + +| ||--+ + +httpd1+-mjk+ |+--+ +---| tc1b | +--+ point of failure...^ If both tomcats on httpd1 go down...opps! no failover to httpd0+mjk Thanks again Ralph. Comments are welcome. Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
mod_jk2, load balancing and TC:TDC
List, O'Reilly's new /Tomcat:The Definitive Guide/ is worth the purchase. But something seems a miss in the chapter on load balancing Tomcats with mod_jk2. I want to provide load balancing and failover as illustrated in the book (pg. 237, fig. 10-2). For those without the book, here's the ASCII: + +--++ +--+ /\-- + +| ||-| | --\ + | +--++ +--+ / Internet /-+-+ httpd0 mjk2 . .^ tc0 \__ -- + | . . \/ + |. + | . . + | . . + | +--++ +--+ + +| ||-| | + +--++ +--+ httpd1 mjk2 tc1 What's not clear in the book, or the documentation, is if mod_jk2 on a given httpd instance autodiscovers other tomcat? The workers2.properties file given is not clear either. I think it's implied, but poorly. Is this a black mark on an otherwise great book? Possibly. I think what is being unsaid, is that both HTTPD's workers2.properties files provide tomcatIds that point to the jvmRoutes of the respective tomcat. Can anyone clarify? The book otherwise teases me as I have a production environment that could greatly benefit from upgrading to mod_jk2 v. mod_jk and the topology outlined in the book /TC:TDC/. Thanks in advance to all! Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] how to pronounce Apache ?
John Turner wrote: Sheesh...that wasn't the poster's point. The point was: the pronunciation is the same as the pronunciation of Apache when the context is a Native American people. John [EMAIL PROTECTED] wrote: Apache has NOTHING to do with indigenous American people. It stands for a patchy software. Let's set the record straight here and turn to the source for information, the Apache Software Foundation (ASF). ASF states that the Apache webserver is indeed, first and foremost, named out of respect for indigenous American people: http://httpd.apache.org/docs/misc/FAQ.html#name The name 'Apache' was chosen from respect for the Native American Indian tribe of Apache (Indé), well-known for their superior skills in warfare strategy and their inexhaustible endurance. For more information on the Apache Nation, we suggest searching Google, Northernlight, or AllTheWeb. Secondarily, and more popularly (though incorrectly) accepted, it's a considered cute name which stuck. Apache is 'A PAtCHy server'. It was based on some existing code and a series of 'patch files'. Check your sources folks. While the more popular A PAtCHy server is legendary, it is incorrectly attributed as the reason for the server's name. And in closing John is right, I don't think that the original poster was looking for a thread on the geneology of the name given to the leading HTTPD server, but for the correct pronunciation. M-W.com has the following: -'pa-chE For more information on pronunciation, see http://www.m-w.com/pronguid2.htm Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] how to pronounce Apache ?
Madere, Colin wrote: Anyone smell revisionist history? :P Who's revising history? I first heard the A PAtCHy server story in a course on implementing web security. I found it humorous, but recall thinking at the time that I had read elsewhere that it was definitively named for the native American people. (A PAtCHy server does not account for the feather, a traditional, albeit stereotyping, symbol of Native Americans.) Thus I'm inclined to believe the ASF story at face rather than ascribe conspiracy theories to it. I think it's clearly stated on the Apache website that A PAtCHy server is incorrectly, however popularly, attributed as the reason for the name. I can't imagine that ASF is revising their own history. I would like to point out that the ASF makes no mention of the name's origin in the official history of Apache (http://httpd.apache.org/ABOUT_APACHE.html), though a number of references to patches are made. Anyway, isn't this a topic for the Apache Users List? :P - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Alternatives to DBCP
[EMAIL PROTECTED] wrote: Has anyone used any alternatives to the DBCP with Tomcat because it seems to get worse and worse as I use it more. Pete, Are you asking if there are other connection pool managers other than DBCP? Yes. Many. Unfortunately, I can only name a couple off the top of my head: www.javaexchange.com has one (a David Flanagan, author of /Java Enterprise in a Nutshell/, recommendation) called DbConnectionBroker. Also be sure to check the vendor of your database. They may have one. Finally, if you want some code to play with, hack and improve, try looking at Marty Hall's connection pool examples from /Core Servlets and JavaServer Pages/ (www.coreservlets.com) -- Chapter 18. His code is free for unrestricted use and improvement. It's a great example, and as I recall, has room for optimization. There are many more I'm sure. I recently participated in a code review of a complex webapp that used something called Poolman. I didn't have to look at it much so I don't know where you can find it, if it's open-source, or other; try Google. HTH, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestDispatcher anomolies (Tomcat v4.1.24)
This issue is archived at: http://marc.theaimsgroup.com/?l=tomcat-userm=105578975520239w=2 Timothy Stone wrote: I have to say, the behavior seems almost identical to the described behavior of RequestDispatcher#include since control is given back to the forwarding servlet. The subtle differences are to explored further on this end. Thank you Yoav and Tim. Well, my further exploration proved fruitful. I went home and picked up my copy of /Codenotes for J2EE/. Excellent resource BTW. It noted, as both Tim and Yoav caught, that when RequestDispatcher#forward is part of an executing method in the caller, control is indeed returned! D'oh! CNJ2EE offered two workarounds: One: as noted, return explicitly from the executing method OR Two: explictly use out.close() in the called resource. (not useful when the called resource is static HTML with a JSP extension to support HTTP POST I guess) As in all the earlier notes I had run across, and the source of my confusion, RequestDispatcher#forward is stated as passing control *permanently* to the called resource. The use of permanently may not be best. It brings to mind Vizzini's use of inconceivable and Inigo Montoya's observation: You keep using that word. I do not think it means what you think it means.* :) Tim * /The Princess Bride/ (what a great movie!) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RequestDispatcher anomolies (Tomcat v4.1.24)
List, I'm having some trouble with using a RequestDispatcher, it works and doesn't work. #doPost( req, res ) ... 50 Customer customer = 51 Customer.findCustomer( emailAddress, custData); 52 53 if(( customer == null ) || 54( password == null ) || 55( !password.equals( customer.getPassword() ))) { 56System.out.println( one ); 57gotoPage( /move/accounts.jsp, request, response ); 58System.out.println( four ); 59 } 60 61 customer.setStartDate( request.getParameter( startDate ) ); ... 69 // branching code for other forwards 70 HttpSession session = request.getSession( true ); 71 72 session.setAttribute( customer, customer ); 73 if( request.getParameter( rooms ) != null ) { 74 gotoPage( /move/roomCount.jsp, request, response ); 75 } else if( request.getParameter( floors ) != null ) { 76 gotoPage( /move/floorCount.jsp, request, response ); 77 } ... #gotoPage( url, req, res ) private void gotoPage( String address, HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { RequestDispatcher dispatcher = getServletContext().getRequestDispatcher( address ); System.out.println( two ); dispatcher.forward( request, response ); System.out.println( three ); } Basically, the idea is if the user forgets to enter a username or password, the servlet should forward--via gotoPage( url, req, res )-- to accounts.jsp. This blows up with a NPE at line 61 everytime (the lookup for the customer returns null, so the NPE is expected). Looking at standard out I see: one two three four This shows that the test for null passed and the call to gotoPage worked as expected but passed through and continued to process the page, null reference be damned. Yet, if the user correctly completes the form, all is fine and the dispatcher created in gotoPage works as expected. Standard out looks like: one two What am I doing wrong that the dispatcher does not like in the first instance? /travel/accounts.jsp is available. TIA, Tim PS: for those paying attention this code is loosely based on work by Marty Hall in /More Servlets and JavaServer Pages/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestDispatcher anomolies (Tomcat v4.1.24)
Tim Funk wrote: It should blow up at line 61. customer is null. Add a line 57.5: return; -Tim I know it's null :) That's the idea of checking to see if the customer or the password on the request is null, or if the password is incorrect. Forward the user to the /move/accounts.jsp. The forward is not working. Was that not clear in the code snippet? If so, my bad. I'll correct ond post again. -Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestDispatcher anomolies (Tomcat v4.1.24)
Shapira, Yoav wrote: Howdy, The return; that Tim added is just as important as the null check... Yoav Shapira Millennium ChemInformatics Tim Funk wrote: It should blow up at line 61. customer is null. Add a line 57.5: return; -Tim I guess that the way I understood forward( req, res) was that control would be transfered to the resource named in the constructor. Control, I take to mean, it is not complete and processing will continue in the original servlet if necessary. Please elaborate. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestDispatcher anomolies (Tomcat v4.1.24)
Shapira, Yoav wrote: Howdy, I'm attaching a .zip file containing a .war that should help you convince yourself. I'd attach the .war or the source files directly but the listserv doesn't like that. Note the Servlet Specification, v2.3, does not mention whether/when method the method should return control after RequestDispatcher#forward calls. That's why pages like this: http://www.wdvl.com/Authoring/Java/Servlets/request.html that say Any code written in our DispatcherTest servlet after rd.forward(request, response); will not execute as the request is already forwarded are not always to be trusted. Thank you for the link and the test code. Adding a return indeed fixed the problem. My trust in the behavior described in the examples seen in both text and web resources was a little to much. I have to say, the behavior seems almost identical to the described behavior of RequestDispatcher#include since control is given back to the forwarding servlet. The subtle differences are to explored further on this end. Thank you Yoav and Tim. Regards, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
getResourceAsStream and relative paths in web.xml
List, I'm following a twist on some advice that I got from Yoav Shapira. But in playing to learn more I ran across something that I have not been able to solve from reading the documentation. I want to put the relative path to a user=password property file in the web.xml. Given: #web.xml ... servlet servlet-nameProtectedPage/servlet-name servlet-classcoreservlets.ProtectedPage/servlet-class init-param param-namepasswordFile/param-name param-value/WEB-INF/lib/passwords.properties/param-value !-- want to avoid making this absolute to the file system. i.e. c:\path\to\file; naturally this is ugly and not portable. -- /init-param /servlet ... So I got this to work: ... public void init(ServletConfig config) throws ServletException { super.init(config); try { this.passwordFile = config.getInitParameter( passwordFile ); this.passwords = new Properties(); passwords.load( config.getServletContext() .getResourceAsStream( passwordFile ) ); } catch( IOException ioe ) {} } ... *But* this did not work, which I guess is a relative issue: ... public void init(ServletConfig config) throws ServletException { super.init(config); try { this.passwordFile = config.getInitParameter( passwordFile ); this.passwords = new Properties(); passwords.load( new FileInputStream( passwordFile ); } catch( IOException ioe ) {} } ... Can someone summarize why the second example does not work with relative paths? I understand why the first one does. TIA Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getResourceAsStream and relative paths in web.xml
1. Certainly, using a FileXXX class will attempt to interpret the init parameter value (/WEB-INF...) is an absolute path, because that's how absolute paths are defined for files. Thank you again Yoav. The recommendation then is to skip trying to use a FileInputStream (because the String provided is absolute to the file system not servlet context, i.e. /WEB-INF/lib/x.props is intepreted as from root on *NIX and C:\ on Windoze). Additionally config.getServletContext().getResourceAsStream( file ) works in and out of war packages. Thank you again, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
CATALINA_BASE --help
Gurus, I'm trying to get a better understanding of the CATALINA_BASE variable. Here is my dilemma (with ASCII art): I have a load balanced Tomcat (v4.0.6) configuration on Win2k using mod_jk + Apache 2. It's all working in a production environment. However, on occassion, about once a month, I have to update a JSP page (don't ask). I have to do this twice...once for each Tomcat instance's webapp. It dawned on me the other day when R'ingTFM that CATALINA_BASE may have been designed for exactly this reason. But the configuration text is confusing. So, do I elect one instance as the master, the other slave? Using CATALINA_BASE set to the master's otherwise CATALINA_HOME? The directory hierarchy then might look something like: /---+ | +tomcatMaster/ || |+webapps/ || |+myWebApp/ | +tomcatSlave/ | +webapps/ | +...otherwise.empty... ## somewhere in Windoze or Linux # setenv CATALINA_BASE /tomcatMaster ## Is this the correct understanding and use? Thank you. Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
jdbc:odbc bridge and CSV/Excel
I've used the jdbc:odbc bridge for Access. Is it possible to do the same with comma-seperated text files and excel documents? The details I'll work out. For a simple web page. nothing exciting or robust. just need to do something quick and dirty with some exported data. Thanks, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] jdbc connections open?
I'm debugging an web app that seems to hang after three to four logins are initiated. One possible item to look at is the number of open connections to the MySQL database. The app was built around a number of Jakarta technologies about 8 months ago. What's the quickest way to check the number of open connections in MySQL? Thanks, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
placement of properties files
Q: where is the proper place for [props].properties files? such as something that might store username and password pairs. Not the best practice, but if one wanted to. Thanks, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: placement of properties files
Shapira, Yoav wrote: Howdy, I agree with under WEB-INF as that's a directory the servlet container will protect for you. I don't like to put configuration information on the classpath however. I prefer to access them via other mechanisms, such as the ServletContext. So I would create a directory called config under WEB-INF, put the file (say a.props) there, and access it via InputStream is = ServletContext.getResourceAsStream(/WEB-INF/config/a.props); Yoav Shapira Millennium ChemInformatics Good options all. I was leaning towards /WEB-INF/. I like Yoav's suggestion for the more pure organizational aspect. However, could one also just: InputStream is = ServletContext.getResourceAsStream( /WEB-INF/a.props); ? Tim -Original Message- From: Raible, Matt [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 28, 2003 9:02 AM To: 'Tomcat Users List' Subject: RE: placement of properties files I'd recommend WEB-INF/classes - then it's in the classpath. -Original Message- From: Schwartz, David (CHR) [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 28, 2003 6:57 AM To: 'Tomcat Users List' Subject: RE: placement of properties files I think web-inf folder - since tomcat wont serve files contained Q: where is the proper place for [props].properties files? such as something that might store username and password pairs. Not the best practice, but if one wanted to. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]