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.
Any help would be GREATLY appreciated. This should be easy!!
Shane
-
How to access contextRoot in Servlet deployed in ear Weblogic 81 (3 messages)
- Posted by: Shane Mceneaney
- Posted on: January 20 2005 08:32 EST
Threaded Messages (3)
- How to access contextRoot in Servlet deployed in ear Weblogic 81 by Shane Mceneaney on January 20 2005 08:34 EST
- Re: How to access contextRoot in Servlet... by James Carman on January 23 2005 11:39 EST
- Re: How to access contextRoot in Servlet... by Shane Mceneaney on January 24 2005 05:32 EST
-
How to access contextRoot in Servlet deployed in ear Weblogic 81[ Go to top ]
- Posted by: Shane Mceneaney
- Posted on: January 20 2005 08:34 EST
- in response to Shane Mceneaney
Oops. Forgot to include the jndi lookup..
Here it is;
String name = (String) jndiContext.lookup("java:/comp/env/namespace");
log.info("jndiContextlookup namespace = "+name);
Thanks in advance.
Shane -
Re: How to access contextRoot in Servlet...[ Go to top ]
- Posted by: James Carman
- Posted on: January 23 2005 11:39 EST
- in response to Shane Mceneaney
What you're looking for a way to get the value returned from HttpServletRequest.getContextPath() via the ServletContext interface, right? You are right; that SHOULD be easy, but I don't see anywhere in the API that it's possible. Are you sure you need the value outside the scope of a request? -
Re: How to access contextRoot in Servlet...[ Go to top ]
- Posted by: Shane Mceneaney
- Posted on: January 24 2005 05:32 EST
- in response to James Carman
Hi James,
Thanks for taking the time to respond. The web/enterprise application is deployed on an application server and it never receives HTTP requests. It's purpose is to read from and write to JMS queues.
We are employing JMX MBeans and we need a facility to identify which webapp the MBeans are related to i.e.
webappX.loggerMBean
webappY.loggerMBean
webappZ.loggerMBean
There has to be a way to do this.
Thanks again,
Shane