java - 有没有办法在同一台服务器上运行两个JVM?

标签 java out-of-memory

我在 JVM 方面遇到了一些问题;我有一个网页和一个没有 GUI(UDP 服务器)的应用程序,并且两者都使用相同的数据库,应用程序(UDP 服务器)工作正常,但如果 Web 应用程序内存不足,整个 JVM 就会停止;所以我想把UDP服务器放在不同的JVM中。

我收到以下消息

May 21, 2013 5:24:05 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/track] created a ThreadLocal with key of type [org.opengts.util.ThreadLocalMap$1] (value [org.opengts.util.ThreadLocalMap$1@277085a4]) and a value of type [java.util.Hashtable] (value [{jdbc:mysql://localhost:3306/gts?characterEncoding=UTF-8&useUnicode=true&characterSetResults=utf8=org.opengts.dbtools.DBConnection@22236dae}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

当我重新启动网页时

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 为单位)?

最佳答案

你必须在不同的端口上运行网络服务器 所以这不是 JVM 问题 - 这是 catalina 的配置

关于java - 有没有办法在同一台服务器上运行两个JVM?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16679487/

相关文章:

ios - 图片下载保存导致内存压力

java - 使用 miglayout 的垂直按钮栏布局

java - Stream在twitter4j(Hadoop- flume)中关闭

android - 相机在摩托罗拉 Razr 上崩溃 - 内存不足

c++ - cv::内存位置出现异常错误

ruby - Errno::ENOMEM:无法分配内存 - cat

memory-management - 如何计算Bert的内存需求?

java - AOP in spring 切面警告

java - 如何配置JVM只在真正需要的时候才分配内存?

java - 在Java中将十进制转换为二进制