• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

requests get stuck in S status

Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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" },

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

<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>
<div id="cities" ></div>


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");
List <City> cities = sm.selectByExample(se);
request.setAttribute("cities", cities);

and, of course:
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>

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"

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" />

Please help
Saloon Keeper
Posts: 23279
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic