| Author |
request.getSession().getServletContext().getRealPath("/") with java.lang.NullPointerException
|
Deepu Surendran
Greenhorn
Joined: Feb 07, 2013
Posts: 2
|
|
Dear all,
I am working on a java web project using struts2. My developing environment is Eclipse+ tomcat on windows
I encountered a problem when I would like to get the path of current project.
This is the code I am using to get the path.
String filePath = request.getSession().getServletContext().getRealPath("/");
But it always returns java.lang.NullPointerException
Hope any experts could give me some help.
Thanks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56229
|
|
|
Debugging 101: if you are getting an NPE, then something in the statement is returning null. Try each one to see which it is.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: request.getSession().getServletContext().getRealPath("/") with java.lang.NullPointerException
|
|
|