• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Setting up Website without the context element in Server.xml

 
Ranch Hand
Posts: 62
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i am currently developing website for a Client 'simliv'
We have developed some good 3/4 working pages and the client want to host this website on the internet.So the Client has decided to use its existing
IDC (Internet Data Center).

PROBLEM: But the Client's IDC allows the client to access only webapps folder under tomcat. ie any damn file for the website can be placed under
webapps in folder simliv.The Client cannot access any folder like logs,bin etc.

Now while inhouse development we have used a External Resource in Web.xml using <resource-ref> tag and the actual parameters for the resource is in Server.xml under <context> in
<Resource /> <ResourceParams > tags.

My Questions:

1>Is it possible to run a website in tomcat without adding <Context> element parameter (ie without configuring Context in Server.xml) in Server.xml

2>Can i shift the external resource(type javax.sql.DataSource) defined in Server.xml to Web.xml.

3>Can i prevent the information to be written under folder 'logs' in the file localhost or catalina.out for my website.

All this becoz IDC doesnot allow Client to access any folder other than Webapps and particularly 'simliv' under webapps.

please reply
thanks
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. When Tomcat starts, it will recognize folder under webapps as legitimate web applications if they have a WEB-INF directory with a valid web.xml file in it. If you can't restart, the alternative is to use the Manager application's html interface to add the application.
2. - I don't know
3. I think you can override the default logger defined in server.xml but I'm not sure how.
Bill
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you probably won't like some of my answers.

1) Yes, in Tomcat 5.x there is a concept of a context.xml file. You would put this file in the WAR file that you upload (I think in META-INF ??) and TC would use the <context> entries you supply, and you wouldn't need access to server.xml. But if you IDC doesn't have TC5.x, you're out of luck on this count as well (and besides, it sounds like they're running in 'exploded' mode, and wouldn't support *.war files anyways).

2) You can't really *shift* the elements, but you can change how you create them. Instead of relying on container-managed resources (like DataSources), you can set up those resources in your own application, and configure them based on context-param's you've placed in web.xml. There's lots of folks that like to do this, because of just the situation you describe ( they have no access to the container, and so they must manage everything themselves anyway ).

3) I don't know if you can 'prevent' this. If you use System.out, then where this ends up is a tomcat configuration (out of your control). If you use ServletContext.log() then this is *also* up to the container configuration. If you truly want completely separate logging, configurable and controlled by you, you need to use something like log4j.jar. This runs along the same lines as my answer for #2. Don't depend on the container for anything.
 
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic