Results 1 to 1 of 1
- 04-11-2010, 11:14 PM #1
Member
- Join Date
- Jan 2010
- Posts
- 37
- Rep Power
- 0
java.lang.OutOfMemoryError: unable to create new native thread
Hi all, I have this method in my servlet
and if I access the servlet in web browser, I get following exceptionJava Code:public InputStream getStudentInfo(String studentId) throws Exception { URL url = new URL(WS_SERVER_URL + WS_SERVICE_PATH + WS_PARAM + URLEncoder.encode(studentId, "UTF-8")); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setConnectTimeout(5000); connection.setRequestMethod("GET"); connection.setInstanceFollowRedirects(false); connection.setUseCaches(false); connection.setDoOutput(true); connection.setDoInput(true); connection.connect(); int responseCode = connection.getResponseCode(); InputStream result; if (responseCode == 200) { result = connection.getInputStream(); } else { throw new Exception("The error occurs while downloading data. (" + connection.getResponseCode() + " " + connection.getResponseMessage() + ")"); } return result; }and this item causes the exceptionJava Code:exception javax.servlet.ServletException: Servlet execution threw an exception root cause java.lang.OutOfMemoryError: unable to create new native thread java.lang.Thread.start0(Native Method) java.lang.Thread.start(Thread.java:597) com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:902) com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1112) com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1139) com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123) sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:418) sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166) sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:133) studentInfo.RestClient.getStudentInfo(RestClient.java:41) studentInfo.Student.getInfoFromStag(Student.java:24) test.TestPage.doPost(TestPage.java:54) javax.servlet.http.HttpServlet.service(HttpServlet.java:709) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
and on this line inside my method lies following codeJava Code:studentInfo.RestClient.getStudentInfo(RestClient.java:41)
Help me, how can I solve it, please.Java Code:connection.connect();
Similar Threads
-
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
By vasavi.singh in forum Advanced JavaReplies: 10Last Post: 05-11-2009, 11:56 AM -
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
By Ms.Ranjan in forum New To JavaReplies: 3Last Post: 04-22-2009, 08:25 PM -
java.lang.OutOfMemoryError: unable to create new native thread
By jai135 in forum Java ServletReplies: 11Last Post: 09-01-2008, 10:56 AM -
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
By Eku in forum NetBeansReplies: 14Last Post: 06-12-2008, 08:36 AM -
OutOfMemoryError: Unable to Start New Native Thread
By edwin11 in forum Advanced JavaReplies: 0Last Post: 11-16-2007, 01:47 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks