Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access contextRoot in Servlet deployed in an ear in Weblogic 81

Status
Not open for further replies.

MadBenny

Programmer
Jan 20, 2005
1
IE
Hi,

I need to access the contextRoot or webapp name from a startup servlet deployed in WebLogic. I've tried the following;

getServletContext().getRealPath("/") return null.

getServletContext().getServerInfo() returns Weblogic 8.1 service pack 3...

getServletContext().getServletContextName() display the <display-name> value from my web.xml.

What I want is the <context-root> value in the EARs application.xml.

I tried the following JNDI lookup and the lookup failed but the error message contained the contextRoot.

String name = (String) jndiContext.lookup("java:/comp/env/namespace");
log.info("jndiContextlookup namespace = "+name);


Any help would be GREATLY appreciated. This should be easy!!

Shane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top