aspose file tools*
The moose likes JSP and the fly likes WARNING: Servlet jsp is currently unavailable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "WARNING: Servlet jsp is currently unavailable" Watch "WARNING: Servlet jsp is currently unavailable" New topic
Author

WARNING: Servlet jsp is currently unavailable

gurudev arer
Greenhorn

Joined: Apr 01, 2008
Posts: 6
Hi,
I am getting [code=java]"WARNING: Servlet jsp is currently unavailable"[/code] warning in tomcat log of our site.

It is a transactional site. it constantly communicates with the database. Now we are frequently getting this warning message.

whenever this warning comes the system hangs and stops communicating with the database. we have to restart the tomcat server to make it work again.

Thanks for your time and please advice.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Are you doing any costly operation under servlets init method ??

This error comes , when your servlet is busy processing existing threads and it is not avilable to serve other Threads / Requests .

So in order to get more help from forum , try to post the code of the Servlet if possible or avoid doing costly operations from servlets methods .

Thanks .


Save India From Corruption - Anna Hazare.
gurudev arer
Greenhorn

Joined: Apr 01, 2008
Posts: 6
Hi Ravi,
Thanks for the response. It is a simple struts application. There are no costly methods involved.

It is a prepaid milk distribution project. We communicate with the database just to update and retrieve few things.

For example, we have few customers,as it is a prepaid milk distribution, we select a customer and do recharges for them one after the other.

After recharging for 4 customers continuously one after the other, the site hangs with the above warning.



Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Is it possible for you to post the servlet code ??

gurudev arer
Greenhorn

Joined: Apr 01, 2008
Posts: 6
JSP :

[code=java]
<%@ page import="java.sql.*"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ page import="java.text.DateFormat"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="java.util.Calendar"%>
<%@ page import="java.util.Date"%>
<%@page import="app.dao.mydao.*" %>
<HEAD>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript">
javascript:window.history.forward(-1);
</SCRIPT>
<STYLE TYPE="text/css">
#loading
{
width: 200px;
height: 100px;
background-color: #c0c0c0;
position: absolute;
left: 50%;
top: 50%;
margin-top: -50px;
margin-left: -100px;
text-align: center;
}
</STYLE>
<SCRIPT TYPE="text/javascript">
document.write('<div id="loading"><br><br>Please wait...</div>');
window.onload=function()
{
document.getElementById("loading").style.display="none";
}
</SCRIPT>
<%
Integer cid=(Integer)session.getAttribute("user_id");
String customerid=cid.toString();
dao c=new dao();
String abc=c.ReturnDeliveryTime(customerid);
%>
<SCRIPT LANGUAGE="javascript" TYPE="text/javascript">
var winConfirm = null;
var test='<%=abc%>';
function updateLitres()
{
var num_litres= document.AdminSubmitForm.number_litre.value;
if(num_litres.length == 0)
{
alert('Number of litres to update is not specified.');
return false;
}
var windowWidth = 250;
var windowHeight = 100;
var frmdte = document.getElementById("from_date");
var fromdate = frmdte.options[frmdte.selectedIndex].text;
var locX = ( screen.width - windowWidth ) / 2;
var locY = ( screen.height - windowHeight ) / 2;
var windowFeatures = "width=" + windowWidth + ",height=" + windowHeight + ",screenX=" + locX + ",screenY=" + locY + ",left=" + locX + ",top=" + locY; /* Close window first to make sure that our window has */ /* the desired features */
if ( ( winConfirm != null ) && !winConfirm.closed )
{
winConfirm.close();
}
/* Open the new confirm */
winConfirm = open( "", "winConfirm", windowFeatures );
/* Write to the confirm box */
var theHTML = '<HEAD><TITLE>Please choose...</TITLE></HEAD>'
+ '<BODY BGCOLOR="#FFFFFF">'
+ '<CENTER><B>'
+ 'You are updating '+document.AdminSubmitForm.number_litre.value
+ ' litres of milk from date '+fromdate
+ '</B><FORM NAME="UserForm">'
+ '<INPUT TYPE="button" VALUE=" CONFIRM "'
+ ' ONCLICK="opener.buttonClicked(1);self.close();">'
+ ' '
+ '<INPUT TYPE="button" VALUE="CANCEL"'
+ ' ONCLICK="opener.buttonClicked(4);self.close();">'
+ '</FORM></BODY>';
winConfirm.document.writeln( theHTML );
}
function updateRequestLitres()
{
var num_litres= document.AdminSubmitForm.request_litre_number_litre.value;
if(num_litres.length == 0)
{
alert('Number of litres to update is not specified.');
return false;
}
var windowWidth = 250;
var windowHeight = 150;
var frmdte = document.getElementById("request_litre_from_date");
var fromdate = frmdte.options[frmdte.selectedIndex].text;
var todte = document.getElementById("request_litre_to_date");
var todate = todte.options[todte.selectedIndex].text;
var locX = ( screen.width - windowWidth ) / 2;
var locY = ( screen.height - windowHeight ) / 2;
var windowFeatures = "width=" + windowWidth + ",height=" + windowHeight + ",screenX=" + locX + ",screenY=" + locY + ",left=" + locX + ",top=" + locY; /* Close window first to make sure that our window has */ /* the desired features */
if ( ( winConfirm != null ) && !winConfirm.closed )
{
winConfirm.close();
}
/* Open the new confirm */
winConfirm = open( "", "winConfirm", windowFeatures );
/* Write to the confirm box */
var theHTML = '<HEAD><TITLE>Please choose...</TITLE></HEAD>'
+ '<BODY BGCOLOR="#FFFFFF">'
+ '<CENTER><B>'
+ 'You are updating requested litre of milk to '+document.AdminSubmitForm.request_litre_number_litre.value
+ ' from date '+fromdate
+ ' To '+todate
+ '</B><FORM NAME="UserForm">'
+ '<INPUT TYPE="button" VALUE=" CONFIRM "'
+ ' ONCLICK="opener.buttonClicked(2);self.close();">'
+ ' '
+ '<INPUT TYPE="button" VALUE="CANCEL"'
+ ' ONCLICK="opener.buttonClicked(4);self.close();">'
+ '</FORM></BODY>';
winConfirm.document.writeln( theHTML );
}

