Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to access contextRoot in Servlet deployed in an ear. Weblogic 8.1  RSS feed

Shane McEneaney
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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");"jndiContextlookup namespace = "+name);

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

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!