Java堆空间错误|在Websphere中部署EAR时内存不足

时间:2019-06-10 15:15:06

标签: websphere ear

在Websphere服务器中部署EAR(大小:230 MB)文件时,我收到OutOfMemory错误。 在增加堆大小之后,有时部署会成功。 我已经分析了堆转储,发现了可疑的泄漏对象,但不知道以后如何进行。

function button ($title,$instance,$acct,$pass) {
    ###################Load Assembly for creating form & button######

    Add-Type -AssemblyName System.Windows.Forms
    Add-Type -AssemblyName Microsoft.VisualBasic


    #####Define the form size & placement

    $form = New-Object "System.Windows.Forms.Form"
    $form.Width = 500
    $form.Height = 160
    $form.Text = $title
    $form.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen

    ##############Define text label1
    $textLabel1 = New-Object "System.Windows.Forms.Label"
    $textLabel1.Left = 25
    $textLabel1.Top = 15
    $textLabel1.Text = $instance

    ##############Define text label2

    $textLabel2 = New-Object "System.Windows.Forms.Label"
    $textLabel2.Left = 25
    $textLabel2.Top = 50
    $textLabel2.Text = $acct

    ##############Define text label3

    $textLabel3 = New-Object "System.Windows.Forms.Label"
    $textLabel3.Left = 25
    $textLabel3.Top = 85
    $textLabel3.Text = $pass

    ############Define text box1 for input
    $textBox1 = New-Object "System.Windows.Forms.TextBox"
    $textBox1.Left = 150
    $textBox1.Top = 10
    $textBox1.width = 200

    ############Define text box2 for input

    $textBox2 = New-Object "System.Windows.Forms.TextBox"
    $textBox2.Left = 150
    $textBox2.Top = 50
    $textBox2.width = 200

    ############Define text box3 for input

    $textBox3 = New-Object "System.Windows.Forms.TextBox"
    $TextBox3.Passwordchar = "*"
    $textBox3.Left = 150
    $textBox3.Top = 90
    $textBox3.width = 200

    #############Define default values for the input boxes
    $defaultValue = ""
    $textBox1.Text = $defaultValue
    $textBox2.Text = $defaultValue
    $textBox3.Text = $defaultValue

    #############define OK button
    $button = New-Object "System.Windows.Forms.Button"
    $button.Left = 360
    $button.Top = 85
    $button.Width = 100
    $button.Text = "Submit"
    $button.DialogResult = [System.Windows.Forms.DialogResult]::OK

    #############define CANCEL button
    $button2 = New-Object "System.Windows.Forms.Button"
    $button2.Left = 360
    $button2.Top = 45
    $button2.Width = 100
    $button2.Text = "Cancel"
    $button2.DialogResult = [System.Windows.Forms.DialogResult]::Cancel

    ############# This is when you have to close the form after getting values
    $eventHandler = [System.EventHandler]{
        $textBox1.Text
        $textBox2.Text
        $textBox3.Text
        $form.Close()
    }

    $button.Add_Click($eventHandler) 

    #############Add controls to all the above objects defined
    $form.Controls.Add($button)
    $form.Controls.Add($button2)
    $form.Controls.Add($textLabel1)
    $form.Controls.Add($textLabel2)
    $form.Controls.Add($textLabel3)
    $form.Controls.Add($textBox1)
    $form.Controls.Add($textBox2)
    $form.Controls.Add($textBox3)
    $ret = $form.ShowDialog()

    $result = $null
    #################return values
    if ($ret -eq 'OK') {
        # if NOT cancelled, return whatever is in the 3 text boxes
        $result = $textBox1.Text, $textBox2.Text, $textBox3.Text
    }

    # Dispose of the form
    $form.Dispose()

    return $result
}

$return= button "SSRS Configuration" "Instance Name" "Domain\ServiceID" "Password"

# test if the function returned anything, otherwise it was cancelled
if ($return) {
    #Below variables will get the values that had been entered by the user

    $return[0]
    $return[1]
    $return[2]

    # for better readability, create the arguments for the Setup.exe as array

    $arguments = '/q', 
                 '/IACCEPTSQLSERVERLICENSETERMS', 
                 '/ACTION="install"', 
                 '/USEMICROSOFTUPDATE="False"', 
                 '/INDICATEPROGRESS', 
                 ('/INSTANCENAME="{0}"' -f $return[0]), 
                 '/FEATURES="RS"', 
                 '/RSINSTALLMODE="FilesOnlyMode"', 
                 '/INSTANCEDIR="D:\Program Files\Microsoft SQL Server"', 
                 ('/RSSVCACCOUNT="{0}"'  -f $return[1]), 
                 ('/RSSVCPASSWORD="{0}"' -f $return[2])

    $proc = Start-Process -FilePath "D:\SQL2016\SQL Server 2016 SP1\Setup.exe" -ArgumentList $arguments -PassThru -Wait

    # you can examine the processes ExitCode using:
    Write-Host "The process returned ExitCode: $($proc.ExitCode)"
}
else {
    Write-Host "User cancelled the dialog.."
}

并在WAS日志中达到以下错误

Leak suspect    : 217,295,824 bytes (87.23 %) of Java heap is used by 105 
                  instances of java/util/WeakHashMap$Entry
                  Contains 3 instances of the following leak suspects:
                  - array of java/lang/Object holding 16,235,440 bytes at 0x6a696c8
                  - array of java/lang/Object holding 101,373,968 bytes at 0x1125c240
                  - array of java/lang/Object holding 13,602,688 bytes at 0x5290818
<\n> Total size  : 217,295,824 bytes
Size             : 1,040 bytes
Name             : array of java/util/WeakHashMap$Entry
Number of children : 105
Number of parents  : 1
Owner address      : 0x2e41fd0
Owner object       : java/util/WeakHashMap
Address            : 0xb4c2dc0
First single ancestor :     org/eclipse/jst/j2ee/internal/archive/JavaEEArchiveUtilities at 0xb4c2dc0

背景中是否存在任何胭脂过程或阻塞?

1 个答案:

答案 0 :(得分:0)

您没有编写版本,拓扑(单个,网络部署),也没有编写应用程序的方式(控制台,wsadmin等等)。 如您在日志中所看到的,在EJB部署调用期间发生OutOfMemoryError。 您需要为ejb部署增加内存,您可以将其设置为文件或在操作系统级别。检查此帖子Getting OutofMemory condition while deploying a large application in WebSphere Application Server

  

1)在install-root / deploytool / itp / EJBDeploy.sh文件中进行设置

     

EJBDEPLOY_JVM_HEAP =“-Xms1024 -Xmx1024”   ejbdeploy.sh文件。

     

2)在操作系统环境中进行设置。

     

在OS环境中设置EJBDEPLOY_JVM_HEAP ='-Xms1024 -Xmx1024'   变量。

我还会在AdminAgent01配置文件中为您的管理服务器增加内存,因为您似乎正在使用管理代理。