function updateRecharge()
{
var rechargeamt= document.AdminSubmitForm.recharge_amount.value;
var receiptnum= document.AdminSubmitForm.receipt_number.value;
var collectorname= document.AdminSubmitForm.collecter_name.value;
if(rechargeamt.length == 0)
{
alert('Recharge amount is not specified.');
return false;
}
if(receiptnum.length == 0)
{
alert('Receipt number is not specified.');
return false;
}
if(collectorname.length == 0)
{
alert('Collector name is not specified.');
return false;
}
var windowWidth = 250;
var windowHeight = 100;
var locX = ( screen.width - windowWidth ) / 2;
var locY = ( screen.height - windowHeight ) / 2;
var windowFeatures = "width=" + windowWidth + ",height=" + windowHeight + ",screenX=" + locX + ",screenY=" + locY + ",left=" + locX + ",top=" + locY; /* Close window first to make sure that our window has */ /* the desired features */
if ( ( winConfirm != null ) && !winConfirm.closed )
{
winConfirm.close();
}
/* Open the new confirm */
winConfirm = open( "", "winConfirm", windowFeatures );
/* Write to the confirm box */
var theHTML = '<HEAD><TITLE>Please choose...</TITLE></HEAD>'
+ '<BODY BGCOLOR="#FFFFFF">'
+ '<CENTER><B>'
+ 'Recharging Amount of rupees '+document.AdminSubmitForm.recharge_amount.value
+ '</B><FORM NAME="UserForm">'
+ '<INPUT TYPE="button" VALUE=" CONFIRM "'
+ ' ONCLICK="opener.buttonClicked(2);self.close();">'
+ ' '
+ '<INPUT TYPE="button" VALUE="CANCEL"'
+ ' ONCLICK="opener.buttonClicked(4);self.close();">'
+ '</FORM></BODY>';
winConfirm.document.writeln( theHTML );
}
function updateDeliverytime(form)
{
if(test.length==4)
{
var deliveryT=document.getElementById("dtime");
var delivery_time=deliveryT.options[deliveryT.selectedIndex].text;
var EffectiveDate=form.Effective_Date.value;
var windowWidth = 300;
var windowHeight = 150;
var locX = ( screen.width - windowWidth ) / 2;
var locY = ( screen.height - windowHeight ) / 2;
var windowFeatures = "width=" + windowWidth + ",height=" + windowHeight + ",screenX=" + locX + ",screenY=" + locY + ",left=" + locX + ",top=" + locY; /* Close window first to make sure that our window has */ /* the desired features */
if ( ( winConfirm != null ) && !winConfirm.closed )
{
winConfirm.close();
}
winConfirm = open( "", "winConfirm", windowFeatures );
var theHTML = '<HEAD><TITLE>Please choose...</TITLE></HEAD>'
+ '<BODY BGCOLOR="#FFFFFF">'
+ '<CENTER><B>'
+ 'Updating Delivery time to "'+delivery_time+'"'
+'<BR/>'
+ 'From Effective Date: '+EffectiveDate
+ '</B><FORM NAME="UserForm">'
+ '<INPUT TYPE="button" VALUE=" CONFIRM "'
+ ' ONCLICK="opener.buttonClicked(3);self.close();">'
+ ' '
+ '<INPUT TYPE="button" VALUE="CANCEL"'
+ ' ONCLICK="opener.buttonClicked(4);self.close();">'
+ '</FORM></BODY>';
winConfirm.document.writeln( theHTML );
return true;
}
if(test.length>4)
{
alert('Cannot change Delivery Time.Delivery Time for this Customer is already changed from '+test);
return false;
}
}

function buttonClicked( buttonChoice )
{
/* Put in this function the result of the user's choice */ /* (in this case, write the user's choice in a textfield) */
switch( buttonChoice )
{
case 1:
document.AdminSubmitForm.action="<%=request.getContextPath()%>/AdminSubmitLitres.do" ;
document.AdminSubmitForm.submit();
break;

case 2:
document.AdminSubmitForm.action="<%=request.getContextPath()%>/AdminSubmitRecharge.do" ;
document.AdminSubmitForm.submit();
break;
case 3:
document.AdminSubmitForm.action ="<%=request.getContextPath()%>/AdminUpdateDeliverytime.do";
document.AdminSubmitForm.submit();
break;

case 4:
document.AdminSubmitForm.action="<%=request.getContextPath()%>/Admin.do" ;
document.AdminSubmitForm.submit();
break;


}
}

</SCRIPT>
<%
String conn_url = "*****************************";
String username="********";
String password="************";
String name = (String) session.getAttribute("txt_name");
Integer id = (Integer) session.getAttribute("user_id");
%>

</HEAD>
<HTML>
<html:form action="/Admin.do" method="post">
<BODY STYLE="margin: 0;" BGCOLOR="FFEBCC">
<html:errors />
<CENTER>
<TABLE ALIGN="center" BORDER="0" WIDTH="100%" HEIGHT="100%" CELLPADDING="0" CELLSPACING="0" STYLE="margin: 0; list-style: none;padding:0;">

<TR HEIGHT="90%">
<TD>
<TABLE BORDER="0" HEIGHT="100%" WIDTH="100%" CELLPADDING="0" CELLSPACING="0" >

<TR HEIGHT="5%" BGCOLOR="FFEBCC">
<TD>
<FIELDSET STYLE="border-color: #8A5C2E"><LEGEND STYLE="font-weight:bolder;font-size:14px;; color=#8A5C2E;">REQUESTED LITRES CHANGE</LEGEND>
<TABLE WIDTH="100%" HEIGHT="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR HEIGHT="100%">
<TD WIDTH="15%" ALIGN="right"><FONT SIZE="3" color="#8A5C2E">From Date:</FONT></TD>
<TD WIDTH="15%"> 
<SELECT NAME="request_litre_from_date" />
<%
Connection connection6 = null;
Statement statement6 = null;
ResultSet rs6 = null;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection6 = DriverManager.getConnection(conn_url, username,password);
statement6 = connection6.createStatement();
String QueryString6 = "SELECT date_format(order_date,'%d-%b-%Y') from oxy_orders where customer_id=13 and order_date >= DATE(CONVERT_TZ(sysdate(),'+00:00','+10:30'))";
rs6 = statement6.executeQuery(QueryString6);
while (rs6.next())
{
%> <OPTION><%=rs6.getString(1)%></OPTION> <%
}

