Apache + Tomcat ... some questions
Hi, I have some questions related to Tomcat+Apache: [Platform : Tomcat 4.0.1+mod_webapp+Apache 1.3.22] * Apache handling static contents How can I know if static contents are being served by Apache or Tomcat in my configuration ? I installed my web application under: %TOMCAT_HOME%/webapps/my_application at httpd.conf: DocumentRoot %TOMCAT_HOME%/webapps/my_application ServerName my_virtual_host WebAppConnection warpConnection warp localhost:8008 WebAppDeploy my_application warpConnection / What I believe is that the WebAppDeploy line is telling Apache that Tomcat will handle ALL contents under http://my_virtual_host/ ... or not ? So http://my_virtual_host/my_page.html will be served by Tomcat and not Apache as I wanted. The site is starting with index.jsp so Tomcat should take control starting from the root, buth there are a lot of mixed .html and images. Any ideas on how to configure the site just to take the best from Apache and Tomcat ? * Which are the differences between Warp and AJP connectors ? thanks very much in advance, == Adrian Caneva NEXT TECHNOLOGY SRL La Rioja 26 (T4000ISB) Tucuman Tel/Fax +54 381 4219105 [EMAIL PROTECTED] www.nexttech.com.ar == -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>
RE: Apache/WARP connector/trailing slash
You are right: I'm using webapp as DocumentRoot for that virtual host, so /examples sub physically exist. Thanks for the explanation ! Adrian == Adrian Caneva NEXT TECHNOLOGY SRL La Rioja 26 (T4000ISB) Tucuman Tel/Fax +54 381 4219105 [EMAIL PROTECTED] www.nexttech.com.ar == -Original Message- From: Marc Ostrow [mailto:[EMAIL PROTECTED]] Sent: Lunes, 04 de Febrero de 2002 12:45 p.m. To: Tomcat Users List Subject: RE: Apache/WARP connector/trailing slash That's not necessary Adrian, I bet you have an examples directory in your Apache document root. When I create such a directory, I get the behavior you are talking about. The following most likely happens: 1) Submittal of uri /examples to Apache 2) Apache asks mod_webapp if it will handle this uri 3) mod_webapp declines 4) Apache notices the examples directory in document root and rewrites uri with trailing slash 5) Apache must then ask mod_webapp if it will handle this uri 6) mod_webapp accepts the uri. Adrian, change your WebAppDeploy to use /examples/ and I bet it still works for you. Marc. -Original Message----- From: Adrian Caneva [mailto:[EMAIL PROTECTED]] Sent: Monday, February 04, 2002 9:34 AM To: Tomcat Users List Subject: RE: Apache/WARP connector/trailing slash Hi Marc, I am using : #WebAppDeploy examples warpConnection /examples and it works fine. If as you stated TC is looking for URL "/../", I can only think that it is working because my Apache (1.3.22) is somehow adding the trailing slash when not found. I dont't know if there is a simple configuration in httpd.conf to get this automatic redirection to work or is a 1.3.22 issue. You can can send me your httpd.conf, if you like, and I'll try to find the differences. best regards, ====== Adrian Caneva NEXT TECHNOLOGY SRL La Rioja 26 (T4000ISB) Tucuman Tel/Fax +54 381 4219105 [EMAIL PROTECTED] www.nexttech.com.ar == -Original Message- From: Marc Ostrow [mailto:[EMAIL PROTECTED]] Sent: Domingo, 03 de Febrero de 2002 08:10 p.m. To: Tomcat Users List Subject: Re: Apache/WARP connector/trailing slash I wanted to know the same thing, so I went out and looked at the code base to understand why. USE OF THE FOLLOWING IS AT YOUR OWN RISK. IN NO EVENT SHALL MYSELF AND/OR TWINQUEST LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS INFORMATION/SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Ok, if you do not want to have to supply the trailing slash, you need to keep the following in mind. The webapp module attaches itself to Apache in such a way that Apache asks the webapp module if it will handle or decline a request that Apache receives. For every request that Apache passes on to the webapp module, the webapp module searches its list of applications to see if it will handle the request. The slower this matching process is, the slower Apache becomes. I got this to work using the source distribution webapp-module-1.0.1-tc401-src.tar.gz. Mind you, I'm on Mac OS X, but that shouldn't matter any bit. Take a good look at the wam_match() function in mod_webapp.c found in jakarta-tomcat-connectors/webapp/apache-1.3. You will notice that the requested uri is compared against the WebAppDeploy's request path. Note that when the WebAppDeploy directive is processed, the request path is normalized to begin with '/' and end with '/'. So it doesn't matter whether you have WebAppDeploy examples warpConnection /examples Or WebAppDeploy examples warpConnection /examples/ So if you do not want to have to type the trailing slash, you could modify the wam_match() function to allow this. I didn't spend that much time with this, but it currently SEEMS to be working (I performed hardly any testing!!!) The details of what I changed follow: I changed elem=host->apps; while(elem!=NULL) { appl=(wa_application *)elem->curr; if (strncmp(appl->rpth,r->uri,strlen(appl->rpth))==0) break; appl=NULL; elem=elem->next; } if (appl==NULL) return(DECLINED); to look like this elem=host->apps; while(elem!=NULL) { register int slen; appl=(wa_application *)elem->curr; slen = strlen(appl->rpth); if( strncmp( appl->rpth, r->uri, slen) == 0 ) break; if( slen >= 2 && strncmp( appl->rpth, r->uri, slen - 1 ) == 0 ) break; appl=NULL; elem=elem->next; } if (ap
RE: Apache/WARP connector/trailing slash
Hi Marc, I am using : #WebAppDeploy examples warpConnection /examples and it works fine. If as you stated TC is looking for URL "/../", I can only think that it is working because my Apache (1.3.22) is somehow adding the trailing slash when not found. I dont't know if there is a simple configuration in httpd.conf to get this automatic redirection to work or is a 1.3.22 issue. You can can send me your httpd.conf, if you like, and I'll try to find the differences. best regards, ====== Adrian Caneva NEXT TECHNOLOGY SRL La Rioja 26 (T4000ISB) Tucuman Tel/Fax +54 381 4219105 [EMAIL PROTECTED] www.nexttech.com.ar == -Original Message- From: Marc Ostrow [mailto:[EMAIL PROTECTED]] Sent: Domingo, 03 de Febrero de 2002 08:10 p.m. To: Tomcat Users List Subject: Re: Apache/WARP connector/trailing slash I wanted to know the same thing, so I went out and looked at the code base to understand why. USE OF THE FOLLOWING IS AT YOUR OWN RISK. IN NO EVENT SHALL MYSELF AND/OR TWINQUEST LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS INFORMATION/SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Ok, if you do not want to have to supply the trailing slash, you need to keep the following in mind. The webapp module attaches itself to Apache in such a way that Apache asks the webapp module if it will handle or decline a request that Apache receives. For every request that Apache passes on to the webapp module, the webapp module searches its list of applications to see if it will handle the request. The slower this matching process is, the slower Apache becomes. I got this to work using the source distribution webapp-module-1.0.1-tc401-src.tar.gz. Mind you, I'm on Mac OS X, but that shouldn't matter any bit. Take a good look at the wam_match() function in mod_webapp.c found in jakarta-tomcat-connectors/webapp/apache-1.3. You will notice that the requested uri is compared against the WebAppDeploy's request path. Note that when the WebAppDeploy directive is processed, the request path is normalized to begin with '/' and end with '/'. So it doesn't matter whether you have WebAppDeploy examples warpConnection /examples Or WebAppDeploy examples warpConnection /examples/ So if you do not want to have to type the trailing slash, you could modify the wam_match() function to allow this. I didn't spend that much time with this, but it currently SEEMS to be working (I performed hardly any testing!!!) The details of what I changed follow: I changed elem=host->apps; while(elem!=NULL) { appl=(wa_application *)elem->curr; if (strncmp(appl->rpth,r->uri,strlen(appl->rpth))==0) break; appl=NULL; elem=elem->next; } if (appl==NULL) return(DECLINED); to look like this elem=host->apps; while(elem!=NULL) { register int slen; appl=(wa_application *)elem->curr; slen = strlen(appl->rpth); if( strncmp( appl->rpth, r->uri, slen) == 0 ) break; if( slen >= 2 && strncmp( appl->rpth, r->uri, slen - 1 ) == 0 ) break; appl=NULL; elem=elem->next; } if (appl==NULL) return(DECLINED); -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]> -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>
RE: Apache/WARP connector/trailing slash
maybe ? at httpd.conf DocumentRoot <%TOMCAT_HOME%>/webapps ServerName myhost.acme.com .. WebAppConnection warpConnection warp localhost:8008 WebAppDeploy examples warpConnection /examples at server.xml ... ... adrian ====== Adrian Caneva NEXT TECHNOLOGY SRL La Rioja 26 (T4000ISB) Tucuman Tel/Fax +54 381 4219105 [EMAIL PROTECTED] www.nexttech.com.ar == -Original Message- From: Dave North [mailto:[EMAIL PROTECTED]] Sent: Jueves, 31 de Enero de 2002 02:46 p.m. To: [EMAIL PROTECTED] Subject: Apache/WARP connector/trailing slash OK, I searched the list archive for this but couldn't find a solution. Tomcat 4.0.1 running on RedHat 7.1 Apache 1.3.2 WARP connector How can I setup apache/tomcat/WARP so I don't need the trailing slash? ie. http://myhost.acme.com/examples I'm sure it must be possible but I don't see an obvious way to do it. Cheers Dave Dave North SIGNIANT Inc. Trusted Data Transfer Services www.signiant.com Phone: 613-761-3623 Fax: 613-761-3629 EMail: [EMAIL PROTECTED] -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]> -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>
success story: Tomcat 4.0.1 + Apache 1.3.22 + debian 2.2r3 (i386)
Hi, This is my first post although I've been reading mail archives from the web. I've found some problems installing Tomcat 4.0.1 and getting mod_webapp to work under Apache 1.3.22 at linux Debian i386 platform (some of them are close related to other posts on the list). I wanted to share the solutions I've found. As some of the topics were cross related, I packed them all together: 1.A) standalone Tomcat (JDK Problem) 2.A) mod_webapp (-DEAPI warning) 2.B) mod_webapp ("Premature packet header end" exception error under Tomcat) 2.C) rebuilding mod_webapp ("..Bareword found where operator expected.. ") 3.A) virtual host setting (http://my.doma.in/ -> tomcat webapps) 1) Installing standalone Tomcat 4.0.1 = Documents used -- * RUNNING.txt packed with the binary distribution Previous installations -- * JDK >=1.2 : I downloaded and installed Sun's Java 2 SDK v 1.3.1_02 from java (http://java.sun.com/j2se/1.3/download-linux.html) Problems & Solutions 1.A) JDK problem Problem: error found prevents starting Tomcat [catalina.out:"..error while loading shared libraries: libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory"] This is a problem related to Java 2 SDK 1.3 installation not Tomcat. Solution: checking at /usr/lib on my machine I found: libstdc++-3-libc6.1-2-2.10.0.so (if you don't have any libstdc++ then install it through #apt-get install libstdc++2.10-glibc2.2) then I generated a symbolic link to "libstdc++-libc6.1-1.so.2" #cd /usr/lib #ln -s libstdc++-3-libc6.1-2-2.10.0.so libstdc++-libc6.1-1.so.2 2) Integration between Tomcat 4.0.1 and Apache 1.3.22 = Documents used -- * INSTALL.txt packed with the binary distribution (webapp-module-1.0-tc40.tar.gz) * README.txt packed with the source distribution (webapp-module-1.0.1-tc401-src.tar.gz) Previous installations -- * Apache 1.3.9 from Debian package Problems & Solutions 2.A) mod_webapp 4.0.1 Problem: Warning when starting Apache ["Loaded DSO modules/mod_webapp.so uses plain Apache 1.3 API, this module might crash under EAPI! (please recompile it with -DEAPI)"] Solutions: * Although Sun's documentation says not to worry about , I tried previous 4.0's "mod_webapp-1.0-eapi.so" and the warning was gone but ... check 2.B) * I've updated Apache to 1.3.22 and the warning dissapeared but ... check 2.B) 2.B) mod_webapp 4.0.1 Problem: "Premature packet header end" exception error under Tomcat [apache log under Tomcat "[org.apache.catalina.connector.warp.WarpConnection] Exception on socket java.io.IOException: Premature packet header end"] Solution: I rebuilt from source mod_webapp 4.0.1 and was solved (check 2.C with problems to rebuild) 2.C) rebuilding mod_webapp 4.0.1 Problem: ["make[2]: Entering directory ... ..Bareword found where operator expected at (eval 6) line 1, near ""-DLINUX=22 -DEAPI -DTARGET="apache" (Missing operator before apache?) ... mod_webapp.c:70: wa.h: No such file or directory ... "] Solution: Didn't have time to debug so I copied *.h files to /usr/include/apache-1.3 (the -I path): (wa* include files) cp [..]/webapp-module-1.0.1-tc401/include/* /usr/include/apache-1.3 (apr* include files) #cp -R [..]/webapp-module-1.0.1-tc401/apr/include/* /usr/include/apache-1.3 and I got a fresh Apache 1.3 mod_webapp.so 3) Virtual host setting === Documents used -- * INSTALL.txt packed with webapp binary distribution (webapp-module-1.0-tc40.tar.gz) * server.xml packed with tomcat binary distribution (jakarta-tomcat-4.0.1.tar.gz) * Sun's http://dcb.sun.com/practices/howtos/tomcat_apache.jsp 3.A) Virtual host setting Problem: Wanted to redirect http://my.doma.in/ to tomcat webapps. I couldn't make it with INSTALL.txt and server.xml. Solution: Followed INSTALL.txt instructions to load Apache mod_webapp (LoadModule,AddModule) Then: * Apache settings #/etc/apache/httpd.conf .. #at least one IP for the virtual host NameVirtualHost 192.168.1.2:80 ServerAdmin [EMAIL PROTECTED] DocumentRoot tomcat_instalation_directory/jakarta-tomcat-4.0.1/webapps ServerName my.doma.in ErrorLog /var/log/apache/my.doma.in-error.log CustomLog /var/log/apache/my.doma.in-access.log common WebAppConnection warpConnection warp localhost:8008 WebAppDeploy examples warpConnection /examples * Tomcat settings #tomcat_instalation_directory/jakarta-tomcat-4.0.1/conf/server.xml ... That's all. Once restarted Tomcat and Apache, I could run http://my.doma.in/examples/jsp/num/numguess.jsp Bye, == Adrian Caneva NEXT TECHNOLOGY SRL La Rioja 26 (T4000ISB) T