File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Spring Login problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring Login problem "Request processing failed; nested exception is java.lang.NullPointerException"" Watch "Spring Login problem "Request processing failed; nested exception is java.lang.NullPointerException"" New topic
Author

Spring Login problem "Request processing failed; nested exception is java.lang.NullPointerException"

Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 111

Dear Ranchers,

I am creating a login application using spring mvc and ibatis. But i am getting a NPE and i am not able to solve this issue from the past 2 days . Please help me.

My Form controller is


My spring application context file is:


My ibatis configuration file is:

and my SqlMapConfig file is:

My console prints the following and i can make out the username is null so i am getting this NPE. But why does it print the password that the user entered and not the username? Can anybody please explain where i am going wrong?

Please help me as i am stuck here and i don't have any idea as to why i am getting this error.Thank you


Regards,
Deepak

Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 507

In your posted code, line 57 is blank, but the NPE occurs on line 57, can you post that line of code?

EDIT: Can you also post your command class and JSP file?

P:S: Still extending SimpleFormController in the spring3 era? I would suggest you to use annotations instead, which makes is more powerful and simpler.


Regards, Prasad
SCJP 5 (93%)
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 111

This project requires spring 2x as it has been developed using spring 2x. So please guide me to solve this problem. Thank you
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 111

My command class is


The line 57 in LoginFormController class is


This is the message printed out on to the console
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 507

Please post your JSP also
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 111

This is my login page code:
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 507

change this line <input type="text" name="name" id="name" />
to <input type="text" name="userId" id="userId" /> and you should get the user entered id, in the controlller, for spring to bind them, you should have same name in both command class as well as JSP.

EDIT: either you can do the above change, or have objUserLogin.getName in your controller instead of objUserLogin.getUserId() on line 57.
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 111

Thank you very much. Its working now.
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 507

Deepaks Deshpande wrote:Thank you very much. Its working now.


Glad to hear, its working..
You are Welcome Brother..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring Login problem "Request processing failed; nested exception is java.lang.NullPointerException"
 
Similar Threads
running before I can crawl ( or how to add Spring to an existing Hibernate standalone app)
totally stumped by synchronization.afterCommit error
Spring MVC+iBATIS simple Login App Problem
[Security:090398]Invalid Subject: weblogic :java.lang.SecurityException: [nested exception is java.l
Problem with Spring AOP