Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.NullPointerException

 
saurabh dinesh
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am getting java.lang.NullPointerException while I am trying to open a tab.Whole error is :




Here is code:





Please give suggestions.

Thank you
 
Ivan Jozsef Balazs
Rancher
Posts: 992
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>java.lang.NullPointerException
>at com.infotech.kastle.lending.servlet.ShareSessionServlet.doGet(ShareSessionServlet.java:36)


Did you locate the line hinted to in the stack trace? Which one is it?

 
saurabh dinesh
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.The line is :

System.out.println(
"ctx1.getServletContextName1: " + ctx1.getServletContextName());

 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That would indicate

ctx1 is null.
 
saurabh dinesh
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Manish,

Thanks for reply.I know that ctx1 is null but I want to know that why it is coming null I mean what could be the cause behind that.

Thanks.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Gaurav
In future, while posting code, please UseCodeTags I have added them this time for you. As you can see the tags make the code much more easy to read and understand
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gaurav doshi wrote:Dear Manish,

Thanks for reply.I know that ctx1 is null but I want to know that why it is coming null I mean what could be the cause behind that.

Thanks.

What's the "uripath" value you are passing?
Also from the API docs
In a security conscious environment, the servlet container may return null for a given URL.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only reason I can think of for a null in that statement is failure to use the correct code in the init() method - which is where a new servlet instance is handed a ServletConfig.

Bill
 
saurabh dinesh
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Maneesh,

Here is the path:

ShareSessionServlet?uripath=%2fLendingMastersWeb&path=PopulateSessionInfo&filename=welcome.jsp&divisionid=ADMIN


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