Khaled Zarrad
Khaled Zarrad

Reputation: 3

Problem with paths when deploying my web app

I am having big issues deploying my web app to Tomcat 5.5

My server side code must access files found under a directory parallel to my WEB-INF folder.

When on developement mode, a simple relative path (mydirectory/myfile) works prefectly.

When deployed, the sayed path does not work anymore I dont know why.

Is there a way to make it work without using any absolute path?

Here is my War directory

Upvotes: 0

Views: 585

Answers (2)

home
home

Reputation: 12538

Obtain your root folder relative to contextRoot by calling javax.servlet.ServletContext.getRealPath("/"). Then proceed with this path...

Upvotes: 1

manku
manku

Reputation: 1278

Using relative path will work, but you need to be aware of what the containers considers to be the root directory and base your relative path from there. If you specify your directory structure better, I can help you with the path - Basically try using the .. operator to move from the container root to the needed directory

Upvotes: 0

Related Questions