VM初始化期间发生错误。无法为对象堆保留足够的空间

时间:2018-07-26 13:31:42

标签: java powershell batch-file cmd soapui

我有一个在虚拟机上运行的Power Shell脚本,该脚本会创建到物理机的PSSession并执行命令以运行testrunner.bat文件。

PowerShell:

$Username="Domain\User"
$Password=ConvertTo-SecureString "Password" -AsPlainText -Force
$cred=New-Object System.Management.Automation.PSCredential($Username,$password)
$session=New-PSSession -ComputerName "K2" -Credential $cred

Enter-PSSession -Session $session

Invoke-Command -ComputerName "K2" -ScriptBlock {
     Invoke-Expression -Command: "C:\Windows\system32\cmd.exe Call /C 'C:\Program Files\SmartBear\ReadyAPI-2.4.0\bin\testrunner.bat '"
}

Exit-PSSession
Get-PSSession | Remove-PSSession

每当我运行此命令时,都会收到错误消息:

  

PS C:> C:\ Users \ User \ Desktop \ PS_TR.ps1

     

VM初始化期间发生错误

     

无法为对象堆保留足够的空间

我尝试过:

  • ControlPanel-> Java-> Java->视图->更改运行时参数
  • ControlPanel->系统-> ...->系统变量->更改路径和_JAVA_OPTIONS
  • 直接在testrunner.bat文件中更改-Xmx

我使用了以下值; 256、512、1024、2048和4096

这似乎都没有改变结果。

testrunner.bat

@echo off

set READY_API_HOME=%~dp0
set OLDDIR=%CD%
cd /d %READY_API_HOME%

if exist "%READY_API_HOME%..\jre\bin" goto SET_BUNDLED_JAVA
if exist "%JAVA_HOME%" goto SET_JAVA_HOME_JAVA
java -version 2> NUL
if not %ERRORLEVEL%==9009 goto SET_SYSTEM_JAVA
echo Java not found. Install it and set JAVA_HOME to the directory of your local Java installation to proceed.
goto END

:SET_BUNDLED_JAVA
set JAVA=%READY_API_HOME%..\jre\bin\java
goto END_SETTING_JAVA

:SET_JAVA_HOME_JAVA
set JAVA=%JAVA_HOME%\bin\java
goto END_SETTING_JAVA

:SET_SYSTEM_JAVA
echo JAVA_HOME is not set, unexpected results may occur.
echo Set JAVA_HOME to the directory of your local Java installation to avoid this message.
set JAVA=java
goto END_SETTING_JAVA

:END_SETTING_JAVA

set CLASSPATH=%READY_API_HOME%ready-api-ui-2.4.0.jar;%READY_API_HOME%..\lib\*
"%JAVA%" -cp "%CLASSPATH%" com.eviware.soapui.tools.JfxrtLocator > %TEMP%\jfxrtpath
set /P JFXRTPATH= < %TEMP%\jfxrtpath
del %TEMP%\jfxrtpath

"%JAVA%" -cp "%CLASSPATH%" com.eviware.soapui.tools.XmxCalculator > %TEMP%\readyxmx
set /P READY_XMX= < %TEMP%\readyxmx
del %TEMP%\readyxmx
rem uncomment to override memory limit
rem set READY_XMX=4000m

set CLASSPATH=%JFXRTPATH%%CLASSPATH%

rem JVM parameters, modify as appropriate
set JAVA_OPTS=-Xms128M -Xmx1024M -Dtest.history.disabled=true -Dsoapui.properties=soapui.properties -Dgroovy.source.encoding=iso-8859-1 "-Dsoapui.home=%READY_API_HOME%\"

if "%READY_API_HOME%\" == "" goto START
    set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.libraries="%READY_API_HOME%ext"
    set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.listeners="%READY_API_HOME%listeners"
    set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.actions="%READY_API_HOME%actions"

:START

rem ********* run soapui testcase runner ***********

"%JAVA%" %JAVA_OPTS% -cp "%CLASSPATH%" com.smartbear.ready.cmd.runner.pro.SoapUIProTestCaseRunner %*

:END

0 个答案:

没有答案