%>
</SELECT>
</TD>
<TD WIDTH="15%" ALIGN="right"><FONT SIZE="3" color="#8A5C2E">To Date:</FONT></TD>
<TD WIDTH="15%"> 
<SELECT NAME="request_litre_to_date" />
<%
Connection connection7 = null;
Statement statement7 = null;
ResultSet rs7 = null;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection7 = DriverManager.getConnection(conn_url, username,password);
statement7 = connection7.createStatement();
String QueryString7 = "SELECT date_format(order_date,'%d-%b-%Y') from oxy_orders where customer_id=13 and order_date >= DATE(CONVERT_TZ(sysdate(),'+00:00','+10:30'))";
rs7 = statement7.executeQuery(QueryString7);
while (rs7.next())
{
%> <OPTION><%=rs7.getString(1)%></OPTION> <%
}
}
catch (Exception ex1)
{
%><FONT SIZE="+3" COLOR="green"> <% out.println("Unable to connect to database.");

} %>
<%
finally
{
rs7.close();
statement7.close();
connection7.close();
}
%>
</SELECT>
</TD>
<TD WIDTH="15%" ALIGN="right"><FONT SIZE="3" color="#8A5C2E">No. Of Litres:</FONT></TD>
<TD WIDTH="15%"> <INPUT TYPE="text" NAME="request_litre_number_litre" SIZE="15" /></TD>
<TD WIDTH="15%" ALIGN="center"><INPUT TYPE="button" NAME="Update" VALUE="Update" ONCLICK="javascript:updateRequestLitres()" /></TD>
<TD WIDTH="25%"></TD>
</TR>
</TABLE>
</FIELDSET>
<% }
catch (Exception ex1)
{
%><FONT SIZE="+3" COLOR="green"> <% out.println("Unable to connect to database.");

} %> </FONT> <BR />
<%
finally
{
rs6.close();
statement6.close();
connection6.close();

}
%>
</TD>
</TR>

<TR HEIGHT="10%" BGCOLOR="FFEBCC">
<TD>
<%
Connection connection4 = null;
Statement statement4 = null;
ResultSet rs4 = null;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection4 = DriverManager.getConnection(conn_url, username,password);
statement4 = connection4.createStatement();
String QueryString4 = "select distinct date_format(order_date,'%d-%b-%Y') from oxy_orders where 1=1 and DATE_FORMAT(ORDER_DATE,'%c %Y') = DATE_FORMAT(DATE(CONVERT_TZ(sysdate(),'+00:00','+10:30')),'%c %Y') and ORDER_DATE <= DATE(CONVERT_TZ(sysdate(),'+00:00','+10:30')) order by order_date desc";
rs4 = statement4.executeQuery(QueryString4);
%>
<FIELDSET STYLE="border-color: #8A5C2E"><LEGEND STYLE="font-weight:bolder;font-size:14px;; color=#8A5C2E;">DELIVERY CHANGES</LEGEND>
<TABLE WIDTH="100%" HEIGHT="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR HEIGHT="100%">
<TD WIDTH="15%" ALIGN="right"><FONT SIZE="3" color="#8A5C2E">From Date:</FONT></TD>
<TD WIDTH="15%"> 
<SELECT NAME="from_date" />
<%
while (rs4.next())
{
%> <OPTION><%=rs4.getString(1)%></OPTION> <%
}

