title: java.lang.NullPointerException at org.apache.jsp.orderOnline_jsp._jspService
body: <p>I am writing a simple website with some sql database involvement.
  Everytime i try to get a page that pulls data from the data base i get the following error</p>
  <p><a href="https://i.stack.imgur.com/CX3tQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CX3tQ.png" alt="enter image description here" /></a></p>
  <h2>With the Following Logs</h2>
  <p>====</p>
  <pre><code>WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
  java.lang.NullPointerException
      at org.apache.jsp.orderOnline_jsp._jspService(orderOnline_jsp.java from :125)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
      at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      at java.lang.Thread.run(Thread.java:695)
  </code></pre>
  <p>I belive the error occurs from the following code in one of my pages</p>
  <p>OrderOnline.jsp</p>
  <pre><code>&lt;%
      ArrayList al=(ArrayList)request.getAttribute(&quot;allMenu&quot;);
      for(int i=0; i&lt;al.size(); i++)
      {
        Menu menu = (Menu)al.get(i);
        %&gt;
        &lt;div class=&quot;row&quot; style=&quot;color: #fff; padding-top: 30px;font-size: 20px;text-align: center&quot;&gt;
        &lt;div class=&quot;col-sm-2&quot;&gt;&lt;%=menu.getName() %&gt;&lt;/div&gt;
        &lt;div class=&quot;col-sm-1&quot; style=&quot;color: gold&quot;&gt;&lt;%=&quot;$&quot;+menu.getPrice() %&gt;&lt;/div&gt;
        &lt;div class=&quot;col-sm-4&quot;&gt;&lt;%=menu.getDes() %&gt;&lt;/div&gt;
        &lt;div class=&quot;col-sm-2&quot;&gt;&lt;/div&gt;
        &lt;div class=&quot;col-sm-2&quot;&gt;&lt;a href=&quot;OrderCL?type=add&amp;id=&lt;%=menu.getId()+&quot;&quot; %&gt;&quot;&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-default&quot;&gt;Want Me&lt;/button&gt;&lt;/a&gt;&lt;/div&gt;
        &lt;div class=&quot;col-sm-1&quot;&gt;&lt;/div&gt;
        &lt;%
          }
  %&gt;
  </code></pre>
  <p>Can anyone helpme figure this issue out?</p>
  <p>I have attached a link to the project.
  So you can run it on netbeen with glassFish Server 3.1</p>
  <p>Create a new JAva Web Project with existing resources</p>
  <p><a href="https://www.dropbox.com/s/xgd1vsu0wjvykfl/star-2016-05-18.zip?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/xgd1vsu0wjvykfl/star-2016-05-18.zip?dl=0</a></p>
  <p>Appreciate any help.</p>