java.lang.OutOfMemoryError

I get the following java.lang.OutOfMemoryError when running the following JSP. Anybody got an idea why?

=======================================================

Error:

=======================================================

500 Internal Server Error

Error parsing JSP page /addclient.jsp

Syntax error in source

The system is out of resources.

Consult the following stack trace for details.

java.lang.OutOfMemoryError: Java heap space

at java.util.zip.ZipEntry.initFields(Native Method)

at java.util.zip.ZipEntry.<init>(Unknown Source)

at java.util.zip.ZipFile$2.nextElement(Unknown Source)

at java.util.zip.ZipFile$2.nextElement(Unknown Source)

at com.sun.tools.javac.util.DefaultFileManager$ZipArchive.<init>(DefaultFileManager.java:405)

at com.sun.tools.javac.util.DefaultFileManager.openArchive(DefaultFileManager.java:542)

at com.sun.tools.javac.util.DefaultFileManager.listDirectory(DefaultFileManager.java:278)

at com.sun.tools.javac.util.DefaultFileManager.list(DefaultFileManager.java:768)

at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2089)

at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1778)

at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)

at com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:272)

at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:446)

at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:236)

at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:250)

at com.sun.tools.javac.comp.Enter.complete(Enter.java:444)

at com.sun.tools.javac.comp.Enter.main(Enter.java:429)

at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:819)

at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)

at com.sun.tools.javac.main.Main.compile(Main.java:353)

at com.sun.tools.javac.main.Main.compile(Main.java:279)

at com.sun.tools.javac.main.Main.compile(Main.java:270)

at com.sun.tools.javac.Main.compile(Main.java:69)

at com.sun.tools.javac.Main.main(Main.java:54)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.evermind._qq._elb(Unknown Source)

at com.evermind._xq.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at com.evermind._hx._xr(Unknown Source)

=======================================================

Code:

=======================================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page session="true"%>

<HTML>

<HEAD>

<TITLE>Member Login</TITLE>

<STYLE type="">

body{font-family:arial;}

a{color:black;text-decoration:none;font:bold}

a:hover{color:#606060}

td.menu{background:lightblue}

table.menu

{

font-size:100%;

position:absolute;

visibility:hidden;

}

</STYLE>

<SCRIPT type="text/javascript">

function showmenu(elmnt)

{

document.getElementById(elmnt).style.visibility="visible"

}

function hidemenu(elmnt)

{

document.getElementById(elmnt).style.visibility="hidden"

}

</SCRIPT>

</HEAD>

<BODY bgcolor="#COCOCO">

<%

String firstname="";

String surname="";

String address="";

String postcode="";

String city="";

String country="";

String contact="";

String tel="";

String gsm="";

String fax="";

String email="";

String company="company";

String description="";

if (session.getAttribute("firstname")!=null) firstname = (String) session.getAttribute("firstname");

//if (!hs.getAttribute("surname").equals(null)) surname = (String) hs.getAttribute("surname");

//if (!hs.getAttribute("address").equals(null)) address = (String) hs.getAttribute("address");

//if (!hs.getAttribute("postcode").equals(null)) postcode = (String) hs.getAttribute("postcode");

//if (!hs.getAttribute("city").equals(null)) city = (String) hs.getAttribute("city");

//if (!hs.getAttribute("country").equals(null)) country = (String) hs.getAttribute("country");

//if (!hs.getAttribute("contact").equals(null)) contact = (String) hs.getAttribute("contact");

//if (!hs.getAttribute("tel").equals(null)) tel = (String) hs.getAttribute("tel");

//if (!hs.getAttribute("gsm").equals(null)) gsm = (String) hs.getAttribute("gsm");

//if (!hs.getAttribute("fax").equals(null)) fax = (String) hs.getAttribute("fax");

//if (!hs.getAttribute("email").equals(null)) email = (String) hs.getAttribute("email");

//if (!hs.getAttribute("company").equals(null)) company = (String) hs.getAttribute("company");

//if (!hs.getAttribute("description").equals(null)) description = (String) hs.getAttribute("description");

%>

<DIV align="center">

<TABLE height="175" cellspacing="0" cellpadding="0" width="760"

border="0" bgcolor="white">

<TBODY>

<TR>

<TD width="20" bgcolor="#C0C0C0" height="20">?lt;/TD>

<TD width="140" bgcolor="#C0C0C0" height="20">?lt;/TD>

<TD width="20" bgcolor="#C0C0C0" height="20">?lt;/TD>

<TD width="560" bgcolor="#C0C0C0" height="20">?lt;/TD>

<TD width="20" bgcolor="#C0C0C0" height="20">?lt;/TD>

</TR>

<TR>

<TD valign="top" align="right" width="20" bgcolor="#CCCCFF"

height="135">?lt;/TD>

<TD valign="top" align="center" width="140" bgcolor="#ffffff"

height="135">

<TABLE cellspacing="0" cellpadding="2" width="140" border="0"

height="359">

<TBODY>

<TR>

<TD valign="top" align="left" bgcolor="#CCCCFF" height="355">

<P align="center">

?lt;FONT face="arial" color="#000000" size="1"><IMG

src="Pic/glass.jpg" width="120" height="420" align="middle"

alt=""></FONT></P>

</TD>

</TR>

</TBODY>

</TABLE>

</TD>

<TD valign="top" align="right" width="20" bgcolor="#CCCCFF"

height="135">?lt;/TD>

<TD valign="top" align="center" width="560" height="135">

<TABLE cellspacing="0" cellpadding="2" width="560" border="0">

<TR bgcolor="#CCCCFF">

<TD onmouseover="showmenu('home')" onmouseout="hidemenu('menu')"><FONT

size="2"> <A href="/Home.html">Home</A>

</FONT></TD>

<TD onmouseover="showmenu('client')"

onmouseout="hidemenu('client')"><FONT size="2"> <B>Client</B>

<TABLE class="menu" id="client" width="120">

<TR>

<TD class="menu"><A href="/client.html">Add client</A></TD>

</TR>

<TR>

<TD class="menu"><A href="/client.jsp">Find client</A></TD>

</TR>

<TR>

<TD class="menu"><A href="/client.html">Add chantier</A></TD>

</TR>

<TR>

<TD class="menu"><A href="/client.jsp">Find chantier</A></TD>

</TR>

</TABLE>

</FONT></TD>

<TD onmouseover="showmenu('facture')"

onmouseout="hidemenu('facture')"><FONT size="2"> <B>Facture</B>

<TABLE class="menu" id="facture" width="120">

<TR>

<TD class="menu"><A href="/facture.html">Add facture</A></TD>

</TR>

<TR>

<TD class="menu"><A href="/facture.jsp">Find facture</A></TD>

</TR>

</TABLE>

</FONT></TD>

<TD onmouseover="showmenu('devis')" onmouseout="hidemenu('devis')"><FONT

size="2"> <B>Devis</B>

<TABLE class="menu" id="devis" width="120">

<TR>

<TD class="menu"><A href="/devis.html">Add devis</A></TD>

</TR>

<TR>

<TD class="menu"><A href="/devis.jsp">Find devis</A></TD>

</TR>

</TABLE>

</FONT></TD>

<TD onmouseover="showmenu('visite')"

onmouseout="hidemenu('visite')"><FONT size="2"> <B>Visite</B>

<TABLE class="menu" id="visite" width="120">

<TR>

<TD class="menu"><A href="/visite.html">Add visite</A></TD>

</TR>

<TR>

<TD class="menu"><A href="/visite.jsp">Find visite</A></TD>

</TR>

</TABLE>

</FONT></TD>

</TR>

</TABLE>

<TABLE cellspacing="0" cellpadding="20" width="560" border="0"

bgcolor="white" height="312">

<TBODY>

<TR>

<TD height="272">

<DIV align="center">

<H1>Create a new Client</H1>

<P>Please enter the following information to create a new

client.</P>

<TABLE height="242">

<TR>

<TD valign="top" height="177">

<FORM action="http://localhost/servlet/addclient" method="get">

<TABLE>

<TR>

<TD>First Name:</TD>

<TD><INPUT type="text" name="firstname" size="20"

value="<%=firstname%>"></TD>

</TR>

<TR>

<TD>Surame:</TD>

<TD><INPUT type="text" name="surname" size="20"

value="<%=surname%>"></TD>

</TR>

<TR>

<TD>Address:</TD>

<TD><INPUT type="text" name="address" size="20"

value="<%=address%>"></TD>

</TR>

<TR>

<TD>Post Code:</TD>

<TD><INPUT type="text" name="postcode" size="20"

value="<%=postcode%>"></TD>

</TR>

<TR>

<TD>City:</TD>

<TD><INPUT type="text" name="city" size="20"

value="<%=city%>"></TD>

</TR>

<TR>

<TD>Country:</TD>

<TD><INPUT type="text" name="country" size="20"

value="<%=country%>"></TD>

</TR>

</TABLE>

</FORM>

</TD>

<TD valign="top" height="177">

<TABLE>

<TR>

<TD>Contact:</TD>

<TD><INPUT type="text" name="contact" size="20"

value="<%=contact%>"></TD>

</TR>

<TR>

<TD>Tel:</TD>

<TD colspan="2"><INPUT type="text" name="tel" size="20"

value="<%=tel%>"></TD>

</TR>

<TR>

<TD>GSM:</TD>

<TD colspan="2"><INPUT type="text" name="gsm" size="20"

value="<%=gsm%>"></TD>

</TR>

<TR>

<TD>Fax:</TD>

<TD colspan="2"><INPUT type="text" name="fax" size="20"

value="<%=fax%>"></TD>

</TR>

<TR>

<TD>E-mail:</TD>

<TD colspan="2"><INPUT type="text" name="email" size="20"

value="<%=email%>"></TD>

</TR>

<TR>

<TD colspan="2" align="center">Company<INPUT type="radio"

name="company" value="company"

><% if (company.equals("company")) {%> checked <%}%>>

Individual<INPUT type="radio" name="company"

value="individual" ><% if (company.equals("individual")) {%>

checked <%}%>></TD>

</TR>

</TABLE>

</TD>

</TR>

<TR>

<TD>Description:</TD>

</TR>

<TR>

<TD colspan="2" align="center"><TEXTAREA name="description"

cols="43" rows="3"><%=description%></TEXTAREA></TD>

</TR>

<TR>

<TD colspan="2" align="center"><INPUT type="submit"

value="Add User"><INPUT type="reset"></TD>

</TR>

</TABLE>

<FORM action=""></FORM>

</DIV>

</TD>

</TR>

</TBODY>

</TABLE>

</TD>

<TD valign="top" align="right" width="20" bgcolor="#CCCCFF"

height="135">?lt;/TD>

</TR>

<TR>

<TD width="20" bgcolor="#CCCCFF" height="20">?lt;/TD>

<TD width="140" bgcolor="#CCCCFF" height="20"></TD>

<TD width="20" bgcolor="#CCCCFF" height="20">?lt;/TD>

<TD width="560" bgcolor="#CCCCFF" height="20">?lt;/TD>

<TD width="20" bgcolor="#CCCCFF" height="20">?lt;/TD>

</TR>

</TBODY>

</TABLE>

</DIV>

</BODY>

</HTML>

[13669 byte] By [claudefabera] at [2007-11-27 5:26:34]
# 1
It might generate too large data or something object creation may be looped infinitely. Limit the data and check.
skp71a at 2007-7-12 14:47:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
the program may run out of space or heap size. please check that also and finally check your code....
loguKKa at 2007-7-12 14:47:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
What should one do if the error is related to "Heap size"Please advice..
Java-Manoja at 2007-7-12 14:47:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
How is one supposed to read your code?
Nidhuggura at 2007-7-12 14:47:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Please see the source of http://claudefaber.files-upload.com/253238/addclient.java.htmlfor a readable version of the code.
claudefabera at 2007-7-12 14:47:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...