%>
</SELECT>
</TD>
<TD WIDTH="15%" ALIGN="right"><FONT SIZE="3" color="#8A5C2E">No. Of Litres:</FONT></TD>
<TD WIDTH="15%"> <INPUT TYPE="text" NAME="number_litre" SIZE="15" /></TD>
<TD WIDTH="15%" ALIGN="center"><INPUT TYPE="button" NAME="Update" VALUE="Update" ONCLICK="javascript:updateLitres()" /></TD>
<TD WIDTH="25%"></TD>
</TR>
</TABLE>
</FIELDSET>
<% }
catch (Exception ex1)
{
%><FONT SIZE="+3" COLOR="green"> <% out.println("Unable to connect to database.");

} %> </FONT> <BR />
<%
finally
{
rs4.close();
statement4.close();
connection4.close();

}
%>
</TD>
</TR>
<!-- ==========================================Recharge==================================================================================================== -->
<TR HEIGHT="9%" BGCOLOR="FFEBCC">
<TD>
<FIELDSET STYLE="border-color: #8A5C2E"><LEGEND STYLE="font-weight:bolder;font-size:14px; color=#8A5C2E;">RECHARGE</LEGEND>
<TABLE BORDER="0" WIDTH="100%" HEIGHT="100%" CELLPADDING="0" CELLSPACING="0">
<TR HEIGHT="50%">
<TD WIDTH="15%" ALIGN="right"><FONT SIZE="3" color="#8A5C2E">Date:</FONT></TD>
<%
Date date12 = Calendar.getInstance().getTime();
DateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy");
String today = formatter.format(date12);
%>
<TD WIDTH="15%" ALIGN="left"> <INPUT TYPE="text" VALUE="<%=today%>" NAME="recharge_date" SIZE="15"/> </TD>
<TD WIDTH="15%" ALIGN="right"><FONT SIZE="3" color="#8A5C2E">Amount:</FONT></TD>
<TD WIDTH="15%" ALIGN="left"> <INPUT TYPE="text" NAME="recharge_amount" SIZE="15" /><BR /> </TD>
<TD WIDTH="15%"></TD>
<TD WIDTH="25%"></TD>
</TR>
<TR> </TR>
<TR HEIGHT="50%">
<TD WIDTH="15%" ALIGN="right"><FONT SIZE="3" color="#8A5C2E">Receipt No.:</FONT></TD>
<TD WIDTH="15%"> <INPUT TYPE="text" NAME="receipt_number" SIZE="15" /><BR /> </TD>
<TD WIDTH="15%" ALIGN="right"><FONT SIZE="3" color="#8A5C2E">Collecter:</FONT></TD>
<TD WIDTH="15%"> <INPUT TYPE="text" NAME="collecter_name" SIZE="15" /><BR /> </TD>
<TD WIDTH="15%" ALIGN="center"><INPUT TYPE="button" NAME="Update" VALUE="Update" ONCLICK="javascript:updateRecharge()" /></TD>
<TD WIDTH="25%"></TD>
</TR>
</TABLE>
</FIELDSET>
<BR />
</TD>
</TR>
<TR HEIGHT="1%" BGCOLOR="FFEBCC">
<TD>
<FIELDSET STYLE="border-color: #8A5C2E"><LEGEND STYLE="font-weight:bolder;font-size:14px ; color=#8A5C2E;">DELIVERY TIME</LEGEND>
<TABLE WIDTH="100%" HEIGHT="100%" CELLPADDING="0" CELLSPACING="0">
<TR HEIGHT="100%">
<TD WIDTH="15%" ALIGN="right"><FONT SIZE="3" color="#8A5C2E">Delivery Time:</FONT></TD>
<TD WIDTH="15%"> 
<SELECT NAME="dtime">
<OPTION>Morning</OPTION>
<OPTION>Evening</OPTION>
</SELECT>
</TD>
<TD WIDTH="12%" ALIGN="right"><FONT color="#8A5C2E">Effective Date: </FONT></TD>
<%
Date eff_date = Calendar.getInstance().getTime();
DateFormat formatter_date = new SimpleDateFormat("dd-MMM-yyyy");
String current_date = formatter_date.format(eff_date);
%>
<TD WIDTH="13%"><input type="text" name="Effective_Date" VALUE="<%=current_date%>" readwrite="readwrite"/> </TD>
<TD WIDTH="15%" ALIGN="right">  <INPUT TYPE="button" NAME="Update" VALUE="Update" ONCLICK="javascript:updateDeliverytime(this.form)" /></TD>
<TD WIDTH="55%"></TD>
</TR>
</TABLE>
</FIELDSET>
<BR />
</TD>
</TR>


</TABLE>
</TD>
<TD WIDTH="10%"><!-- empty space --></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</html:form>
</HTML>
[/code]

Java Servlet (Action):
---------------------------------------
[code=java]
package app;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import app.dao.mydao.dao;

