Cannot create bean of class Error

Ok first off I realize several people have post messages similar to this - but the replys to those messages didn't help me:

Today the webserver I had my code on crashed - and was restarted.

Everything is working except for 1 page.

When I load it I get this error:

Error: 500

Location: /dynamic/VOTE_chart.jsp

Internal Servlet Error:

javax.servlet.ServletException: Cannot create bean of class update.VoteBean

at _0002fVOTE_0005fchart_0002ejspVOTE_0005fchart_jsp_6._jspService(_0002fVOTE_0005fchart_0002ejspVOTE_0005fchart_jsp_6.java:71)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)

at org.apache.tomcat.core.Handler.service(Handler.java:286)

at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)

at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)

at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)

at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)

at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)

at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)

at java.lang.Thread.run(Thread.java:484)

This tells my sod all what's actually wrong - I've tried renaming the jsp, I've tried renaming and recompiling the bean but that didn't help either (yes I redirected towards page to the new bean).

No-one here has a clue what the hell has gone wrong with this - especially cos I have at least 15 other beans in exactly the same place and they all work fine.

If you wish I'll post the code of the relevant jsp here.

Any suggestions?

[2269 byte] By [Greebo] at [2007-9-26 4:44:45]
# 1
Post the code.
joseph_schlecht at 2007-6-29 18:33:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

most of this is irrelevent but you should be able to find what you need

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta Http-Equiv="Cache-Control" Content="no-cache">

<meta Http-Equiv="Pragma" Content="no-cache">

<script language="JavaScript">

<!--

