Erro jsp...java.lang.NullPointerException

quando clico no link para chamar esse codigo ele apresenta o seguinte erro:

O seguinte erro foi encontrado:
java.lang.NullPointerException

<%@page contentType=“text/html” import=“java.util., java.io., java.text., java.util.Calendar., java.sql.*, DateFormat, ConectaMysql” %>
<%@ page errorPage=“error.jsp”%>
<%@ include file=“conecta.jsp” %>
<%
String sess = (String) session.getAttribute(“sessao”);
if (!(sess != null && sess.equals(“autorizado”))) {
%>

	&lt;jsp:forward page="denied.jsp" /&gt;

<%
}else{
Statement stm = mysql.getConnection().createStatement();
String[] prefGerencia = new String[10];
String[] siglaGerencia = new String[10];
String[] subitemAri = new String[200];
String[] nomeSubitem = new String[200];
int totalGerencias = 0;
int totalSubitens = 0;
ResultSet resGerencias = stm.executeQuery(“SELECT pref_gerencia, sigla FROM gerencias WHERE pref_gerencia <> 8080 ORDER BY sigla”);
while(resGerencias.next()){
totalGerencias = resGerencias.getRow() - 1;
prefGerencia[totalGerencias] = resGerencias.getString(“pref_gerencia”);
siglaGerencia[totalGerencias] = resGerencias.getString(“sigla”);
}
ResultSet resSubitens = stm.executeQuery(“SELECT subitem_ari, nome_subitem FROM da_ari_subitens ORDER BY subitem_ari”);
while(resSubitens.next()){
totalSubitens = resSubitens.getRow() - 1;
subitemAri[totalSubitens] = resSubitens.getString(“subitem_ari”);
nomeSubitem[totalSubitens] = resSubitens.getString(“nome_subitem”);
}

%>

Este erro é o mais fácil de se ter…

Algum parâmetro ou variável testada está tentando fazer uma operação ilegal, por esta estar nula.

Antes do while teste se o resultset está nulo.
Mas, pode ser outras coisas…

Até
Claire

Claire

Não consigo achar o erro neste código mesmo com a sua dica, poderia me dar outra informação?

<%@page contentType=“text/html” import=“java.util., java.io., java.text., java.util.Calendar., java.sql.*, ConectaAccess” %>
<%@ page isErrorPage=“true” %>
<%
String sess = (String) session.getAttribute(“sessao”);
if (!(sess != null && sess.equals(“autorizado”))) {
%>
<jsp:forward page=“denied.jsp” />
<%
}
%>
<html>
<head>
<title>Despesas Administrativas - EO</title>
<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1”>
<link href="…/_styles/bb_ie.css" rel=“stylesheet” type=“text/css”>
<script language=JavaScript src="…/inf.js" type=text/javascript></script>
<script language=JavaScript src="…/menu.js" type=text/javascript></script>
</head>

<table width="100%" border="0" cellspacing="4" cellpadding="0"> <tr> <td width="20%" valign="top" height="330"> <TABLE bgColor=#ffffff border=0 cellPadding=0 cellSpacing=0 width=155> <TBODY> <TR>
      &lt;TD align="left" bgColor=#F0CF1F height=16 width=6&gt;&amp;nbsp;&lt;/TD&gt;
        
        &lt;TD align="left" bgColor=#F0CF1F vAlign=center width=149&gt;<a 
        class=subtitulo 
        href="indexorcamento.jsp?url=0"><b>In&amp;iacute;cio</b></a>&lt;/TD&gt;

      &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD bgColor=#F0CF1F colSpan=2&gt;<IMG alt="" border=0 height=1 
        src="../Intranet/imagens/dotBranco.gif" vspace=3 width="100%">&lt;/TD&gt;

</TR>
<TR>

      &lt;TD align="left" bgColor=#F0CF1F height=16 width=6&gt;&amp;nbsp;&lt;/TD&gt;
        
        &lt;TD align="left" bgColor=#F0CF1F vAlign=center width=149&gt;<a 
        class=subtitulo 
        href="indexorcamento.jsp?url=1">Defini&amp;ccedil;&amp;atilde;o</a>&lt;/TD&gt;

      &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD bgColor=#F0CF1F colSpan=2&gt;<IMG alt="" border=0 height=1 
        src="../Intranet/imagens/dotBranco.gif" vspace=3 width="100%">&lt;/TD&gt;

</TR>
<TR>

      &lt;TD align="left" bgColor=#F0CF1F height=16 width=6&gt;&amp;nbsp;&lt;/TD&gt;
        
        &lt;TD align="left" bgColor=#F0CF1F vAlign=center width=149&gt;<a 
        class=subtitulo 
        href="indexorcamento.jsp?url=2">Caracter&amp;iacute;sticas</a>&lt;/TD&gt;

      &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD bgColor=#F0CF1F colSpan=2&gt;<IMG alt="" border=0 height=1 
        src="../Intranet/imagens/dotBranco.gif" vspace=3 width="100%">&lt;/TD&gt;

</TR>
<TR>

      &lt;TD align="left" bgColor=#F0CF1F height=16 width=6&gt;&amp;nbsp;&lt;/TD&gt;
        
        &lt;TD align="left" bgColor=#F0CF1F vAlign=center width=149&gt;<a 
        class=subtitulo 
        href="indexorcamento.jsp?url=3">Gestoras/Executoras</a>&lt;/TD&gt;

      &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD bgColor=#F0CF1F colSpan=2&gt;<IMG alt="" border=0 height=1 
        src="../Intranet/imagens/dotBranco.gif" vspace=3 width="100%">&lt;/TD&gt;

</TR>
<TR>

      &lt;TD align="left" bgColor=#F0CF1F height=16 width=6&gt;&amp;nbsp;&lt;/TD&gt;
        
        &lt;TD align="left" bgColor=#F0CF1F vAlign=center width=149&gt;<a 
        class=subtitulo 
        href="indexorcamento.jsp?url=4">Despesas Administrativas</a>&lt;/TD&gt;

      &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD bgColor=#F0CF1F colSpan=2&gt;<IMG alt="" border=0 height=1 
        src="../Intranet/imagens/dotBranco.gif" vspace=3 width="100%">&lt;/TD&gt;

</TR>
<TR>

      &lt;TD align="left" bgColor=#F0CF1F height=16 width=6&gt;&amp;nbsp;&lt;/TD&gt;
        
        &lt;TD align="left" bgColor=#F0CF1F vAlign=center width=149&gt;<a 
        class=subtitulo 
        href="indexorcamento.jsp?url=5">Investimentos</a>&lt;/TD&gt;

      &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD bgColor=#F0CF1F colSpan=2&gt;<IMG alt="" border=0 height=1 
        src="../Intranet/imagens/dotBranco.gif" vspace=3 width="100%">&lt;/TD&gt;

</TR>
<TR>

      &lt;TD align="left" bgColor=#F0CF1F height=16 width=6&gt;&amp;nbsp;&lt;/TD&gt;
        &lt;TD align="left" bgColor=#F0CF1F vAlign=center width=149&gt;<a 
        class=subtitulo 
        href="indexorcamento.jsp?url=6">Impacto na GDP</a>&lt;/TD&gt;

      &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD bgColor=#F0CF1F colSpan=2&gt;<IMG alt="" border=0 height=1 
        src="../Intranet/imagens/dotBranco.gif" vspace=3 width="100%">&lt;/TD&gt;

</TR>
<TR>

      &lt;TD align="left" bgColor=#F0CF1F height=16 width=6&gt;&amp;nbsp;&lt;/TD&gt;
        
        &lt;TD align="left" bgColor=#F0CF1F vAlign=center width=149&gt;<a 
        class=subtitulo 
        href="daeo.jsp">Or&amp;ccedil;ado/Realizado</a>&lt;/TD&gt;

      &lt;/TR&gt;

</table>
</td>
<td width=“80%” valign=“top” align=“center”>


<table width=“100%” height=“25” border=“0” cellspacing=“0” cellpadding=“0” background=“bgSubMenu.gif”>
<tr>
<td width=“118” align=“right”><strong>Orcado</strong></td>
<td width=“36”>&nbsp;</td>
<td width=“81” align=“center”><strong>Realizado</strong></td>
<td width=“36”>&nbsp;</td>
<td width=“76” align=“center”><strong>Treinamento</strong></td>
<td width=“36”>&nbsp;</td>
<td width=“45” align=“center”><strong>Deslocamento</strong></td>
<td width=“36”>&nbsp;</td>
<td width=“48” alig=“center”><strong>Relat&oacute;rios</strong></td>
<td></td>
</tr>
</table>






O seguinte erro foi encontrado:

<%= exception.printStackTrace()%>

Entre em contato com o administrador do sistema.</td>
</tr>
<tr>
<td colspan=“2”>
<table width=“100%” background="…/_images/index/fd.gif">
<tr>
<td><font class=“c”>EO-Estrat&eacute;gia e Organiza&ccedil;&atilde;o</font></td>
<td align=“center”><font class=“c”>SBS, Ed. Sede III, 18&ordm;
andar - CEP 70073-901</font></td>
<td align=“center”><font class=“c”>Pabx 310.3503 - Fax 310.4184</font></td>
<td align=“right”><font class=“c”> eo@bb.com.br</font></td>
</tr>
</table>
</td>
</tr>
</table>

</html>