• 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 ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

requests get stuck in S status

 
Greenhorn
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" },
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
 
Saloon Keeper
Posts: 23279
158
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
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic