• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tomcat web application folder setting

 
Alvin chew
Ranch Hand
Posts: 834
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it needs to be inside the host element, and you need to escape your slash.
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...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
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

this is the error code
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

well , i repost the server.xml again
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my c:\newtest folder contains WEB-INF folder, which contains web.xml amd classes folder
here is my web.xml
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
very sorry, mike , i delete the folder , and now i try on c:\newtest
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic