0
votes

Following is the error I'm getting:

Struts Problem Report

Struts has detected an unhandled exception:

Messages: java.lang.NullPointerException File: org/apache/jsp/WEB_002dINF/jsps/api/multilineOUT_jsp.java Line number: 160

org.apache.jasper.JasperException: java.lang.NullPointerException org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486) org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411) org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:164) org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:374) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:278) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:236) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:236) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.jkit.loginapi.interceptor.LoginInterceptor.intercept(LoginInterceptor.java:32) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:511) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745)

java.lang.NullPointerException org.apache.jsp.WEB_002dINF.jsps.api.multilineOUT_jsp._jspService(multilineOUT_jsp.java:160) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486) org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411) org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:164) org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:374) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:278) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:236) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:236) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.jkit.loginapi.interceptor.LoginInterceptor.intercept(LoginInterceptor.java:32) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:511) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745)

Following is the error on the server console:

inside GraphView3Redirect Action First view donennn inside GraphView3Redirect Action sIZEeeee :1 ---------success-------- --Calling One--13 Inside getTPN1 Outborn Method Done --Calling Myid--2 Inside getTPN1 Outborn Method Done ---------success2-------- --Calling One--13 Inside getTPN1 Method Done --Calling Myid--2 Inside getTPN1 Method Done Myid >> 2 One >> 13 two >> null ---inside JSP Myid--- 1 Jan 07, 2015 1:58:46 PM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet jsp threw exception java.lang.NullPointerException

Below is the multilineOUT.jsp code:

                String one =(String)session.getAttribute("one"); 
                String two =(String)session.getAttribute("two"); 
                String myid =(String)session.getAttribute("myid");
                System.out.println("Myid >> "+myid);
                System.out.println("One  >> "+one);
                System.out.println("two  >> "+two);
               // String hid="17";
                //System.out.println("---1----"+hid);
                //My Hospital
                String myid1 =(String)session.getAttribute("myid1");
                if (!myid1.equals("agg"))
                {
                if (myid != null || myid !="")
                {
                    System.out.println("---inside JSP Myid---");
                    ArrayList<String> hobbies10 = new ArrayList<String>();
                    hobbies10 = (ArrayList<String>)session.getAttribute("datamy");

                    System.out.println("1");

                    String StringOfMarks10 [] = new String [hobbies10.size ()];

                    System.out.println("1A");

                    StringOfMarks10 =hobbies10.toArray(StringOfMarks10);

                    System.out.println("A");

                    double[] data10 = new double[StringOfMarks10.length];

                    System.out.println("B");

                    for(int i = 0; i < StringOfMarks10.length; i++)
                    {
                            //data10[i] = Double.parseDouble(StringOfMarks10[i]);
                        double  reval2 = Double.parseDouble(StringOfMarks10[i]);

                        System.out.println("C");

                        if (reval2 == -00.0)
                        {
                            data10[i] = Chart.NoValue;  
                        }else{
                            data10[i] = reval2;
                        }
                    }
                    System.out.println("My Hospital data array values :"+(ArrayList<String>)session.getAttribute("datamy"));

                    System.out.println("2");

                    layer.addDataSet(data10, 000000, "Your Hospital "+myid ).setDataSymbol(Chart.GlassSphere2Shape, 10);
                  //layer.addDataSet(data0Y, 000000, "Your Hospital "+myid );
                }    
                }


                //AVG view
                ArrayList<String> hobbies100 = new ArrayList<String>();
                hobbies100 = (ArrayList<String>)session.getAttribute("avgdata");

                System.out.println("3");

                String StringOfMarks100 [] = (String []) hobbies100.toArray (new String [hobbies100.size ()]);
                double[] data100 = new double[StringOfMarks100.length];
                for(int i = 0; i < StringOfMarks100.length; i++)
                {
                    //data100[i] = Double.parseDouble(StringOfMarks100[i]);
                        double  reval2 = Double.parseDouble(StringOfMarks100[i]);
                        if (reval2 == -00.0)
                        {
                            data100[i] = Chart.NoValue; 
                        }else{
                            data100[i] = reval2;
                        }
                }

               // String totalavg1 = (String)session.getAttribute("totalavg");
                layer.addDataSet(data100, 0xff0000, "Average").setDataSymbol(Chart.GlassSphere2Shape, 10);


                //1st Hospital
                  if (!myid1.equals("agg"))
                {
                if (one != null)
                {
                    System.out.println("---inside JSP One----");
                    ArrayList<String> hobbies1 = new ArrayList<String>();
                    hobbies1 = (ArrayList<String>)session.getAttribute("data0");

                    System.out.println("4");

                    String StringOfMarks [] = (String []) hobbies1.toArray (new String [hobbies1.size ()]);
                    double[] data = new double[StringOfMarks.length];
                    for(int i = 0; i < StringOfMarks.length; i++)
                    {
                        //data[i] = Double.parseDouble(StringOfMarks[i]);
                        double  reval2 = Double.parseDouble(StringOfMarks[i]);
                        if (reval2 == -00.0)
                        {
                            data[i] = Chart.NoValue;    
                        }else{
                            data[i] = reval2;
                        }
                    }
                    System.out.println("1st hospital data array values :"+(ArrayList<String>)session.getAttribute("data0"));

                    System.out.println("5");

                    layer.addDataSet(data, 0x3333ff, one).setDataSymbol(Chart.GlassSphere2Shape, 10);
                }
                }
                  if (!myid1.equals("agg"))
                  {

                if (two !=null )
                {
                    System.out.println("---inside JSP two----");
                    ArrayList<String> hobbies2 = new ArrayList<String>();
                    hobbies2 = (ArrayList<String>)session.getAttribute("data1");

                    System.out.println("6");

                    String StringOfMarks2 [] = (String []) hobbies2.toArray (new String [hobbies2.size ()]);
                    double[] data2 = new double[StringOfMarks2.length];
                    for(int i = 0; i < StringOfMarks2.length; i++)
                    {
                        //data2[i] = Double.parseDouble(StringOfMarks2[i]);
                        double  reval2 = Double.parseDouble(StringOfMarks2[i]);
                        if (reval2 == -00.0)
                        {
                            data2[i] = Chart.NoValue;   
                        }else{
                            data2[i] = reval2;
                        }
                    }
                    System.out.println("1st hospital data array values :"+(ArrayList<String>)session.getAttribute("data1"));

                    System.out.println("7");

                    layer.addDataSet(data2, 0x008800, two).setDataSymbol(Chart.GlassSphere2Shape, 10);
                }
                  }
                // Output the chart
                String chart1URL = c.makeSession(request, "chart1");

                // Include tool tip for the chart
                String imageMap1 = c.getHTMLImageMap("", "",
                    "title='[{dataSetName}] Hour {xLabel}: {value} MBytes'");
                %>
    <!-- End here senthil -->
    <s:form id="idLoginForm" action="apiExportGen" theme="simple"
        namespace="/ReportGen">
        <table cellspacing="0" cellpadding="0" border="0" width="100%"
            height="100%">
            <tr>

                <%-- <!-- SSS   <td width="10%" class="bodyLeft"><img src="/images/img_clear.gif" width="100%" height="10"></td> --> --%>
                <td width="100%" class="bodyMain">

                    <table cellspacing="0" cellpadding="0" border="0" height="100%"
                        width="100%">

                        <tr valign="top">
                            <td colspan="2">
                                <table cellspacing="0" cellpadding="0" border="0" width="100%"
                                    height="40">
                                    <tr>
                                        <td width="130"><img src="/MyLoginAPI/images/logo1.gif"
                                            width="190" height="40" alt="Chitrec" /></td>
                                        <td width="100%">
                                            <table cellspacing="0" cellpadding="0" border="0"
                                                width="100%">
                                                <tr>

                                                    <td width="70%"><img
                                                        src="/MyLoginAPI/images/topimage2.bmp" height="64"
                                                        width="100%" /></td>
                                                    <td width="15%"><img
                                                        src="/MyLoginAPI/images/topimage.gif" height="64"
                                                        width="100%" /></td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" td width="100%">
                                <table width="100%" cellpadding="0" cellspacing="0"
                                    class="navTopRight"">
                                    <tr>
                                        <td width="5%%"></td>
                                        <td width="65%"><img
                                            src="/MyLoginAPI/images/topimage3.bmp" height="17"
                                            width="100%" /></td>
                                        <td width="30%" style="background: #0F4279;" align="right"><span
                                            class="navTopRightUser"><FONT COLOR="#ffffff"><span
                                                    class="navTopRightUser"> Your Hospital Id <s:property
                                                            value="%{#session['loginId']}" /></FONT> &nbsp; </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr valign="top">
                            <td width="100%" colspan="2" height="10"></td>
                        </tr>
                        <tr valign="top" height="100%">
                            <td width="100%">
                                <table cellspacing="0" cellpadding="2" border="0" width="100%">
                                    <tr>
                                        <td valign="top" width="16%"><%@ include
                                                file="/WEB-INF/jsps/includes/include_menu.jsp"%></td>
                                        <td>
                                            <!-- Page Details -->
                                            <table cellspacing="0" cellpadding="0" border="0"
                                                width="100%" class="sectionTitleBking">
                                                <tr>
                                                    <td class="text"><span class="pageTitle">
                                                            Infant Outborn </span></td>
                                                </tr>

                                                <tr>
                                                    <!-- <td class="TextLeft"><form:errors path="*" cssClass="errorBox" /><P></td> -->
                                                </tr>
                                            </table>
                                            <table cellspacing="0" cellpadding="0" border="0" width="70%"
                                                class="text textPadding">
                                                <tr height="30">
                                                    <s:if test="hasActionMessages()">
                                                        <div class="welcome">
                                                            <s:actionmessage />
                                                        </div>
                                                    </s:if>

                                                    <s:if test="hasActionErrors()">
                                                        <div class="errorBox">
                                                            <s:actionerror />
                                                        </div>
                                                    </s:if>
                                                </tr>
                                                <tr class="row tableData2">

                                                    <td width="100%"><img
                                                        src='<%=response.encodeURL("/MyLoginAPI/images/getchart.jsp?"+chart1URL)%>'
                                                        usemap="#map1" border="0"> <map name="map1"><%=imageMap1%></map>

                                                    </td>
                                                </tr>

                                            </table> <!-- End of page details --> <!-- footer --> <%@ include
                                                file="../includes/securefooter.jsp"%>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </s:form>
