簡體   English   中英

有沒有辦法在同一服務器上運行兩個JVM?

[英]There's any way to run two JVM in the same server?

我在JVM方面遇到了一些問題; 我有一個網頁和一個沒有GUI(UDP服務器)的應用程序,並且都使用相同的數據庫,該應用程序(UDP服務器)可以正常工作,但是如果Web應用程序內存不足,整個JVM就會停止; 所以我在考慮將UDP服務器放在另一個JVM中。

我收到以下消息

2013年5月21日下午5:24:05 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
嚴重:Web應用程序[/ track]創建了一個ThreadLocal,其密鑰類型為[org.opengts.util.ThreadLocalMap $ 1](值[org.opengts.util.ThreadLocalMap$1@277085a4])和一個值類型為[java.util .Hashtable](值[{jdbc:mysql:// localhost:3306 / gts?characterEncoding=UTF-8&useUnicode=true&characterSetResults=utf8=org.opengts.dbtools.DBConnection@22236dae}]),但在Web應用程序中無法刪除被停止了。 線程將隨着時間的流逝而更新,以嘗試避免可能的內存泄漏。

當我重新啟動網頁時

May 21, 2013 5:24:20 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2695 ms
Exception in thread "http-bio-8080-Acceptor-0" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:657)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:943)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1336)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:176)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:156)
at org.apache.tomcat.util.net.JIoEndpoint.processSocket(JIoEndpoint.java:510)
at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:229)
at java.lang.Thread.run(Thread.java:679)
Exception in thread "http-bio-8080-exec-8" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:657)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:943)
at java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:992)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)

新資訊

我嘗試了ulimit命令,得到以下結果。

ulimit
unlimited
ulimit -Hn
163840
ulimit -n
163840
ulimit -u
1024

現在我想知道這些數字的含義是什么? 它們是MB的進程或內存量嗎?

您必須在不同的端口上運行Web服務器,所以這不是JVM問題-它是catalina的配置

“ java.lang.OutOfMemoryError:無法創建新的本機線程”錯誤實際上根本不是內存不足錯誤-由於操作系統的限制,JVM無法創建新線程。

您正在使用什么操作系統? 在linux上,您可以這樣做:

ulimit -u <new limit>

在創建新的JVM之前,我將首先檢查線程的創建。

在添加之前,我對線程數的限制有同樣的問題

executor.shutdown(); 

在finally塊中獲取ExecutorService

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM