2

any1 知道这些 java 错误可能是什么原因吗?

Java 版本应该是 1.4.1_05。这与仁科有关。

"VM Thread" prio=5 tid=0x00B8EF28 nid=0x5f8 runnable 
"VM Periodic Task Thread" prio=10 tid=0x00CF4CF8 nid=0x648 waiting on condition 
"Suspend Checker Thread" prio=10 tid=0x00CF5760 nid=0x64c runnable 
<Nov 17, 2011 1:41:46 PM GMT+08:00> <Error> <HTTP> <BEA-101017> <[ServletContext(id=21840659,name=PORTAL,context-path=)] Root cause of ServletException.
java.lang.OutOfMemoryError: unable to create new native thread
                at java.lang.Thread.start(Native Method)
                at bea.jolt.NwHdlr.start_threads(NwHdlr.java:1982)
                at bea.jolt.NwHdlr.openConnection(NwHdlr.java:879)
                at bea.jolt.CMgr.connect(CMgr.java:71)
                at bea.jolt.JoltSession.logon(JoltSession.java:246)
                at bea.jolt.JoltSession.<init>(JoltSession.java:125)
                at psft.pt8.net.JoltSessionWrapper.<init>(JoltSessionWrapper.java:67)
                at psft.pt8.net.JoltSessionPool.createConnection(JoltSessionPool.java:373)
                at psft.pt8.net.JoltSessionPool.getJoltSession(JoltSessionPool.java:220)
                at psft.pt8.net.NetSession.getJoltSession(NetSession.java:484)
                at psft.pt8.net.NetReqRepSvc.sendRequest(NetReqRepSvc.java:526)
                at psft.pt8.net.NetService.requestService(NetService.java:141)
                at psft.pt8.net.NetReqRepSvc.requestService(NetReqRepSvc.java:328)
                at psft.pt8.net.NetSession.connect(NetSession.java:269)
                at psft.pt8.net.NetSession.<init>(NetSession.java:203)
                at psft.pt8.jb.JBEntry.connectWithBlob(JBEntry.java:720)
                at psft.pt8.jb.JBEntry.connect(JBEntry.java:654)
                at psft.pt8.auth.PSAuthenticator.authenticate(PSAuthenticator.java:546)
                at psft.pt8.psreports.onLogin(psreports.java:216)
                at psft.pt8.psreports.onAction(psreports.java:321)
                at psft.pt8.psreports.service(psreports.java:181)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
                at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
                at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
                at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
                at psft.pt8.psfilter.doFilter(psfilter.java:71)
                at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
                at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6372)
                at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
                at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
                at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3643)
                at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
                at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
                at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
>
4

6 回答 6

2

您为线程堆栈可用的内存创建了太多线程。您可以减少创建的线程数,或从(大)默认值减少它们的默认堆栈大小。-XX:ThreadStackSize=128将使它成为128KB。当然,堆栈太少,StackOverflowError如果你有一个特别深的方法调用,你可能会命中(呵呵)。

由于您必须使用默认堆栈大小创建很多线程(数千个)才能达到此目的,我的直觉说您最好的解决方案是#1。您的应用程序中不需要数千个线程。

于 2011-11-17T08:23:25.133 回答
1

直接原因是您的 JVM 内存不足,无法为新线程创建堆栈。

根本原因更难确定:

  • 应用程序可能会不必要地或浪费地创建线程。

  • 应用程序可能在重新部署时泄漏线程。

  • 线程可能在 I/O 中阻塞(例如读取套接字)并且永远不会回来。

  • 自定义线程池中可能存在导致线程丢失的错误。

  • 新堆栈所需的内存可能已被其他事物占用;例如,通过堆或内存映射文件或 JNI 代码的非堆分配。

  • 等等 ...

调整线程堆栈大小是一种可能在短期内起作用的创可贴解决方案。但从长远来看,您需要找出问题的真正原因。

你应该先配置JVM在OOME上创建一个dump文件,然后用post mortem dump分析器看看有没有线索;例如,许多线程处于意外状态。

于 2011-11-17T08:48:35.890 回答
0

此错误消息通常表示您的系统已用完启动线程所需的资源。通常这是堆栈的内存。

Java 1.4.1 于 2002 年 9 月发布。也许您的系统需要升级(可能是使用的硬件或软件版本)

于 2011-11-17T08:24:06.383 回答
0

java.lang.OutOfMemoryError can be caused due to available memory to your application or it can be also caused due to memory leaks in your application. Check related thread link

JVM allocates each thread memory space called thread stack. Default value depends on what OS and JVM. You can try allocating memory allocated to thread by setting -Xss option and also try reducing space allocated to heap memory -Xmx option. Check this article for JVM Tuning link.

于 2011-11-17T08:27:57.827 回答
0

嗯,它说

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

所以看起来你没有足够的内存。可能是旧线程没有被杀死,所以越来越多,直到内存满?

或者,您可以增加 Java 的内存大小。

于 2011-11-17T08:41:16.720 回答
0
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

import java.util.Scanner;

/**
 *
 * @author smart
 */
public class JavaApplication1 {


    public static void main(String[] args) {

        String cname;
        double quantity, price, dp, total, dv, finaltotal;

        Scanner S=new Scanner(System.in); 


        System.out.println("please enter clientname");

        cname=S . nextLine();
        System.out.println("please enter quantity");
        quantity=S . nextDouble();
        System.out.println("please enter price");
        price=S . nextDouble();
        System.out.println("please enter discount percentage");
        dp=S . nextDouble();

        total=S . nextDouble();
        dv=S . nextDouble();
        finaltotal=S . nextDouble();

        total= quantity+price;
        dv= price-dp;
        finaltotal=total*dv;

        System.out.println(total);

        System.out.println(dv);

        System.out.println(finaltotal);           
    }   
}
于 2018-08-06T14:35:27.833 回答