Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting up Apache and Tomcat

Status
Not open for further replies.

baden

Programmer
Feb 6, 2002
125
US
Hi All...

I'm in the process of building a new test/production server with Apache and Tomcat on Windows2K.

I've got the SSL working with Tomcat, and installed a JDBC realm using PostgreSQL. Works fine (and I'll post stuff on this on the Tomcat board later).

Then I go to install Apache Web Server. Installs fine.

Go to make the connection b/t Apache and Tomcat, doesn't work so fine.

I setup a virtual host (BindAddress * is set), with my system's name, when I type in it redirects to my - fine. But to access any anything on Tomcat I have to type ... and it's flaky.

Even w/o virtual host set it doesn't work.

I've uncommented the AJP stuff in server.xml, installed the mod_webapp.so and dll files... I just can't see what the problem is!

Here are my server.xml and httpd.conf files. The httpd is a little messy right now, ... well, here - can someone please throw me some info?
:(

=========================================================
Httpd.conf
=========================================================
.
.
.
#<IfModule mod_webapp.c>
#
#DocumentRoot &quot;C:/JAVADEV/Apache Group/Apache Tomcat 4.0/&quot;
#DocumentRoot .
#WebAppConnection warpConnection warp localhost:8008
#WebAppDeploy examples warpConnection /examples
#WebAppDeploy root warpConnection /root
#
#WebAppConnection warpConnection warp localhost:8008
#WebAppDeploy examples warpConnection /examples
#WebAppDeploy manager warpConnection /manager
#WebAppDeploy webdav warpConnection /webdav
#WebAppDeploy tomcat-docs warpConnection /tomcat-docs
#</IfModule>
#
# ===== I tried the above configs - didn't work.

.
.
.


# ===================================================
# === Tomcat connector ===
# ===================================================


#
# Setup Apache to direct Servlet & JSP calls

# NameVirtualHost 127.0.0.1:80
#
<VirtualHost 127.0.0.1>
ServerAdmin virtualadmin@virtualhost.com
DocumentRoot &quot;C:/JAVADEV/Apache Group/Apache Tomcat 4.0/&quot;

ServerName localhost
# also tried this with my computer's name

#<IfModule mod_webapp.c>

WebAppConnection warpConnection warp profitma-tuobr3:8008
WebAppDeploy root warpConnection /
WebAppDeploy manager warpConnection /manager
WebAppDeploy examples warpConnection /examples
WebAppDeploy webdav warpConnection /webdav
WebAppDeploy tomcat-docs warpConnection /tomcat-docs

#</ifModule>
ErrorLog logs/warpConnection-error_log.txt
ServerSignature Email
</VirtualHost>




=========================================================
Server.xml
=========================================================
.
.
.

<!-- Define an Apache-Connector Service -->

<Service name=&quot;Tomcat-Apache&quot;>

<Connector className=
&quot;org.apache.catalina.connector.warp.WarpConnector&quot;
port=&quot;8008&quot; minProcessors=&quot;5&quot; maxProcessors=&quot;75&quot;
enableLookups=&quot;true&quot;
acceptCount=&quot;10&quot; debug=&quot;0&quot;/>

<!-- Replace &quot;localhost&quot; with what your Apache &quot;ServerName&quot; is set to -->
<Engine className=
&quot;org.apache.catalina.connector.warp.WarpEngine&quot;
name=&quot;localhost&quot; debug=&quot;0&quot; appBase=&quot;webapps&quot;>

<!-- Global logger unless overridden at lower levels -->
<Logger className= &quot;org.apache.catalina.logger.FileLogger&quot;
prefix=&quot;apache_log.&quot; suffix=&quot;.txt&quot; timestamp=&quot;true&quot;/>

<!-- Because this Realm is here, an instance will be shared globally -->
<Realm className=&quot;org.apache.catalina.realm.MemoryRealm&quot; />

</Engine>

</Service>
 
In addition...

I forgot to add that I'm pretty sure I had this working yesterday, but it's now hard to tell, b/c I don't know if I was looking at cached pages.

When I clear everything out, localhost brings up the Tomcat page, not the Apache index.html.

Sometines get Invalid packet 21 on loading localhost
Going to the examples/servlets page, none of the images show up, browser spinning it's wheels, and on trying to execute a servlet:
WebApp: Error 500
(File: pr_warp.c Line: 438)

Also get an error that &quot;Apache has generated errors and will be closed...&quot;




 
In my experience, I try to keep the following two lines the same:<br><br>ServerName localhost<br>#&nbsp;&nbsp;also tried this with my computer's name<br><br>#&lt;IfModule mod_webapp.c&gt;&nbsp;&nbsp;<br><br>&nbsp;&nbsp;WebAppConnection warpConnection warp profitma-tuobr3:8008<br><br>That means that you have the following:<br>[blockquote]ServerName localhost<br>&nbsp;&nbsp;WebAppConnection warpConnection warp localhost:8008[/blockquote]when you're testing locally or [blockquote]ServerName hostname.com<br>&nbsp;&nbsp;WebAppConnection warpConnection warp hostname.com:8008[/blockquote]when you're putting this up for others. <p>Liam Morley<br><A HREF="mailto:"></A><br>&quot;light the deep, and bring silence to the world.<br>light the world, and bring depth to the silence.&quot;
 
akk, that didn't work so well. [blockquote] isn't the right tag, apparently.. I meant to preview first :eek:) I'm sorry. I'll show that one more time, just for clarity.

