aspose file tools*
The moose likes Servlets and the fly likes Change password for user Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Change password for user" Watch "Change password for user" New topic
Author

Change password for user

Irfan Zubair
Greenhorn

Joined: Jun 12, 2012
Posts: 17
Hi,
I get the following error for change password page.

StandardWrapperValve[password]: PWC1406: Servlet.service() for servlet password threw exception
java.lang.NullPointerException
at view.password.processRequest(password.java:78)
at view.password.doGet(password.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

password



pwdval.do
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61658
    
  67

Here's the important part:

ava.lang.NullPointerException
at view.password.processRequest(password.java:78)


What does it tell you?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Irfan Zubair
Greenhorn

Joined: Jun 12, 2012
Posts: 17
Hi Bear Bibeault,
object which is null is being accessed. I don't know what is the mistake in the code?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10266
    
168

Irfan Zubair wrote:
object which is null is being accessed. I don't know what is the mistake in the code?


It's simple - Find out what line number 78 of view.password class is and then look at that code to see which object is possibly null. Then find out why it's null and if it is a valid case for it to be null (in which case, you will need a null check there).

[My Blog] [JavaRanch Journal]
Irfan Zubair
Greenhorn

Joined: Jun 12, 2012
Posts: 17
Hi Jaikiran Pai,
The error found on if(!errorMsg.isEmpty()) in password.view
I tried to find why NullPointerException is raised, but I couldn't find it.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10266
    
168

Irfan Zubair wrote:
The error found on if(!errorMsg.isEmpty()) in password.view
I tried to find why NullPointerException is raised, but I couldn't find it.


Here's an hint - What are the object(s) that are being accessed on that if(!errorMsg.isEmpty()) line?
Irfan Zubair
Greenhorn

Joined: Jun 12, 2012
Posts: 17

Irfan Zubair
Greenhorn

Joined: Jun 12, 2012
Posts: 17
I am struck with NullPointerException.
Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

Irfan Zubair wrote:


If line 78 is if(!errorMsg.empty()), then the object being accessed is errorMsg. Check if errorMsg is a null.


Palak Mathur | My Blog | TechJaunt | What is JavaRanch? | List of All FAQs
Irfan Zubair
Greenhorn

Joined: Jun 12, 2012
Posts: 17
Hi Palak Mathur,
I am aware that errorMsg is somewhere null. I couldn't find. request.serAttribute("errorMsg",errorMsg) is set in pwd validate and request.getAttribute("errorMsg",errorMsg); is retrived in password.view. I don't know what has to be done futher.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42639
    
  65
Irfan Zubair wrote:I couldn't find. ... I don't know what has to be done futher.

That's easy: do some debugging. If you don't have, or are not familiar with, an actual debugger like JSwat or something built into your IDE, you can put a "System.out.println(errorMsg)" statement before every single usage of "errorMsg". That way you can see in your log files what value it has at which point. You'll also want to customize each println statement so that you can tell them apart, like System.out.println("1 "+errorMsg), System.out.println("2 "+errorMsg) etc.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Change password for user