function MM_swapImgRestore() { //v3.0

var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

function MM_preloadImages() { //v3.0

var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

function MM_findObj(n, d) { //v3.0

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document); return x;

}

function MM_swapImage() { //v3.0

var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//-->

</script>

</head>

<body bgcolor="#000066" onLoad="MM_preloadImages('images/previousOver.jpg','images/backOver.jpg')" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<jsp:useBean id="myBean" class= "update.VoteBean" scope="page" /> <jsp:setProperty name="myBean" property="*" />

<%

if (!myBean.isDone())

{%>

<form method="post">

<table width="422" border="0" cellspacing="0" cellpadding="0" align="center" height="225">

<tr>

<td colspan="3" height="32"><img src="images/vote.jpg" width="480" height="42"></td>

</tr>

<tr bgcolor="#000066">

<td colspan="3" height="32">

<div align="left"><b><font face="Arial, Helvetica, sans-serif" size="4" color="#cc0033">previous

results </font></b></div>

</td>

</tr>

<tr>

<td colspan="3" height="69">

<div align="center"><a href="VOTE_previous.jsp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image9','','images/previousOver.jpg',1)"><img name="Image9" border="0" src="images/previous.jpg" width="160" height="23"></a></div>

</td>

</tr>

<tr>

<td colspan="3" height="32"><b><font face="Arial, Helvetica, sans-serif" size="4" color="#cc0033">this

months vote</font></b></td>

</tr>

<tr>

<td colspan="3" height="54">

<div align="left"> <font face="Arial, Helvetica, sans-serif" size="2" color="ffcc00"><%=myBean.getQuestion()%>

</font></div>

</td>

</tr>

</table>

<table width="474" border="0" cellspacing="1" cellpadding="1" align="center" height="68">

<tr>

<td width="206">

<div align="left"> <font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">

<input type="radio" name="radiobutton" value="ONE">

<%=myBean.getOption1()%></font> </div>

</td>

<% double thisVote=Double.parseDouble(myBean.getVotes1());

double overall=myBean.getTotalVotes();

double ans=(thisVote/overall)*100*3;

int intAns=(int)Math.round(ans);

%>

<td width="253"><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF"><img src="images/bar_white.jpg" width="<%=intAns%>" height="10">

<%=intAns/3%>%</font> </td>

</tr>

<tr>

<td width="206" height="2">

<div align="left"> <font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">

<input type="radio" name="radiobutton" value="TWO">

<%=myBean.getOption2()%></font> </div>

</td>

<% thisVote=Double.parseDouble(myBean.getVotes2());

overall=myBean.getTotalVotes();

ans=(thisVote/overall)*100*3;

intAns=(int)Math.round(ans);

%>

<td width="253" height="2"><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF"><img src="images/bar_white.jpg" width="<%=intAns%>" height="10">

<%=intAns/3%>%</font> </td>

</tr>

<tr>

<td width="206" height="2">

<div align="left"> <font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">

<input type="radio" name="radiobutton" value="THREE">

<%=myBean.getOption3()%></font> </div>

</td>

<% thisVote=Double.parseDouble(myBean.getVotes3());

overall=myBean.getTotalVotes();

ans=(thisVote/overall)*100*3;

intAns=(int)Math.round(ans);

%>

<td width="253" height="2"><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF"><img src="images/bar_white.jpg" width="<%=intAns%>" height="10">

<%=intAns/3%>%</font> </td>

</tr>

<tr>

<td width="206" height="2">

<div align="left"> <font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">

<input type="radio" name="radiobutton" value="FOUR">

<%=myBean.getOption4()%></font> </div>

</td>

<% thisVote=Double.parseDouble(myBean.getVotes4());

overall=myBean.getTotalVotes();

ans=(thisVote/overall)*100*3;

intAns=(int)Math.round(ans);

%>

<td width="253" height="2"><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF"><img src="images/bar_white.jpg" width="<%=intAns%>" height="10">

<%=intAns/3%>%</font> </td>

</tr>

<tr>

<td width="206" height="2">

<div align="left"> <font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">

<input type="radio" name="radiobutton" value="FIVE">

<%=myBean.getOption5()%></font> </div>

</td>

<% thisVote=Double.parseDouble(myBean.getVotes5());

overall=myBean.getTotalVotes();

ans=(thisVote/overall)*100*3;

intAns=(int)Math.round(ans);

%>

<td width="253"><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF"><img src="images/bar_white.jpg" width="<%=intAns%>" height="10">

<%=intAns/3%>%</font> </td>

</tr>

</table>

<p align="center">

<input type="submit" name="Submit" value="Cast a Vote">

</p>

<p align="center"> </p>

<p align="center"> </p>

<p align="center"> </p>

<p align="center"> </p>

<p align="center"> </p>

<p align="center"> </p>

<p align="center"> </p>

<p align="center"> </p>

<p align="center"> </p>

</form>

<%

}

else

{

myBean.setDone(false);

String done=myBean.checkVote();

if (done.equals("OK"))

{

System.out.println("OK");

%>

<table width="424" border="0" cellspacing="0" cellpadding="0" align="center" height="103">

<tr bgcolor="#000066">

<td height="43" colspan="2"><img src="images/vote.jpg" width="480" height="42"></td>

</tr>

<tr bgcolor="#000066">

<td height="43" colspan="2">

<div align="left"><b><font face="Arial, Helvetica, sans-serif" size="4" color="#cc0033">complete

</font></b></div>

</td>

</tr>

</table>

<table width="463" border="0" cellspacing="3" cellpadding="4" align="center">

<tr>

<td width="327"><font face="Arial, Helvetica, sans-serif" size="1" color="#ffcc00">Thank

you for voting. Your vote will be instantly added to the calculations.</font></td>

<td width="109"> </td>

</tr>

</table>

<table width="461" border="0" cellspacing="3" cellpadding="4" align="center">

<tr>

<td height="53">

<div align="center"> <a href="http://nsdev.isport.net.au/dynamic/main_page.jsp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image10','','images/backOver.jpg',1)"><img name="Image10" border="0" src="images/back.jpg" width="160" height="23"></a></div>

</td>

</tr>

<tr>

<td height="397"> </td>

</tr>

</table>

<%}else{

System.out.println("Not equal or fell over");%>

<table width="454" border="0" cellspacing="0" cellpadding="0" align="center" height="103">

<tr bgcolor="#000066">

<td height="43" colspan="2"><img src="images/vote.jpg" width="480" height="42"></td>

</tr>

<tr bgcolor="#000066">

<td height="43" colspan="2">

<div align="left"><b><font face="Arial, Helvetica, sans-serif" size="4" color="#cc0033">sorry

</font></b></div>

</td>

</tr>

</table>

<table width="469" border="0" cellspacing="3" cellpadding="4" align="center">

<tr>

<td width="327"><font face="Arial, Helvetica, sans-serif" size="1" color="#ffcc00">There

has been a problem casting your vote. Please try again later.</font></td>

<td width="115"> </td>

</tr>

</table>

<table width="467" border="0" cellspacing="3" cellpadding="4" align="center">

<tr>

<td height="37">

<div align="center"> <a href="http://nsdev.isport.net.au/dynamic/main_page.jsp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image101','','images/backOver.jpg',1)"><img name="Image101" border="0" src="images/back.jpg" width="160" height="23"></a>

</div>

</td>

</tr>

<tr>

<td height="560"> </td>

</tr>

</table>

<%}

}

%>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<p> </p>

</body>

</html>

Greebo at 2007-6-29 18:33:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

> Ok first off I realize several people have post

> messages similar to this - but the replys to those

> messages didn't help me:

>

> Today the webserver I had my code on crashed - and > was

> restarted.

>

> Everything is working except for 1 page.

[snip]

I didn't see any syntax errors in the code that you posted. Did this page ever compile? Did it compile into a servlet correctly before your webserver crashed and was restarted?

joseph_schlecht at 2007-6-29 18:33:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

In the class update.VoteBean, do you have any member variable that is not a plain old thing that the Beans framework can initialize ?

For example, does update.VoteBean have any data member that is an instance of another class in turn ? If yes, make sure you are initializing it.

neville_sequeira at 2007-6-29 18:33:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

The code worked fine before the webserver crashed - that's the most preplexing thing about this.

And it works as it should do on the development box which is *exactly* the same setup

The bean doesn't initialize other classes but I've got other beans that do and they work fine so that's not a problem.

All other beans in the same location are absolutely fine - this is the only one that's giving me hell (and starting to give a splitting headache)

Greebo at 2007-6-29 18:33:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

I have experienced this error only under the conditions that I mentioned in my previous message.

And I am sure it went away when I put in code in the bean class to initialize the bean class's data members that were themselves other class types !

Hmmm.....

Very perplexing indeed !

neville_sequeira at 2007-6-29 18:33:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
If you haven't already, try deleting:_0002fVOTE_0005fchart_0002ejspVOTE_0005fchart_jsp_6.java
joseph_schlecht at 2007-6-29 18:33:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
Just deleted that file and a few versions that came before it - didn't help - nice suggestion though
Greebo at 2007-6-29 18:33:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9
Ok, after much testing and guessing we've worked out that the problem isn't the jsp page or the beanit's the inf flat fileWhich for some reason contains, quite literally, sod allMust've got corrupted in the crashSorry for wasting your time folks
Greebo at 2007-6-29 18:33:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...