Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-21254

CLI prints "WARN: can't find jboss-cli.xml" during bootable-jar build with packaging-scripts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 39.0.0.Beta1
    • CLI, Quickstarts
    • None
    • ---
    • ---

      Description

      When building a bootable JAR using wildfly-maven-plugin with [packaging-scripts], the CLI prints a warning to stderr:

      WARN: can't find jboss-cli.xml. Using default configuration values.
      

      Source of the Warning

      The warning originates from wildfly-core repository, specifically from:
      cli/src/main/java/org/jboss/as/cli/impl/CliConfigImpl.java

      Key code (around lines 86-99):

      static CliConfig load(final CommandContext ctx, CommandContextConfiguration configuration) 
          throws CliInitializationException {
          File jbossCliFile = findCLIFileFromSystemProperty();
          if (jbossCliFile == null) {
              jbossCliFile = findCLIFileInCurrentDirectory();
          }
          if (jbossCliFile == null) {
              jbossCliFile = findCLIFileInJBossHome();
          }
          if (jbossCliFile == null) {
              System.err.println("WARN: can't find " + JBOSS_CLI_FILE + 
                  ". Using default configuration values.");
              config = new CliConfigImpl();
          }
          ...
      }
      

      File Search Order

        1. System property jboss.cli.config
          2. Current directory - ./jboss-cli.xml
          3. JBOSS_HOME/bin/ - $JBOSS_HOME/bin/jboss-cli.xml

      Why This Happens During Bootable-JAR Build

        1. wildfly-maven-plugin executes CLI scripts via [packaging-scripts]
          2. During bootable JAR build, there is no full $JBOSS_HOME structure
          3. CLI cannot find the configuration file → prints warning to System.err

      Affected Quickstarts

      17 quickstarts use [packaging-scripts] in their pom.xml:

      • ee-security, ejb-security-context-propagation, helloworld-jms, helloworld-mutual-ssl, helloworld-mutual-ssl-secured, hibernate, http-custom-mechanism, jaxrs-jwt, logging, mail, messaging-clustering-singleton, micrometer, opentelemetry-tracing, security-domain-to-domain, servlet-security, todo-backend

      11 quickstarts have [bootable-jar]true[/bootable-jar] profile:

      • helloworld, micrometer, microprofile-config, microprofile-fault-tolerance, microprofile-health, microprofile-jwt, microprofile-lra, microprofile-openapi, microprofile-reactive-messaging-kafka, microprofile-rest-client, opentelemetry-tracing

      Only 2 quickstarts have BOTH packaging-scripts AND bootable-jar profile:

      • micrometer
      • opentelemetry-tracing

      This explains why only these 2 quickstarts produce the warning in bootable-jar builds.

      Possible Solutions

        1. Suppress warning in CLI - if jboss-cli.xml is not required, no warning should be printed (or use logging framework instead of System.err)
          2. Add empty jboss-cli.xml - to affected quickstarts
          3. Provide jboss-cli.xml during bootable-jar build - wildfly-maven-plugin could provide a default config

              yborgess1@redhat.com Yeray Borges Santana
              rhn-support-kstekovi Krystof Stekovic
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: