Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

servlet.getServletContext().getContext always returns null

ziggy25Aug 19 2008
Hi all, i am having some problems in context paths and im hoping somebody here might be able to help me.

I've got two files, a jsp page and a java file in the background.

The jsp file calls a method in the java file as shown below
UserAuth userauth = Login.checkLogin(application, request, response, null);
The java file the calls another method as shown below. servlet in the parameters is the "application" value passed from the jsp page.
return checkLogin(servlet.getServletContext(), request, response, nextURI);
Within checkLogin, i try to get the context for an application as shown below. "context" below is the result of servlet.getServletContext() in teh call.
ServletContext crmsAuthContext = context.getContext("/admin");
For some reason crmsAuthContext is always null and im not sure why. The way the application is structured in Tomcat is that it is deployed in multiple war files as shown below.
tomcat5.5
|___bin
|___work
|___webapps
    |_admin.war
    |_manager.war
    |_core.war
    |_auth.war
The above code is from the /core application and i am trying to call something from the /admin application. Whenever i try to get the context of /admin it return null. Can anyone help?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 16 2008
Added on Aug 19 2008
0 comments
625 views