开发者

Troubleshoot JSP nullpointer exception problem

开发者 https://www.devze.com 2022-12-18 19:33 出处:网络
I am looking at a very old project and trying to fix some problems that this project is facing with related to its JSP pages throwing nullpointer exception.

I am looking at a very old project and trying to fix some problems that this project is facing with related to its JSP pages throwing nullpointer exception. The JSP page is throwing a null开发者_开发百科 pointer exception like the sample below.

/e2fo/tools/user/search/searchUser.jsp. Exception thrown : java.lang.NullPointerException
    at com.ibm._jsp._searchUser_5F_TA._jspService(_searchUser_5F.java:207)

Now this problem is not reproducible, so just by looking at the exception above I need to figure put where could be the problem. As I understand, JSP pages get compiled into java servlets and so the .java file displayed in the exception stack is the servlet file. This is an intermediate file and we do not get to see this, I am running websphere 6.1. In this case, How to determine or rather map the line number from the servlet to the JSP file ?


The last time I ran into this, the intermediate file was gone by the time I looked for it. What I did to get around it was to introduce an intentional compiler error into the JSP and run it again. When it hits that exception, it saves the Servlet source so that you can correct the code error.

I just tended to go to the bottom and put:

<% novariable.toString(); %>


Try using classdebuginfo parameter in the JSP engine configuration.

If you want to try looking at the generated .java file, you will need to use keepgenerated parameter.

To know where to set this parameters, see Configuring JSP Engine Parameters (http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/tweb_jspengine.html)

Reference: http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rweb_jspengine.html

May be this link could help: Debugging a JSP file on a server (http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.iseries.doc/info/welcome_base.html)


You can find the compiled JSP files in the work directory of the server in question. I don't do Websphere (anymore) but I know that it's built on top of Tomcat and that Tomcat by default stores the compiled JSP files in /work folder of the installation directory. Give it a look, maybe it uses the same foldername.

If still in vain, then do a platform based file search on files matching filename _searchUser_5F.java inside the root folder of Websphere.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号