Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

problem in retriving the realpath from the servlet.

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the path returned is null because it's inside the war.
 
Pooja Agarwal
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
brevity is the soul of wit - shakepeare. Tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!