You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Rob S." <rs...@home.com> on 2000/06/24 11:55:58 UTC

httpd.conf & server.xml question

Hiya,

I have a pretty simple setup, but after 4 hours of reading FAQs, Gal's
minimal guide, jGuru FAQs, and more FAQs, and of course tampering with
files, I'm calling it a night =)  I want all requests that aren't JSP to be
served by Apache, o/w let Tomcat handle it.

So here's what I have in my server.xml:

<Context path="/" docBase="/documentRootDir" debug="0" reloadable="true" />

In my httpd.conf:

<VirtualHost a.b.c.d>
ServerName xxxx
DocumentRoot /documentRootDir
ApJServMount / ajpv12://localhost:8007/
</VirtualHost>

So when people come to http://xxxx/ i want them to get my index.html file.
However, all I've been getting is either the default Tomcat page, or a
NullPointerException w/trace:

java.lang.NullPointerException:
	at java.util.Hashtable.get(Hashtable.java:317)
	at
org.apache.tomcat.request.SimpleMapper.getPathMatch(SimpleMapper.java:352)
[snip!]

I imagine it that YYYY is required, i.e.

ApJServMount / ajpv12://localhost:8007/YYYY

...and a corresponding

<Context path="/YYYY" docBase="/documentRootDir" debug="0" reloadable="true"
/>

But that just takes me to the default tomcat page when I go to http://xxxx/.

Help!  Thanks in advance, of course =)

- Robert Slifka


Tomcat 3.2dev - WAS RE: conf & xml question

Posted by "Rob S." <rs...@home.com>.
Holy funkasaurus!  Tomcat 3.2 is rocking my world in wild and wonderful
ways.  It's given me a new outlook on life, and has taught me to love again.

+ A more well-documented server.xml with <Host> (!!!).
+ Cooler logging.

I'm psyched!  The default context works now.  I suppose that was a bug in
3.1, because the new server.xml uses identical syntax that caused the 500s I
was getting.

The only "problem" I have now is that now I'm getting directory
indicies(ugh, sp) when in Apache, I've turned them off inside my VHost.  I
guess this makes sense if the request is passed to Tomcat before Apache can
bring down the hammer?  Any ideas?  TIA!

<VirtualHost X>
        ServerName X
        DocumentRoot /users/myApp/docBase
        ErrorLog /users/myApp/error_log_apache
        CustomLog /users/myApp/access_log_apache common
        ApJServMount / /

        <Directory /users/myApp/docBase>
                Options -Indexes
        </Directory>

        <Location /WEB-INF/ >
                AllowOverride None
                deny from all
        </Location>
</VirtualHost>

- r


RE: httpd.conf & server.xml question

Posted by "Rob S." <rs...@home.com>.
Ahhhh ok...  hit me with the silly stick.  Combed through my personal
archives and the message with the subject:  "HELP: GETTING DESPERATE:
Virtual Hosting and Static Files: How?" clued me in =)  My app is all JSPs
anyways, so having

ApJServMount / ajpv12://localhost:8007/myApp

and

<Context path="/myApp" docBase="/path/to/root" debug="0" reloadable="true"
/>

...should be cool, according to some previous messages.  Now I was under the
impression that:

ApJServMount /XXXX ajpv12://localhost:8007/YYYY

meant, "for all requests under XXXX, give them to the Tomcat context YYYY" ?

So, here's what I tested in httpd.conf with the above Context as-is.
Hopefully these are all correct results, and other newbies can learn from
them as well =)  I am hoping that someone will take the time to explain the
more confusing ones, as I still am not at my goal: have all requests to
http://vhost/ given to the myApp context.

INPUT: ApJServMount /myApp ajpv12://localhost:8007/myApp
URL  : http://vhost/myApp/
OUTPT: Correct index.html from my docBase.
URL  : http://vhost/
OUTPT: Homepage for HTTPD.  This is expected because I've defined no
DocumentRoot and the mount point is on a lower path.

INPUT: ApJServMount / ajpv12://localhost:8007/myApp
URL  : http://vhost/myApp/
OUTPT: Correct index.html from my docBase.  I can understand why this is
happening in lieu of the next result.  I seem to be at the root of tomcat
and i'm specifying one of its contexts.
URL  : http://vhost/
OUTPT: Default Tomcat homepage.  From what I've inferred from Gal's guide,
this should be handled by the "/myApp" context, and I should see the
homepage in my docBase.  This has been my stopping point for about a day now
=)  It seems intuitive, yet it doesn't work.

INPUT: ApJServMount /myApp ajpv12://localhost:8007/
URL  : http://vhost/myApp/
OUTPT: 500 with the following stack trace:

		NullPointerException java.lang.NullPointerException:
			at java.util.Hashtable.get(Hashtable.java:317)
			at
org.apache.tomcat.request.SimpleMapper.getPathMatch(SimpleMapper.java:352)

URL  : http://vhost/
OUTPT: Homepage for HTTPD.  This is expected because I've defined no
DocumentRoot and the mount point is on a lower path.

Again, TIA for any time & help! ;)

- r


RE: httpd.conf & server.xml question

Posted by "Rob S." <rs...@home.com>.
Sorry to reply to my own email, but I've been doing this all morning =)

<Context path="/" docBase="/path/to/root" debug="0" reloadable="true" />

> java.lang.NullPointerException:
> 	at java.util.Hashtable.get(Hashtable.java:317)
> 	at
> org.apache.tomcat.request.SimpleMapper.getPathMatch(SimpleMapper.java:352)
> [snip!]

In my tomcat.log (with the above Context in server.xml) here's the line I
get on startup:
--> Context log: path="" Adding context path=""  docBase="/path/to/root"
and during shutdown...
--> Context log: path="" Removing sessions from Ctx(,/path/to/root)

Citing Craig's app guide re: <Context>  "path. The context path for your
application, which is the prefix of a request URI that tells Tomcat which
application should be used to process this request. For example, if you set
your path to "/catalog", any request URI beginning with "/catalog" will be
processed by this application. This attribute is requrired, and must start
with a slash ('/') character."

The following questions are what a Joe Six Pack like myself asks himself
when he reads this passage:  I desire only JSP requests sent to Tomcat, not
everything under a certain dir.  How do I say this, but at the same register
w/Tomcat?  If the attribute is required, how does Tomcat report that it is
empty in its log files and not issue any warnings?

I have a number of archived emails from this list on this topic since I've
subscribed to, but everyone seems to use paths to their app, and not the
root.

Am I barking up the wrong tree here?  TIA! =)

- r