Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

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!

servletContext.getResource("/") method is giving null ???

843835Aug 27 2002 — edited Sep 6 2002
Hi,

ServletContext sc = config.getServletContext() ;
java.net.URL url = sc.getResource("/");

The above code is in init() method of my servlet. Here problem is that 'url' is coming 'null', i mean if try to give url.toString(),
i am getting NullPointerException.

I am testing this code in Weblogic 6.1.
and my servlet is packed in a .war file.

And i can't use getRealPath() method, as this method doesn't work if servlet is packed in .war file.

please help me

thanks in advance
Srinivas
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 4 2002
Added on Aug 27 2002
3 comments
227 views