Home arrow static arrow Java Programming [Archive] - http status 500 error
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - http status 500 error
This topic has 8 replies on 1 page.

Posts:18
Registered: 7/1/04
http status 500 error  
Jul 1, 2004 12:44 AM



 
hi!

what does the below error says..

http status 500 error..
what could be the problem...? plz help me 2 solve my jsp code
 

Posts:4,500
Registered: 17.04.98
Re: http status 500 error  
Jul 1, 2004 1:45 AM (reply 1 of 8)



 
it means your JSP crashed. Without more information noone here is likely to be able to help you...

Turn off "show friendly HTTP error messages" in IE to see the full error information, check your application server logs, your application logfiles (if any) and post what you find together with relevant code (snippets only please, no 1000 lines and hope someone is going to read it all).
 

Posts:18
Registered: 7/1/04
Re: http status 500 error  
Jul 1, 2004 2:41 AM (reply 2 of 8)



 
<%! String vuser, cenum;%>
<%@page import="javax.servlet.*"%>
<%@page import="javax.servlet.http.*"%>
<%@page import="java.io.*"%>
<%@page import="java.sql.*"%>
<%@page import="java.lang.*"%>
<%@page import="java.util.*"%>
<%@page session="true"%>

<%! Statement stmt; %>
<%! ResultSet rs;%>
<%! Connection con;%>
<%! String pg,topinfo,tinac,tamr,trepo,tdepart,nam; %>
<%! String [] tenum,tename,depa,depa1,depa2;%>
<%! int [] dept1,dept2;%>
<%! int err,cnt1,tdd,tmm,tyy,i,j,cnt2,cnt3,cnt4,cnt5,cnt6,cnt7,cnt8,cnt9,k1,k2,dep1,k3,k4,tmm1,tyy1;%>
<%! Vector tenum2; %>
<% String [] todate,ttimein,tidate,titime;%>
<%! String [] amm={"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; %>
<%
try{vuser=session.getValue("cuser").toString();}catch(Exception e){%> <jsp:forward page="/ohc/sess.jsp"/> <%}
tenum2=new Vector();
tenum = new String[10];
tename=new String[10];
todate=new String[10];
ttimein=new String[10];
tidate=new String[10];
titime=new String[10];
depa=new String[100];
depa1=new String[100];
depa2=new String[100];
dept1=new int[100];
dept2=new int[100];
dep1=0;

try{
Class.forName("oracle.jdbc.driver.OracleDriver");
con= DriverManager.getConnection("jdbc:oracle:thin:@172.16.147.8:1521:ohc","ohc","ohc");
stmt=con.createStatement();
} catch(Exception e){ out.println("Open Problem - "+e.getMessage()); }
try{ session.putValue("opt","1"); } catch(Exception e){out.println("Session put Problem"+e.getMessage());}
try{
rs=stmt.executeQuery("Select ename,enum from einfo order by enum ");
while(rs.next()){
tenum2.addElement(rs.getString("enum"));
}
session.putValue("cenum",tenum2.elementAt(0));}catch(Exception e){}
java.util.Date today = new java.util.Date();
tyy=1900+today.getYear();
tmm=1+today.getMonth();
tdd=today.getDate();
tmm1=1+today.getMonth();
tyy1=1900+today.getYear();

cnt1=0; cnt2=0;

rs=stmt.executeQuery("select * from department order by depname");
while(rs.next()){
depa[dep1]=rs.getString("depname");
if(dep1==0){
tdepart=depa[dep1];
}
dep1++;
}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>OHC- Home Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="wiki/./Mainmenu.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr class="mainmenu"> <td height="80" colspan="2"> <jsp:include page="/ohc/head_page.jsp"/> </td> </tr>
<tr class="mainmenu">
<td width="20%" valign="top" background="wiki/.//ohc/pic/left_bg.jpg">
<table border="0" cellpadding="0" cellspacing="0">
<tr><td background="wiki/.//ohc/pic/main_menu/main_menu.jpg"><jsp:include page="/ohc/menu_list.jsp"/> </td></tr>
</table>
</td>
<td width="80%" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bordercolor="#000000" class="mainmenu">
<td bordercolor="#000000" valign="top">

 

 

<table width="90%" border="1" align="center" bordercolor="#003366">
<tr valign="top" bgcolor="#8E9BB0" class="mainmenu">
<td height="21" colspan="3"><span class="MainMenu"><font color="#FFFFFF">Preferences </font> </span> </td>
</tr>
<tr valign="top" bgcolor="#7396CE" class="mainmenu">
<td width="33%" class="MainMenu"><a href="/ohc/sel_emp.jsp?pg=1" style="text-decoration:none">
<font color="#FFFF00">View existing employee</font></a>
View all the existing employee's with employee name or employee number.
</td>
<td width="33%" class="MainMenu"><a href="/ohc/cre_emp.jsp?page=1" style="text-decoration:none"><font color="#FFFF00">Add a new employee</font></a>
Click here to add a new employee to the database.</td>
<td width="33%"> </td>
</tr>
<tr valign="top" bgcolor="#7396CE" class="mainmenu">
<td class="MainMenu"><a href="/ohc/search.jsp?pg=1&&opt=1" style="text-decoration:none">
<font color="#FFFF00"> Search for an employee</font> </a>
Difficult to find an employee take a search here. Limit your
search with variety of options available.
</td>
<td class="MainMenu"><a href="/ohc/admin.jsp" style="text-decoration:none"><font color="#FFFF00">Administative Options</font></a>
Use this if you want to add or update information to the system. </td>
<td class="MainMenu"><a href="/ohc/add_user.jsp?pg=1" style="text-decoration:none"><font color="#FFFF00">User Information</font></a>
Click here to add or remove users from using the system.</td>
</tr>
</table>

 


<table width="90%" bordercolor="#003366" border="1" align="center">
<tr valign="top" bgcolor="#8E9BB0" class="mainmenu"> <td colspan="3"><span class="MainMenu"><font color="#FFFFFF">Additional Preferences</font> </span> </td> </tr>
<tr bgcolor="#7396CE" class="mainmenu">
<td width="33%" height="99" valign="top"> </td>
<td width="34%" valign="top" class="MainMenu"><a href="/ohc/cpass.jsp?pg=1" style="text-decoration:none"><font color="#FFFF00">Change
Password</font></a>
Click here to change the password of the user who is logged in.
</td>
<td width="33%" valign="top">

<a href="/ohc/help.jsp?pg=TOC" style="text-decoration:none" target="new()"><font color="#FFFF00">How
to use the System</font></a>
Have a look at how to use the system and other various informaion about this tool.

</td>
</tr>
<tr bgcolor="#7396CE" class="mainmenu">
<td width="33%" height="99" valign="top"> </td>
<td width="34%" valign="top" class="MainMenu"><a href="/ohc/search_info.jsp?pg=1" style="text-decoration:none"><font color="#FFFF00">Search for information</font></a>
Click the above link to search for specific information in the tool. Search precisely in the database using the options available.</td>
<td width="33%" valign="top">

<a href="/ohc/utilit.jsp?pg=1" style="text-decoration:none"><font color="#FFFF00">Chronicles</font></a>
Gives information about the list of all activities happened in the past.

</td>
</tr>
</table>

 

 

 

 

 

 

</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

<% try{ rs.close();
stmt.close();
con.close();
} catch(Exception e){} %>


here is the entire coding...

in the error report it says the follwing

http status 500-
type exception report

message

description The server encountered an internal error() that prevented it from fulfilling this request.

Exception

org.apache.jasper.JasperException

root cause

java.lang.NullPointerException
.....it goes on..

 

Posts:5,904
Registered: 04/03/99
Re: http status 500 error  
Jul 1, 2004 2:44 AM (reply 3 of 8)



 

root cause

java.lang.NullPointerException
.....it goes on..


Since "root cause" means "the thing that actually caused this" don't you think that including all of it might have been helpful ?

D.
 

Posts:18
Registered: 7/1/04
Re: http status 500 error  
Jul 1, 2004 2:51 AM (reply 4 of 8)



 
<%! String vuser, cenum;%>
<%@page import="javax.servlet.*"%>
<%@page import="javax.servlet.http.*"%>
<%@page import="java.io.*"%>
<%@page import="java.sql.*"%>
<%@page import="java.lang.*"%>
<%@page import="java.util.*"%>
<%@page session="true"%>

<%! Statement stmt; %>
<%! ResultSet rs;%>
<%! Connection con;%>
<%! String pg,topinfo,tinac,tamr,trepo,tdepart,nam; %>
<%! String [] tenum,tename,depa,depa1,depa2;%>
<%! int [] dept1,dept2;%>
<%! int err,cnt1,tdd,tmm,tyy,i,j,cnt2,cnt3,cnt4,cnt5,cnt6,cnt7,cnt8,cnt9,k1,k2,dep1,k3,k4,tmm1,tyy1;%>
<%! Vector tenum2; %>
<% String [] todate,ttimein,tidate,titime;%>
<%! String [] amm={"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; %>
<%
try{vuser=session.getValue("cuser").toString();}catch(Exception e){%> <jsp:forward page="/ohc/sess.jsp"/> <%}
tenum2=new Vector();
tenum = new String[10];
tename=new String[10];
todate=new String[10];
ttimein=new String[10];
tidate=new String[10];
titime=new String[10];
depa=new String[100];
depa1=new String[100];
depa2=new String[100];
dept1=new int[100];
dept2=new int[100];
dep1=0;

try{
Class.forName("oracle.jdbc.driver.OracleDriver");
con= DriverManager.getConnection("jdbc:oracle:thin:@172.16.147.8:1521:ohc","ohc","ohc");
stmt=con.createStatement();
} catch(Exception e){ out.println("Open Problem - "+e.getMessage()); }
try{ session.putValue("opt","1"); } catch(Exception e){out.println("Session put Problem"+e.getMessage());}
try{
rs=stmt.executeQuery("Select ename,enum from einfo order by enum ");
while(rs.next()){
tenum2.addElement(rs.getString("enum"));
}
session.putValue("cenum",tenum2.elementAt(0));}catch(Exception e){}
java.util.Date today = new java.util.Date();
tyy=1900+today.getYear();
tmm=1+today.getMonth();
tdd=today.getDate();
tmm1=1+today.getMonth();
tyy1=1900+today.getYear();

cnt1=0; cnt2=0;

rs=stmt.executeQuery("select * from department order by depname");
while(rs.next()){
depa[dep1]=rs.getString("depname");
if(dep1==0){
tdepart=depa[dep1];
}
dep1++;
}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>OHC- Home Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="wiki/./Mainmenu.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr class="mainmenu"> <td height="80" colspan="2"> <jsp:include page="/ohc/head_page.jsp"/> </td> </tr>
<tr class="mainmenu">
<td width="20%" valign="top" background="wiki/.//ohc/pic/left_bg.jpg">
<table border="0" cellpadding="0" cellspacing="0">
<tr><td background="wiki/./wiki/.//ohc/pic/main_menu/main_menu.jpg"><jsp:include page="/ohc/menu_list.jsp"/> </td></tr>
</table>
</td>
<td width="80%" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bordercolor="#000000" class="mainmenu">
<td bordercolor="#000000" valign="top">

 

 

<table width="90%" border="1" align="center" bordercolor="#003366">
<tr valign="top" bgcolor="#8E9BB0" class="mainmenu">
<td height="21" colspan="3"><span class="MainMenu"><font color="#FFFFFF">Preferences </font> </span> </td>
</tr>
<tr valign="top" bgcolor="#7396CE" class="mainmenu">
<td width="33%" class="MainMenu"><a href="/ohc/sel_emp.jsp?pg=1" style="text-decoration:none">
<font color="#FFFF00">View existing employee</font></a>
View all the existing employee's with employee name or employee number.
</td>
<td width="33%" class="MainMenu"><a href="/ohc/cre_emp.jsp?page=1" style="text-decoration:none"><font color="#FFFF00">Add a new employee</font></a>
Click here to add a new employee to the database.</td>
<td width="33%"> </td>
</tr>
<tr valign="top" bgcolor="#7396CE" class="mainmenu">
<td class="MainMenu"><a href="/ohc/search.jsp?pg=1&&opt=1" style="text-decoration:none">
<font color="#FFFF00"> Search for an employee</font> </a>
Difficult to find an employee take a search here. Limit your
search with variety of options available.
</td>
<td class="MainMenu"><a href="/ohc/admin.jsp" style="text-decoration:none"><font color="#FFFF00">Administative Options</font></a>
Use this if you want to add or update information to the system. </td>
<td class="MainMenu"><a href="/ohc/add_user.jsp?pg=1" style="text-decoration:none"><font color="#FFFF00">User Information</font></a>
Click here to add or remove users from using the system.</td>
</tr>
</table>

 


<table width="90%" bordercolor="#003366" border="1" align="center">
<tr valign="top" bgcolor="#8E9BB0" class="mainmenu"> <td colspan="3"><span class="MainMenu"><font color="#FFFFFF">Additional Preferences</font> </span> </td> </tr>
<tr bgcolor="#7396CE" class="mainmenu">
<td width="33%" height="99" valign="top"> </td>
<td width="34%" valign="top" class="MainMenu"><a href="/ohc/cpass.jsp?pg=1" style="text-decoration:none"><font color="#FFFF00">Change
Password</font></a>
Click here to change the password of the user who is logged in.
</td>
<td width="33%" valign="top">

<a href="/ohc/help.jsp?pg=TOC" style="text-decoration:none" target="new()"><font color="#FFFF00">How
to use the System</font></a>
Have a look at how to use the system and other various informaion about this tool.

</td>
</tr>
<tr bgcolor="#7396CE" class="mainmenu">
<td width="33%" height="99" valign="top"> </td>
<td width="34%" valign="top" class="MainMenu"><a href="/ohc/search_info.jsp?pg=1" style="text-decoration:none"><font color="#FFFF00">Search for information</font></a>
Click the above link to search for specific information in the tool. Search precisely in the database using the options available.</td>
<td width="33%" valign="top">

<a href="/ohc/utilit.jsp?pg=1" style="text-decoration:none"><font color="#FFFF00">Chronicles</font></a>
Gives information about the list of all activities happened in the past.

</td>
</tr>
</table>

 

 

 

 

 

 

</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

<% try{ rs.close();
stmt.close();
con.close();
} catch(Exception e){} %>


root cause:

java.lang.NullPointerEXception
at org.apach.jsp.emp_home_jsp

 

Posts:5,904
Registered: 04/03/99
Re: http status 500 error  
Jul 1, 2004 5:15 AM (reply 5 of 8)



 

You typed that in, not cut & paste. Was there any more to it ? Or was it just that line ? If just that line, no probs; but otherwise it might have helpful info.

D.
 

Posts:18
Registered: 7/1/04
Re: http status 500 error  
Jul 1, 2004 9:24 PM (reply 6 of 8)



 
just that line
 

Posts:5,904
Registered: 04/03/99
Re: http status 500 error  
Jul 2, 2004 12:20 AM (reply 7 of 8)



 
My guess would be that you're failing to create a connection to the database. That would result in a null connection reference, and you'll get a null pointer exception subsequently.

It's a good idea to try to have as little code as possible in your JSP pages - here you're doing the entire database handling, including hard coded username, password & connection details for your database !

Dave,
 

Posts:4,500
Registered: 17.04.98
Re: http status 500 error  
Jul 2, 2004 6:27 AM (reply 8 of 8)



 
not to mention the host of static variables declared, which include the database connection. YUGH!
 
This topic has 8 replies on 1 page.