7 Replies Latest reply on Nov 26, 2019 8:09 AM by mariaprabudass

    jboss7, java.lang.OutOfMemoryError: unable to create new native thread


      I am using the jsp-servlet in my application. and deployed the war on jboss 7.0.2 server. i have servlet have code related to database and that is being called many time in sec (say 500 times).  but it is falling over for such many threads, jboss 7.0.2 will not able to handle this threads.


      I am using the 64 bit jvm.

      I have reduce the size of the thread stack with -Xss256k, this  not work for me.

      i did the configuration in jboss.conf


      I need to handle the 2000 threads on jboss7.


      server (jboss7.0.2) throws an exception.


          java.lang.OutOfMemoryError: unable to create new native thread

           at java.lang.Thread.start0(Native Method)

           at java.lang.Thread.start(Unknown Source)


      Here is my servlet java.lang.OutOfMemoryError: unable to create new native thread


              public class Test extends HttpServlet {

          private static final long serialVersionUID = 1L;


          public Test() {




          protected void doGet(HttpServletRequest request,

                    HttpServletResponse response) throws ServletException, IOException   {

              processRequest(request, response);



          protected void doPost(HttpServletRequest request,

                  HttpServletResponse response) throws ServletException, IOException {

              processRequest(request, response);



          public void processRequest(HttpServletRequest request,

                  HttpServletResponse response) {

              Logger log=LoggerFactory.getLogger(feedback.class);


                 /*   here is my code to insert the data in database. */


                      TestClass testobj = new TestClass();       







              smsmanager1 = null;

              sms = null;






      code fot add method


             public void add(T obj) {

                   SessionFactory sessionFactory = HibernateUtil.getSessionFactory();

                   Session session=sessionFactory.openSession();

                   Transaction transaction = null;

                   try {

                           transaction = session.beginTransaction();





                   } catch (HibernateException e) {




                   } finally {



                           session = null;

                           transaction = null;



      i have tested for the blank servlet that has the only one console printing statement. it works fine but it not work for above servlet.


      am i on the right track here ?

      how the server will handle the such servlet for above 500-800 threads ?