wood burning stoves 2.0*
The moose likes Servlets and the fly likes problem in retriving the realpath from the servlet. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem in retriving the realpath from the servlet." Watch "problem in retriving the realpath from the servlet." New topic
Author

problem in retriving the realpath from the servlet.

Pooja Agarwal
Ranch Hand

Joined: May 19, 2004
Posts: 37
Hai All,

I am facing problem in retriving the realpath from the servlet.
I am using the following code in order to retrieve the path.
String prefix = getServletContext().getRealPath("/WEB-INF/classes");

The value returned from above code is null.
I am using Weblogic 8.1 server, and deploying my servlet as WAR file inside
the weblogic server.

Is this the problem with the weblogic server or with the code. Is there any way to over come this.
I need the path as i am implementing Log4j for the servlet and i have to pass the
configuration file in one of the function "PropertyConfigurator.configure(file);"
where the file should include complete path.
My configuration file is in WEB-INF/Classes directory.

Any help is appreciated.
Thanks in advance
Pooja.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
the path returned is null because it's inside the war.


42
Pooja Agarwal
Ranch Hand

Joined: May 19, 2004
Posts: 37
Hai

Firstly, thanks for ur reply.
Is there any way to overcome this and get the path.
What do i need to do inorder to retrieve the path.
Is there any solution.

Thanks once again,
Pooja.
 
Consider Paul's rocket mass heater.
 
subject: problem in retriving the realpath from the servlet.