3 Replies Latest reply on Apr 9, 2010 10:06 AM by paata lominadze

    Stateless Pooling In JBoss AS.

    paata lominadze Master

      hi all,

      I have strange problem.


      My Env:

      1. OS                         Sun Solaris Sparc

      2.Application Server   jboss-4.2.3.GA

      3.java                        Oracle JRockit(R) version "1.6.0_05"

      4.Ext. Lib.                   Apache http Client (http://hc.apache.org/httpclient-3.x/)


      I have one stateless session bean which sends SMS Message to mobile using http client.

      my session bean looks like :


      public class CommonFasadeBean implements CommonFasade {
          private HttpClient httpClient = null;
          public HttpClient getHttpClient() {
              if (httpClient == null) {
                  SimpleHttpConnectionManager manager = new SimpleHttpConnectionManager();
                  httpClient = new HttpClient(manager);
              return httpClient;
          public void sendSMS(String fullSms, String phone, String from) {
              HttpClient httpClient = getHttpClient();
              phone = Utils.trimPhone(phone);
              phone = getPhone(phone);
              if (phone == null) {
              String sendToPhone = null;
              switch (phone.length()) {
              case 8:
                  sendToPhone = "%s2B995" + phone;
              case 9:
                  sendToPhone = "%s2B995" + phone.substring(1);
              String url = "" + from
                      + "&username=1&password=1&to=" + sendToPhone + "&text=%s";
              long sc = -999;
              try {
                  for (String sms : prepareSmsList(fullSms)) {
                      GetMethod method = new GetMethod(String.format(url, "%", sms));
                      try {
                          sc = httpClient.executeMethod(method);
                          if (sc == HttpStatus.SC_ACCEPTED) {
                              String response = method.getResponseBodyAsString();
                              if (response.toLowerCase().indexOf("sent") != -1) {
                                  logSMS(sms, phone, from);
                      } finally {
              } catch (Exception e) {




      this code worked for tree years, but problem appeard some days ago.

      every second or third day my jboss application server crashes.


      when i trying to find promlem i found this :

      1. into solaris :

      "netstat -an|grep|wc -l  (this is SMS sender HTTP server)"

           and result was : 12678


      this is client socket connections from my jboss as, all of them is on a CLOSE_WAIT state.

      After this when i looking into the jmx-console i found this :






      My question is why i have 12826 stateless session bean isntances into as ?

      Into my jboss as stateless session pool config max size is 30.



      i think that something changed into  HTTP Server or into network.

      but i need workarount of this porblem .

      is this pattern right for using http clients ? Maybe it will be more correct to use MDB for this ?



      when current size of my stateless session bean achieve 40000 the jboss is going down.


      can anybody help me what should i do ???




      Paata Lominadze.