horseman Posted February 24, 2020 Share Posted February 24, 2020 Hello,I have a "Path not found" when i useC:Jaspersoftjasperreports-server-cp-7.5.0buildomaticjs-import.bat --input-zip E:praxielInferenceExploitJasperenviron_prax.zipto import my zip file in Jasper server 7.5 on a Windows server 2019.I have checked the bat itself and found that the variable %~dp0 is not correctly set on line 38 CALL "%~dp0/bin/date.bat"It is set to E:praxielInferenceExploitJasper rather than the expected C:Jaspersoftjasperreports-server-cp-7.5.0buildomaticI modified the js-import.bat to set a new variable at the begining of the file and replaced all %~dp0 strings with %myvar%.The import works just fine now.------------------ my new js-import.bat -----------------@echo offREM Collect the command line argsSET CHEMIN=%~dp0REM ECHO %CHEMIN%set JS_CMD_NAME=%0set CMD_LINE_ARGS=:setArgsif ""%1""=="""" goto doneSetArgsset CMD_LINE_ARGS=%CMD_LINE_ARGS% %1shiftgoto setArgs:doneSetArgsREM Set the config folder to useREM if Pro config exists, then set to Pro configREM otherwise, assume ce configset JS_EDITION="ce"if exist "conf_sourceiePro" goto setConfProset CONFIG_DIR=conf_sourceieCegoto doneSetConf:setConfProset CONFIG_DIR=conf_sourceieProset JS_EDITION="pro":doneSetConfREM additional config dir to find the js.jdbc.propertiesset ADDITIONAL_CONFIG_DIR=build_confdefaultREM Add all jars the export classpath variableset EXP_CLASSPATH=%CONFIG_DIR%lib*remrem Initializing time variable.remCALL "%CHEMIN%/bin/date.bat"CALL "%CHEMIN%/bin/time.bat"SET JS_CURRENT_TIME=%NOW_YYYY_MM_DD%_%NOW_HH_MM%SET JS_SETUP_MODE="import"remrem Defining log file name, creating log directory if it doesn't exist.remSET /a JS_LOG_FILE_PREFIX=%RANDOM%+10000SET JS_LOG_FILE=logs/js-%JS_SETUP_MODE%-%JS_EDITION%_%JS_CURRENT_TIME%_%JS_LOG_FILE_PREFIX%.logIF NOT EXIST logs ( md logs)ECHO Writing to log file: %JS_LOG_FILE%REM Set the java commandREMREM If "..javabinjava.exe" exists then use itREMif exist "..javabinjava.exe" goto setLocalJavagoto setStandardJava:setLocalJavaset JAVA_HOME="..java"set PATH=..javabin;%PATH%goto doneJava:setStandardJavaif "%JAVA_HOME%"=="" goto warnJavagoto doneJava:warnJavaecho "WARNING: Did not find a JAVA_HOME environment variable setting. Script will continue.":doneJava:initializeAntEnvironmentIF EXIST "..apache-ant" ( GOTO :useBundledAnt )CALL :log "Bundled Ant not found. Using system Ant."SET ANT_RUN=antGOTO :endAntSetup:useBundledAntSET ANT_HOME=..apache-antSET ANT_RUN=%ANT_HOME%binantSET PATH=%PATH%;%ANT_HOME%bin:endAntSetup:runAntIF "%BUILDOMATIC_MODE%"=="" set BUILDOMATIC_MODE=interactiveSET JS_ANT_TARGET="validate-keystore"CALL :log "Running %JS_ANT_TARGET% Ant task"CALL :logCALL %ANT_RUN% -nouserlib -f build.xml %JS_ANT_TARGET% %JS_ANT_OPTIONS% && set temp= 2>&1 | "%CHEMIN%/bin/wtee" -a %JS_LOG_FILE%IF %ERRORLEVEL% == 0 ( GOTO :runImport )IF not %ERRORLEVEL% == 0 ( GOTO :runAntFailed )CALL :log "Checking Ant return code: OK"CALL :logGOTO :endremrem Console + file logging subroutine. TODOrem:logSET JS_LOG_MESSAGE=IF "%~1" == "" SET JS_LOG_MESSAGE=----------------------------------------------------------------------IF NOT "%~1" == "" SET JS_LOG_MESSAGE=%~1ECHO %JS_LOG_MESSAGE% | "%CHEMIN%/bin/wtee" -a %JS_LOG_FILE%GOTO:EOF:runImportREM Set the java memory optionsset JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -noverifyREM Add config dirs to EXP_CLASSPATHset EXP_CLASSPATH=%CONFIG_DIR%;%ADDITIONAL_CONFIG_DIR%;%EXP_CLASSPATH%;.java -classpath "%EXP_CLASSPATH%" %JAVA_OPTS% com.jaspersoft.jasperserver.export.ImportCommand %JS_CMD_NAME% %CMD_LINE_ARGS%GOTO:EOF:runAntFailedCALL :log "Checking Ant return code: BAD (1)"EXIT /b 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now