You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jed <je...@wunderboy.org> on 2008/04/10 13:16:52 UTC

Tomcat passing requests to cocoon for docroot, but not sub-directories?

Hi All,

I'm a new Cocoon user and I've come across and I'm having a really
bizarre problem at the moment which has stopped my site development in
it's tracks. I originally posted this messge to the Cocoon mailing list but
as seems the problem might be Tomcat related I thought I'd try here too.

I've got Apache/Tomcat/Cocoon set-up and have got the Tomcat and
Cocoon samples running just fine. I've set-up a virtual server with
it's own docroot and made a simple "HelloWorld" servlet and XML/XSLT
test and again, those work both fine.

However, I've now started setting up my pipelines/matchers and a
really strange thing is happening.

As a test, I've put "helloworld.xml" and its associated xsl file in
docroot and set-up a matcher so that and request for /*.jhtml
effectively loads and transforms that file. This works fine. However,
if I then make a subdirectory of docroot and place the same xml/xsl
there and set-up a matcher for that, absolutely nothing happens.
Instead I just get a Tomcat 404 page.

I've been scratching my head over this for a week and what appears to
be the problem is that Tomcat is definately passing requests for
documents in docroot to cocoon but NOT for any sub-directories.

The way I tested was as follows:

Test 1:

Created files:
docroot/helloworld.xml
docroot/helloworld.xsl

Matcher:
<map:match pattern="*.jhtml">
<map:generate src="helloworld.xml"/>
<map:transform src="helloworld.xsl"/>
<map:serialize type="html"/>
</map:match>

Request:
http://test.domain/randomfilename.jhtml

Result:
"Hello World!"

Test 2:

Create files:
docroot/main/helloworld.xml
docroot/main/helloworld.xsl

Matcher:
<map:match pattern="/main/*.jhtml">
<map:generate src="/main/helloworld.xml"/>
<map:transform src="/main/helloworld.xsl"/>
<map:serialize type="html"/>
</map:match>

Request:
http://test.domain/main/randomfilename.jhtml

Result:
Tomcat 404 error message

Test 3:

Remove files:
docroot/helloworld.xml
docroot/helloworld.xsl

Matcher:
<map:match pattern="*.jhtml">
<map:generate src="helloworld.xml"/>
<map:transform src="helloworld.xsl"/>
<map:serialize type="html"/>
</map:match>

Request:
http://test.domain/randomfilename.jhtml

Result:
Coccon 404 error message as defined in <map:handle-errors>

I have DEBUG level set in logkit and watched what was happening when I
made requests. mod_jk was intercepting the request from apache and
matching it with a worker and passing it to Tomcat. For requests for
documents in docroot, Tomcat was passing them to cocoon as the
requests and processing can be seen in the sitemap.log file.

However, when a request is made for a file in a sub-directory of
docroot, there is zero activity in sitemap.log - the request just
never gets there!

I am *completely* baffled. I believe I have the various components
configured correctly but as stated, Tomcat will not pass requests for
sub-dirs to Cocoon.

Can anyone shed any light on this?

- Jed

Heres the pertinent extracts from the various configs:

Apache - http.conf:

<VirtualHost *:80>
DocumentRoot /usr/local/apache/share/saab_current/htdocs/
ServerName test.domain
Options FollowSymLinks +Indexes
<Directory /usr/local/apache/share/htdocs>
Options +Indexes
</Directory>
DirectoryIndex index.jhtml index.html index.xml
JkMount /*.shtml xmlworker
JkMount /main/*.jhtml xmlworker
</VirtualHost>

Tomcat - server.xml
<Engine name="Catalina" defaultHost="test.domain"
cachingAllowed="true" debug="9">
<Host name="test.domain" debug="9" appBase="/usr/local/apache/share/htdocs"
unpackWARs="true" autoDeploy="true" xmlValidation="false"
xmlNamespaceAware="false">
<Context debug="9"
reloadable="true"
path=""
docBase="/usr/local/apache/share/htdocs"
/>
</Host>
</Engine>

Tomcat - workers.properties

# XML worker
worker.xmlworker.port=8009
worker.xmlworker.host=localhost
worker.xmlworker.type=ajp13

Cocoon - sitemap.xmap

<map:match pattern="*.jhtml">
<map:generate src="pageOne.xml"/>
<map:transform src="doc2html.xsl"/>
<map:serialize type="html"/>
</map:match>

<map:match pattern="/main/*.jhtml">
<map:generate src="/main/pageTwo.xml"/>
<map:transform src="/main/doc2html.xsl"/>
<map:serialize type="html"/>
</map:match>

My set-up is:

Fedora Core 6
Apache/2.2.8
mod_jk 1.2.26
Tomcat  5.5.26
Cocoon 2.1.11
Sun JDK 1.6.0_05-b13

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat passing requests to cocoon for docroot, but not sub-directories?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jed,

Jed wrote:
| As a test, I've put "helloworld.xml" and its associated xsl file in
| docroot and set-up a matcher so that and request for /*.jhtml
| effectively loads and transforms that file. This works fine. However,
| if I then make a subdirectory of docroot and place the same xml/xsl
| there and set-up a matcher for that, absolutely nothing happens.
| Instead I just get a Tomcat 404 page.

Note that '*' does not match '/' for Cocoon's matchers. If you want to
match "anything including '/'", you need to use:

<map:match pattern="/**/*.jhtml">

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkf+NQYACgkQ9CaO5/Lv0PBgOACdG44swF6n62EBFxV26lWgJ1EV
kpQAnjszvWbnarNade7w/5/NFyYGPyDZ
=Lj7y
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org