aspose file tools*
The moose likes Tomcat and the fly likes tomcat web application folder setting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "tomcat web application folder setting " Watch "tomcat web application folder setting " New topic
Author

tomcat web application folder setting

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834

hi, i would like to add a web application folder say "c:\test" instead of create it under tomcat/webapp folder, am i doing the right way as i just insert Context path into BOLD area which is before </Engine> ?
if this is the way to add , but then i can't access by localhost:8080/test ,
what wrong with this ?
for your information : i using tomcat 4.1.29
tq
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

it needs to be inside the host element, and you need to escape your slash.
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
yes, mike i have try ...but i couldn't access the folder ....say when i type localhost/test ....it show error message like not available ...how i make it permanently access like other folder under tomcat\webapp ?
also , when i check from tomcat manager(under index.jsp) , it does exist but when i click "start" , it show me "FAIL - Application at context path /myapp could not be started"
how i solve it ?
thanks!
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

...but i couldn't access the folder
Is it just an empty folder with a JSP file or HTML file in it? This is not enough. Webapps require *at least* a web.xml file with the following:
And that file needs to be under WEB-INF (all caps).

....say when i type localhost/test ....it show error message like not available ... Well, "like" isn't descriptive. What is the Exact error message, what is in the logs, turn off IE friendly error messages, etc, etc.

how i make it permanently access like other folder under tomcat\webapp ?

With the changes I indicated for server.xml and in this post here, you've done everything required.

also , when i check from tomcat manager(under index.jsp) , it does exist but when i click "start" , it show me "FAIL - Application at context path /myapp could not be started"
So which is it ? /myapp or /test ?
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834

this is the error code
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834

well , i repost the server.xml again
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
my c:\newtest folder contains WEB-INF folder, which contains web.xml amd classes folder
here is my web.xml
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
very sorry, mike , i delete the folder , and now i try on c:\newtest
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Alvin! Be more careful.

A context does not belong inside of another context.


and escape your windows-style directory slashes. That, or else switch the slash to a forward slash (and use just one); it wouldn't work on windows, but java won't care.

to be clear:

docBase="c:/newtest"
- or -
docBase="c:\\newtest"
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

and just in case you're using coreservlets (or others of its ilk), read up on the invoker servlet, because that's the next thing that will be a 'gotcha'.

http://test.javaranch.com/wiki/view?InvokerServlet
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
thank you , mike , very kind of you and your patience , sorry for my repeating mistake , i get it now ~~thks again and have a nice day !
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: tomcat web application folder setting