Contributions
Re: Receiving JVM error in jenkins when using testrunner.bat
I've come up with a solution tothe "The process cannot access the file because it is being used by another process." error. Simply generate a temp filename randomly on the fly, this method also uses a lock file since %random% in batch files isn't particularly random and collisions can occur if multiple runs execute at once. Temp file generation is at the top and the other alteration is down when CLASSPATH is being set, prefixing jfxrtpath with %tempFile%: @echo off :getTemp set "tempFile=testrunner_%random%" set "lockFile=%temp%\%tempFile%.lock" 9>&2 2>nul (2>&9 8>"%lockFile%" call :begin %*) || goto :getTemp :begin echo The unique tempfile for this process is "%tempfile%" set SOAPUI_HOME=%~dp0 if exist "%SOAPUI_HOME%..\jre\bin" goto SET_BUNDLED_JAVA if exist "%JAVA_HOME%" goto SET_SYSTEM_JAVA echo JAVA_HOME is not set, unexpected results may occur. echo Set JAVA_HOME to the directory of your local JDK to avoid this message. goto SET_SYSTEM_JAVA :SET_BUNDLED_JAVA set JAVA=%SOAPUI_HOME%..\jre\bin\java goto END_SETTING_JAVA :SET_SYSTEM_JAVA set JAVA=java :END_SETTING_JAVA rem init classpath set CLASSPATH=%SOAPUI_HOME%soapui-5.3.0.jar;%SOAPUI_HOME%..\lib\* "%JAVA%" -cp "%CLASSPATH%" com.eviware.soapui.tools.JfxrtLocator > %TEMP%\%tempFile%_jfxrtpath set /P JFXRTPATH= < %TEMP%\%tempFile%_jfxrtpath del %TEMP%\%tempFile%_jfxrtpath set CLASSPATH=%CLASSPATH%;%JFXRTPATH% rem JVM parameters, modify as appropriate set JAVA_OPTS=-Xms128m -Xmx1024m -Dsoapui.properties=soapui.properties "-Dsoapui.home=%SOAPUI_HOME%\" if "%SOAPUI_HOME%\" == "" goto START set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.libraries="%SOAPUI_HOME%ext" set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.listeners="%SOAPUI_HOME%listeners" set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.actions="%SOAPUI_HOME%actions" :START rem ********* run soapui testcase runner *********** "%JAVA%" %JAVA_OPTS% com.eviware.soapui.tools.SoapUITestCaseRunner %* 2>nul del "%lockFile%"7 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.4KViews0likes0Comments