wood burning stoves 2.0*
The moose likes Tomcat and the fly likes requests get stuck in S status Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "requests get stuck in S status" Watch "requests get stuck in S status" New topic
Author

requests get stuck in S status

marcello marangio
Greenhorn

Joined: Nov 26, 2010
Posts: 8
Hi all
I am having a strange problem on my tomcat 5.5.
I developed a very simple combo box cascade: if i select one of the coutries shown in the first one I dynamically load from a DB the cities of that coutry.
I use jquery to populate the second combo in a div; mybatis for data binding and Mysql ad RDBMS.

After a random number of selections of countries (less than 10) tomcat gets stuck a doesn't respond; there is a thread stuck in "S" state, forever.


This is my jsp

<script type="text/javascript">
<!--
function toggle_view2(id) {

$.post("<%=request.getContextPath()%>/servlet/operatoreservlet.do", { id_ente: id.value, op:"searcities" },
function(data){
$('#cities').empty();
$('#cities').html(data);
});
}
-->
</script>

<form action="/operatoreservlet.do" method="post" name="lostpasswordform">
<table align="center" width=600>

<tr><td>Country:</td>
<td>
<select name="id_country" id="id_country" onchange="toggle_view2(this)">
<%
SqlSession sqlSession= Utils.getSqlSessionFactory().openSession( false);
CountryMapper countryMapper = sqlSession.getMapper(CountryMapper.class);
List <Country> coutries = coutrnyeMapper.selectByExample(new CountryExample());
for(Country country:countries){%>
<option value="<%=country.getId() %>"><%=country.getName() %></option>
<%}
%>
</select>
</td></tr>
<tr><td>City:</td>
<td>
<div id="cities" ></div>
</td></tr>
</table>

</form>


and this is my java code:

...
else if("searchcities".equals(op)){

session = Utils.getSqlSessionFactory().openSession( false);
CityMapper sm = (CityMapper) session.getMapper(City.class);
CityExample se = new CityExample();
String id_country = request.getParameter("id_country");
se.createCriteria().andId_countryEqualTo(id_country);
List <City> cities = sm.selectByExample(se);
request.setAttribute("cities", cities);
page2forward="citiesAjax.jsp";
}

and, of course:
...
session.close();
...
RequestDispatcher rd = request.getRequestDispatcher("/citiesAjax.jsp");
rd.forward(request, response);


here is the "citiesAjax.jsp"

<%@page import="java.util.List, it.puglia.innova.idp.model.*"%>
<jsp:useBean id="cities" scope="request" class="java.util.ArrayList"/>
<select name="city">
<%
for(Object c: cities){
City city = (City) sport;%>
<option value="<%=city.getId()%>"><%=city.getName() %>%></option>
<%}
%>
</select>



Here is my connector configuration:

<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
maxKeepAliveRequests="1"
/>

and my jdbc config:

<Context >
<Resource name="jdbc/idp" auth="Container" type="javax.sql.DataSource"
username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/idp_registrazione" maxActive="8"
maxIdle="4" />
</Context>

Please help
Thanks
Marcello
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

1. Get the Java code out of the JSPs and into Java-only files. It's a lot easier to debug (and maintain) that way.

2. Use Code Tags to make it easier for people to read your sample code/JSPs/XML files.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: requests get stuck in S status
 
Similar Threads
does firefox have a problem with .setAttribute ?
my java script is not working
Help me about html:select
no data in base
how to create JSON in javascript and get length of json