0

I have a power shell script that is running on the virtual machine, which creates a PSSession to a physical machine and performs a command to run a testrunner.bat file.

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

When ever I run this I get the error:

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

Error occurred during initialization of VM

Could not reserve enough space for object heap

I have tried:

  • ControlPanel -> Java -> Java -> View -> Changing Runtime Parameters
  • ControlPanel -> System -> ... -> System Variables -> Changing Path & _JAVA_OPTIONS
  • Changing the -Xmx directly in the testrunner.bat file

I have used the following values; 256, 512, 1024, 2048, and 4096

None of this seems to change the outcome.

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
Ross
  • 2,463
  • 5
  • 35
  • 91
  • What is in testrunner.bat? – Stephen C Jul 26 '18 at 13:35
  • Updated the question with the code from testrunner.bat – Ross Jul 26 '18 at 13:38
  • I have already tried those solutions and it doesn't work – Ross Jul 26 '18 at 13:47
  • Nonetheless, that is what the real problem is. The solution is to make sure that the *actual* `-xmx` option used is not too large. Unfortunately, we cannot see exactly what you are doing. The best I can suggest is that you double check, triple check how you are setting `-xmx`, and what value is actually being used. You could also try adding `-XshowSettings:all` ... – Stephen C Jul 26 '18 at 14:02

0 Answers0