</body>
</html>

I had read earlier that this problem could be because of conflicting JAR files in the Tomcat library & the Web-INF library, but this is not the case.

I am very new to Java and am only maintaining this application. It was running fine until December 26 2014 but when I returned in 2015, it started to throw this exception without any changes in the code. Please let me know if I need to post any other parts of my code here.

2

2 Answers

0
votes

Look for places where you are using the . operator since the left side being null is what causes the Null Pointer Exception error.

For example:

if (!myid1.equals("agg"))

If myid1 is null you will get the error. You can circumvent this in this case by reversing the order of the comparison:

if (!"agg".equals(myid1))

You could also check the variable for null before using the . operator on it:

if (myid1!=null && !myid1.equals("agg"))

Also, a string comparison like myid!="" doesn't work in Java. It only compares the address not the contents. Anyway, the point is, you should do !"".equals(myId) or !myId.equals("") instead.

And it will be very helpful to you to learn to indent better. Good indenting helps a lot when debugging because its hard to debug if you can't tell if something is really in the if-statement or loop or not.

0
votes

Here's what you need to do.

  1. Get hold of the generated Java code for the JSP which is throwing the exception. You should be able to find it in one of Tomcat's temporary or work directories. You are looking for a file named "multilineOUT_jsp.java".

  2. Figure out what is happening at line 160 of that file.

  3. Then follow the normal procedure for debugging an NPE as described here: What is a NullPointerException, and how do I fix it?.

If you could show us line 160 of that file, we could be more specific. Without that info, the best that we can do it offer educated guesses.