• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Apache 2 and Tomcat 7 on Ubuntu 10.04 in VirtualBox 4.06xxx

 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Thanks for looking at this thread.

I am not able to forward requests from Apache2.2.14 to Tomcat7.0.14 using the following browser address:



I am able to invoke the servlet directly from the Tomcat7.0.14 container using the following browser address:



$CATALINA_HOME is /usr/share/tomcat7
$CATALINA_BASE is /var/lib/tomcat7



I have been working on this problem for hours, and I haven't been able to access Tomcat 7 from Apache 2.

Do you have any ideas where I might look to correct this problem?

Thanks,
Harry
 
Harry Henriques
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html for more information.
 
Harry Henriques
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm not really sure if I'm making any progress. I copied my webapplication from /var/lib/tomcat7/webapps to /var/www. I can launch the application from either Apache2.2.14 or from Tomcat7.0.14 with either http://localhost:80/Beer-v1/form.html or http://localhost:8080/Beer-v1/form.html, respectively.

In /var/www/Beer-v1/WEB-INF, I have the web.xml file that defines the servlet:



When I launch the webapplication from Apache2.2.14, I get the following error message:



I have setup httpd.conf
I have setup workers.properties with a worker called ajp13_worker on port 8009
I am using mod_jk.so that was included with apache2 on Ubuntu.

I'm not exactly sure what is going wrong? Any ideas?

Thanks,
Harry Henriques
 
Harry Henriques
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am now able to forward an HTTP/1.1 request from Apache 2.2.14 to Tomcat 7.014 on Ubuntu 10.04 LTS (32-bit) in a VirtualBox 4.0.6r71416 on top of Windows 7 (64-bit):



The DocumentRoot for the default VirtualHost in apache2 is /var/www. In this folder, /var/www/Beer-v1/form.html is the only file (a static HTML page).

It is unnecessary to have WEB-INF/web.xml on the apache2 side.

$TOMCAT_HOME/webapps/Beer-v1/WEB-INF/web.xml is all that is needed to map SelectBeer.do to $TOMCAT_HOME/webapps/Beer-v1/WEB-INF/classes/com/example/web/BeerSelect.class

The following request is forwarded by the mod_jk.so to the tomcat-connector at port 8009 specified in $TOMCAT_HOME/conf/server.xml



I didn't modify $TOMCAT_HOME/conf/server.xml at all.

On the apache2 side, the workers.properties file specifies that worker.ajp13_worker.port=8009

mod_jk.so (1.2.28) is packaged with Apache2.2.14, and is in the /usr/lib/apache2/modules/mod_jk.so folder. I was able to successfully use this binary file without generating my own copy.

I was unable to auto-generate the mod_jk.conf file using the "-jkconf" option at Tomcat 7.0.14 startup. I don't think that it is possible with this version of Tomcat.

I did download tomcat-connectors-1.2.31-src.tar.gz from the tomcat-connectors website. This tarball has a file called httpd-jk.conf that is useful when generating your own mod_jk.conf

apache2 has another example /usr/share/doc/libapache2-mod-jk/httpd_example_apache2.conf

I used both of these examples to implement mod_jk.conf. I put the finished version in /etc/apache2/mods-enabled/mod_jk.conf. This file is Include in /etc/apache2/apache2.conf.

I removed "LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so" from mod_jk.conf. This line is already included in /etc/apache2/mods-enabled/jk.load.

I didn't "Include /usr/lib/apache2/modules/mod_jk.so" in httpd.conf.

I used the apache2 example in /etc/libapache2-mod-jk/workers.properties file. I copied, modified, and saved this file right in this folder.

In a fresh install of apache2, the /etc/apache2/httpd.conf file is empty. I put the following code snippet in this file. This file is Include in /etc/apache2/apache.conf.



There is an entry in /etc/hosts, i.e. 127.0.0.1 localhost.localdomain localhost

ajp13_worker was created in the workers.properties file.

I created a tomcat user in Ubuntu and in the $TOMCAT_HOME directory I executed the following command: sudo chown -R tomcat:tomcat *

This will only work after you create a tomcat user.

I also did this in $CATALINA_HOME.

A useful link is the following: http://www.linuxjournal.com/article/8561

Regards,
Harry Henriques
 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic