• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Apache-Tomcat Integration Problem: only works locally.

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I configured Apache web server and Tomcat to work together. Apache uses port 80; Tomcat uses port 9090. If I use localhost to access the servlet by using http://localhost/myServlet, it works fine. But if I use the domain name like http://www.myDomain.com/myServlet, the servlet does not work. Even if I try on the same local computer. There must be configuration problem. For static pages, http://www.myDomain.com just works fine. By the way I am using a Linsys router, and I have configured the router to enable port 9090.
Thanks for any help.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you getting Apache to forward requests to Tomcat? Are you using mod_jk, Apache conf settings or something else?
 
George Yin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I use mod_jk. I configured it according an internet tutorial. The example servlets works fine.
I tried to add a context node to the Tomcat server.xml file but added it at a wrong place. I deleted the line and restart Tomcat. Now I can not even make the examples to work. I get error similar to "servlet\examples\HelloServletExample not available". Configuring Tomcat is a headache. I am using windows xp.
 
George Yin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The example servlets works fine now. I can access them by http://www.myDomain.com/examples/servlet/HelloWorldExample. by still I can not make my servlet work with a domain name
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll move this to the Apache/Tomcat forum for you, you'll get a better response there.

Dave
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you send us the relevant portions of your httpd.conf, server.xml and workers.properties files?

What is the error you are getting?
 
George Yin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<b>The error message I got is:</b>
HTTP 404 - File not found
Internet Explorer

<b>Portion of the httpd.conf file I added:</b>

Include "C:/Program Files/Apache Group/Tomcat 4.1/conf/auto/mod_jk.conf"
<IfModule !mod_jk.c>
LoadModule jk_module "C:/Program Files/Apache Group/Tomcat 4.1/bin/modules/mod_jk-2.0.42.dll"
</IfModule>

JkWorkersFile "C:/Program Files/Apache Group/Tomcat 4.1/conf/jk/workers.properties"
JkLogFile "C:/Program Files/Apache Group/Tomcat 4.1/logs/mod_jk.log"

JkLogLevel emerg

JkMount /examples ajp13
JkMount /examples/* ajp13

JkMount /webdav ajp13
JkMount /webdav/* ajp13

JkMount /tomcat-docs ajp13
JkMount /tomcat-docs/* ajp13

JkMount /manager ajp13
JkMount /manager/* ajp13

<b>in server.xml, I added this in the <host> node.</b>
<Context path="/praxiswebapp" docBase="praxiswebapp" debug="0" reloadable="true" />

<b>Here is the complete web.xml file which is generated by borland jbuulder</b>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>debugjsp</servlet-name>
<description>Added to compile JSPs with debug info</description>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>classdebuginfo</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet>
<servlet-name>praxisservlet</servlet-name>
<servlet-class>praxistest.PraxisServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>servlet-shtml</servlet-name>
<servlet-class>com.borland.jbuilder.webserverglue.shtml.ShtmlLoaderEcho</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>debugjsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>servlet-shtml</servlet-name>
<url-pattern>*.shtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>praxisservlet</servlet-name>
<url-pattern>/praxisservlet</url-pattern>
</servlet-mapping>
</web-app>
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi George.

I don't know if you figured out your problem, but it looks to me that you need a JKMount for the "praxiswebapp".


I would be nice if there were a little map in the Jakarta documentation that said stuff like that.

For instance, I found out the hard way that you may unexpectedly get Apache trying to send requests via AJP12 to a listener on 8007, it seems to be some sort of hard coded fall back feature of mod_jk.
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that is correct.

You need to add the context path in the httpd.conf.

Either:


This will have to be done for each web application you want handled by Tomcat.
 
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic