To recreated: 1. In session #1, Start Karaf using the command bin/karaf 2. In session #2, Start Karaf using the command bin/client 3. In session #2, execute the command writing the table, bugdata:display in this case. 4. In session #1, The warning will be displayed only once.
Additional behavior notes: - `table.print(System.out)` does not generate the warning - `table.print(session.getConsole())` will generate the warning on first use. Paul Spencer > On Jan 16, 2026, at 9:48 AM, Paul Spencer <[email protected]> wrote: > > Karaf: 4.4.3 > Java Virtual Machine: OpenJDK 64-Bit Server VM version 11.0.2+9 > > I am seeing the following error when using ShellTable.print() to shell's > session console. > > WARNING: An illegal reflective access operation has occurred > WARNING: Illegal reflective access by > org.apache.karaf.shell.support.table.ShellTable > (jar:bundle://e299aef6-746a-44e6-b810-da872d8d9244_44.0:0/!/) to field > java.io.PrintStream.charOut > WARNING: Please consider reporting this to the maintainers of > org.apache.karaf.shell.support.table.ShellTable > WARNING: Use --illegal-access=warn to enable warnings of further illegal > reflective access operations > WARNING: All illegal access operations will be denied in a future release > > The default for --illegal-access changes to deny in Java 16 and the > functionality is remove in Java 17. > https://docs.oracle.com/en/java/javase/16/docs/specs/man/java.html#extra-options-for-java > > The offending code appears in getEncoding() for > shell/core/src/main/java/org/apache/karaf/shell/support/table/ShellTable.java > Since the Should I create an issue in GitHub? > > ### Example Code > import org.apache.karaf.shell.api.console.Session; > import org.apache.karaf.shell.support.table.ShellTable; > @Service > @Command(scope = "bugdata", name = "appt-display", description = "Display an > appoiment schedule") > public class MyCommand implements Action { > @Reference > private Session session; > > @Override > public Object execute() throws Exception { > final var output = session.getConsole(); > final var table = new ShellTable(); > ... > table.print(output); > } > } > > > Paul Spencer
