[ 
https://issues.apache.org/jira/browse/KNOX-3278?focusedWorklogId=1032814&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1032814
 ]

ASF GitHub Bot logged work on KNOX-3278:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Jul/26 13:00
            Start Date: 29/Jul/26 13:00
    Worklog Time Spent: 10m 
      Work Description: 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.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 1032814)
    Time Spent: 50m  (was: 40m)

> Update jline to 3.30.6
> ----------------------
>
>                 Key: KNOX-3278
>                 URL: https://issues.apache.org/jira/browse/KNOX-3278
>             Project: Apache Knox
>          Issue Type: Task
>          Components: KnoxShell
>    Affects Versions: 3.0.0
>            Reporter: Tamás Marcinkovics
>            Assignee: Tamás Marcinkovics
>            Priority: Minor
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Update jline.version to 3.30.6.
>  
> Groovy also needs to be updated to version 5, as groovysh 4 still uses jline2.
> [https://groovy-lang.org/changelogs/changelog-5.0.0.html]
> GROOVY-8162: Update Groovysh to JLine3
> https://issues.apache.org/jira/browse/GROOVY-8162)
> AspectJ for JDK17 needs to be upgraded to 1.9.21.1+: 
> [https://github.com/eclipse-aspectj/aspectj/blob/master/docs/release/README-1.9.22.adoc]
> JNA needs to be updated.
> [https://mvnrepository.com/artifact/org.apache.groovy/groovy-groovysh/5.0.4/dependencies]
> net.java.dev.jna:jna:5.18.1
> org.apache.groovy:groovy:5.0.4
> org.jline:jansi:3.30.6
>  
>  
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to