for local testing:

Code:
ServerName localhost
  WebAppConnection warpConnection warp localhost:8008


for production work when going public:

Code:
ServerName hostname.com
  WebAppConnection warpConnection warp hostname.com:8008

In addition, &quot;profitma-tuobr3&quot; looks a bit fishy to me. Is that the name of a public server? You need the fully qualified hostname in both places... best of luck :eek:) Liam Morley
lmorley@gdc.wpi.edu
&quot;light the deep, and bring silence to the world.
light the world, and bring depth to the silence.&quot;
 
I seem to have gotten this thing to work, but a few problems still linger...


profitma-tuobr3 is the computer name I am doing this on.

I have made a few changes:

httpd.conf
==========
...
ServerName profitma-tuobr3
...
WebAppConnection warpConnection warp localhost:8008
# WebAppDeploy / warpConnection /ROOT
WebAppInfo /webapp-info
WebAppDeploy examples warpConnection /examples
# WebAppDeploy manager warpConnection /manager
WebAppDeploy webdav warpConnection /webdav
WebAppDeploy tomcat-docs warpConnection /tomcat-docs
ErrorLog logs/warpConnection-error_log.txt
ServerSignature Email

I tried the /ROOT line to try to get the servlet container to work - no good.

If I type I get an error: Not Found - The requested URL /servlet/Servlet2 was not found on this server, but if I type it works. (this is for $CATALINA_HOME/webapps/ROOT/web-inf/classes/Servlet2.class)

Also, I guess you have to add the &quot;/&quot; at the end of any webapps you are trying to load from the URL line, or can this be changed, ie: &quot; doesn't work, but need to add a &quot;/&quot; (examples has an index.html file).

I also commented out the manager deployment. It looks like this has to be called explicitly with port number, and cannot be run as a webapp from Apache. When uncommented, and typing: comes up with the authentication, then a blank directory (there is not $CATALINA_HOME/manager). Doing a /manager/list returns an the following error: (I'M POSTING THIS IN CASE ANYONE ELSE HAS PROBLEMS WITH THIS)

Apache Tomcat/4.0.1 - HTTP Status 500 - Internal Server Error
EXCEPTION
javax.servlet.ServletException: Error allocating a servlet instance
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:619)
...
ROOT CAUSE
java.lang.SecurityException: Servlet of class org.apache.catalina.servlets.ManagerServlet is privileged and cannot be loaded by this web application
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:836)
...


Server.xml
==========

In the <!-- Define an Apache-Connector Service --> section,
I set name=&quot;profitma-tuobr3&quot; and added defaultHost=&quot;profitma-tuobr3&quot;.

I added the JDBC PostgreSQL realm to this section.



So back to the servlets question - why doesn't this work?

I am also writing a Windows install FAQ when this is all working and will post it here.
 
you won't get anything through Warp on profitma-tuobr3 if you have it set to localhost. You'll want to set that to profitma-tuobr3 as well, as in:

WebAppConnection warpConnection warp profitma-tuobr3:8008 Liam Morley
lmorley@gdc.wpi.edu
&quot;light the deep, and bring silence to the world.
light the world, and bring depth to the silence.&quot;
 
I got this to work finally - by using tomcat 4.0.2 and AJP. It won't work with 4.0.1 as the tomcat-ajp.jar in 4.0.1 does not have all the same files in it as the newer version does. I'll post an FAQ on the Windows Apache-AJP-Tomcat install as soon as I successfully test my load-balancing configurations.

Thanks all!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top