You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by sm...@cc.hut.fi on 2009/06/23 09:02:39 UTC

Question concerning application paths

Hey all.

I have a an application where other people can deploy their own  
applications. I would like all the applications to use a common  
library. However, when I add some common JARs to a shared libarary I'm  
having some path trouble.

I have a xml file in each application which have paths to my DTD  
files. The problem is that Tomcat tries to look for these files under  
"tomcat/bin/", not from "tomcat/webapps/appName/".

Example:

In my XML file at "tomcat/webapps/appName/myXML.xml" I have the  
following path: "WEB-INF/dtd/someDTD.dtd". I'm using XSLT to transform  
some XML files and Tomcat always tries to look this "someDTD.dtd"  
under "tomcat/bin/". Naturally the file is not there so I get an error.

How could I make Tomcat to look for the files under  
"tomcat/webapp/appName/" , not under "tomcat/bin/"?

Thanks for any help!


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


Re: Question concerning application paths

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

To whom it may concern,

On 6/23/2009 3:02 AM, smonte@cc.hut.fi wrote:
> I have a an application where other people can deploy their own
> applications. I would like all the applications to use a common library.
> However, when I add some common JARs to a shared [library] I'm having
> some path trouble.

Where are you putting your JAR files? What version of Tomcat are you
running?

> In my XML file at "tomcat/webapps/appName/myXML.xml" I have the
> following path: "WEB-INF/dtd/someDTD.dtd".

Most paths in webapps are either absolute or relative to the webapp
itself. The above looks like it should be relative to the webapp, but
you're asking some code to load it without giving it a point of reference.

> I'm using XSLT to transform
> some XML files and Tomcat always tries to look this "someDTD.dtd" under
> "tomcat/bin/". Naturally the file is not there so I get an error.

What is the XSLT processor using for it's base path? Probably the cwd of
the Java process, which is almost never going to work. Does it try to
load .../tomcat/bin/someDTD.dtd even though you (sort of) told it to
load .../tomcat/bin/WEB-INF/dtd/someDTD.dtd? Or does it try to load that
second one?

> How could I make Tomcat to look for the files under
> "tomcat/webapp/appName/" , not under "tomcat/bin/"?

You could fully-specify the path of the DTD. Or, you could turn off XML
validation in the XSLT processor. You could also write your own DTD
resolver and plug it into the XML parser... but that will be problematic
because you'll need to sniff the current webapp's deployemnt directory
from the request, and then load the DTD relative to that. Good luck :)

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

iEYEARECAAYFAkpNcfAACgkQ9CaO5/Lv0PCengCgiuQVm+mLC7ZTBBDE2i4PYzi6
6mcAn3KH9Fwl4Wa85VkAcc3JLM/pB85H
=tZaZ
-----END PGP SIGNATURE-----

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