here is the following code :
"Unable" means what? Which lines of code are executed, and which aren't? At which point does what actually happens start to deviate from what you expected to happen?
Is the "leagues-file" an absolute path? Relative paths do not work in a web app.
Is there anything on the log file? If so, what?
I want my listener to read from the text file and display it to user when user clicks list of all leagues.
I have defined the path of league file in Web-INF.
So is it an absolute path? If you print the leaguesFile variable to the log, does it have the correct absolute path?
the log file contains data of all the leagues.
So there are no error messages in the log at all?
Whenever i execute the project, it gives null pointer exception error when list of all leagues is clicked.
Earlier you said "I am unable to read text file from servlet context listener. " - does that mean there is no error/exception in the context listener, and you are merely suspecting that it does not work correctly? And the exception is actually in some other code?
Ishan Pandya wrote:Check this line.
this is getting an context parameter with name "library.txt". which actually does not exists in the web.xml and which also return a null value.
try using "library_file" instead of "library.txt" in context.getInitParameter()
I tried it , again getting the same error.