You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "bonampak (via GitHub)" <gi...@apache.org> on 2026/07/29 13:00:30 UTC
Re: [PR] KNOX-3278: Update JLine to 3.30.6 [knox]
bonampak commented on code in PR #1181:
URL: https://github.com/apache/knox/pull/1181#discussion_r3674453022
##########
gateway-shell-release/home/bin/knoxshell.sh:
##########
@@ -81,7 +81,7 @@ function main {
checkJava
buildAppJavaOpts
- $JAVA "${APP_JAVA_OPTS[@]}" -Dlog4j.configurationFile=conf/knoxshell-log4j2.xml -javaagent:"$APP_BIN_DIR"/../lib/aspectjweaver.jar -cp "$APP_JAR":lib/* org.apache.knox.gateway.shell.Shell "$@" || exit 1
+ $JAVA "${APP_JAVA_OPTS[@]}" -Dlog4j.configurationFile=conf/knoxshell-log4j2.xml -javaagent:"$APP_BIN_DIR"/../lib/aspectjweaver.jar -cp "$APP_JAR":lib/* -cp "$APP_JAR":lib/* org.apache.knox.gateway.launcher.Launcher "$@" || exit 1
Review Comment:
I kept Launcher and removed the duplicate classpath option.
It's because our logging configuration is referring to sys:launcher.dir and sys:launcher.name.
The shaded jar is also using Launcher as main class.
Either we specify these properties in the launcher script or we use Launcher.
Otherwise the log file will not be created:
`./bin/knoxshell.sh -e "org.apache.logging.log4j.LogManager.getLogger('test').error('hello from knoxshell')"`
``
main ERROR Unable to create file ${sys:launcher.dir}/../logs/${sys:launcher.name}.log
java.io.IOException: No such file or directory
at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.base/java.io.File.createNewFile(File.java:1043)
at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.lambda$getFileManager$0(RollingFileManager.java:315)
``
There are currently classloader issues if we would use -jar and we place extra jars, for example database driver jars in the lib folder. So the -cp flag is needed in that case and -jar cannot be used (the shaded jar does not specify a classpath in its manifest). I'll create a separate issue to use launcher and be consistent with other modules.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org