public class AdminSubmit extends Action
{
public ActionForward perform(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException
{
String parameter = mapping.getParameter();
System.out.println("Parameter is : "+parameter);
if("updateLitres".equalsIgnoreCase(parameter))
{
String num_of_litres = request.getParameter("number_litre");
float litres= Float.parseFloat(num_of_litres);
HttpSession session = request.getSession();
Integer id = (Integer) session.getAttribute("user_id");
int customer_id = id.intValue();
String from_date = request.getParameter("from_date");
String strformat="dd-MMM-yyyy";
SimpleDateFormat formatter = new SimpleDateFormat(strformat);
try
{
java.util.Date fromdate = formatter.parse(from_date);
String fdate = formatter.format(fromdate);
java.util.Date frmDate = formatter.parse(fdate);
formatter = new SimpleDateFormat("yyyy-MM-dd");
fdate = formatter.format(frmDate);
dao t=new dao();
try
{
/*dao d=new dao();
d.sendadminmilkupdate(customer_id,litres);*/
t.updateLitres(customer_id,litres,fdate);
}
catch(SQLException e)
{
System.out.println("SQL Exception: "+e);
}
}
catch(ParseException e)
{
System.out.println("Exception :"+e);
return mapping.findForward("error");
}

}

if("permlitre".equalsIgnoreCase(parameter))
{
String num_of_litres1 = request.getParameter("admin_change_default_requested_litre");
float litres1= Float.parseFloat(num_of_litres1);
HttpSession session = request.getSession();
Integer id = (Integer) session.getAttribute("user_id");
int customer_id = id.intValue();
String from_date = request.getParameter("default_requested_litre_change_date");
String strformat="dd-MMM-yyyy";
SimpleDateFormat formatter = new SimpleDateFormat(strformat);
try
{
java.util.Date fromdate = formatter.parse(from_date);
String fdate = formatter.format(fromdate);
java.util.Date frmDate = formatter.parse(fdate);
formatter = new SimpleDateFormat("yyyy-MM-dd");
fdate = formatter.format(frmDate);
dao t=new dao();
t.updateadminpermreqLitres(customer_id,fdate,litres1);
}
catch(Exception e)
{
System.out.println("Exception :"+e);
return mapping.findForward("error");
}
}


if("updateRecharge".equalsIgnoreCase(parameter))
{
HttpSession session = request.getSession();
Integer id = (Integer) session.getAttribute("user_id");
int customer_id = id.intValue();
String ramount = request.getParameter("recharge_amount");
float rechargeamount= Float.parseFloat(ramount);
String rnumber = request.getParameter("receipt_number");
int receiptnumber = Integer.parseInt(rnumber);
String collectername = request.getParameter("collecter_name");
String recharge_date = request.getParameter("recharge_date");
String strformat="dd-MMM-yyyy";
SimpleDateFormat formatter = new SimpleDateFormat(strformat);
try
{
java.util.Date rechargedate = formatter.parse(recharge_date);
String rdate = formatter.format(rechargedate);
java.util.Date recDate = formatter.parse(rdate);
formatter = new SimpleDateFormat("yyyy-MM-dd");
rdate = formatter.format(recDate);
dao t=new dao();
try
{
dao d=new dao();
d.sendadminrecharge(customer_id,rdate,rechargeamount,receiptnumber,collectername);
t.updateRecharge(rdate,rechargeamount,receiptnumber,collectername,customer_id);
}
catch(SQLException e)
{
System.out.println("SQL Exception: "+e);
}
}
catch(ParseException e)
{
System.out.println("Exception :"+e);
return mapping.findForward("error");
}
}
if("updateDeliverytime".equalsIgnoreCase(parameter))
{
HttpSession session = request.getSession();
Integer id = (Integer) session.getAttribute("user_id");
int customer_id = id.intValue();
String dtime = request.getParameter("dtime");
String Effective_Date = request.getParameter("Effective_Date");
String strformat="dd-MMM-yyyy";
SimpleDateFormat formatter = new SimpleDateFormat(strformat);
String dtime1=dtime;
String ActualDBDate=null;
if (dtime.equals("Evening"))
{
dtime="E";
}
else
{
dtime="M";
}
try
{
java.util.Date ParseDate = formatter.parse(Effective_Date);
ActualDBDate = formatter.format(ParseDate);
java.util.Date EDate = formatter.parse(ActualDBDate);
formatter = new SimpleDateFormat("yyyy-MM-dd");
ActualDBDate = formatter.format(EDate);
}
catch(ParseException p)
{
System.out.println("Parse Exception: "+p);
}
try
{
dao d=new dao();
d.sendadmindeliverytimeupdate(customer_id,dtime1,Effective_Date);
d.updateDeliverytime(customer_id,dtime,ActualDBDate);
}
catch(SQLException e)
{
System.out.println("SQL Exception: "+e);
}

}
return mapping.findForward("success");
}
}
[/code]
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Could you please clarify these things :

1. IS your every finally block being executed in your JSP Page ??

Put some System.out.println() statements in your every finally Method and make sure that they are being called in every case . (This is to make sure that Database related things are closed properly)

2. In your Action class , why are you creating so many HttpSession Objects ??
This should be done only once and that should be at the begining of your execute / perform method

If you get Time , work on these things :

1. Dont use Class.forName , but try to use DataSource
2. Dont do DB Opeartions from JSP .

Dont worry , these are minor things which can be solved easily .
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
As I recall, you get that specific Unavailable message if the servlet throws a javax.servlet.UnavailableException

If that has happened there should be some sort of log message.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WARNING: Servlet jsp is currently unavailable