Link to home
Start Free TrialLog in
Avatar of ispcorp
ispcorp

asked on

BEA getRealPath for properties file

Hello,
I have a properties file that I need to access within my web application.  I built it on JBuilder using Tomcat 4.1, and I call the following method to derive the path for my properties file...

session.getServletContext().getRealPath("/") + "/properties/myprops.properties";

In any case, it doesn't work when I deploy it to BEA.  The method return a NULL.  Any clue on how to retreive the application path of my project within BEA.  Thanks.

Avatar of bloodredsun
bloodredsun
Flag of Australia image

Because HttpSession.getSessionContext() is deprecated.

Use either application.getRealPath("/") (for JSPs) or this.getServletContext().getRealPath("/") for servlets.
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Weblogic will always return null if it's deployed as a WAR as well (according to all the sites I could find via google) :-/

Apparently this is right according to the spec, and all other app servers are doing it wrong...

Tim