Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-4503

A space in $JAVA path causes bad MODULAR_JDK resolution

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 9.0.0.Final
    • None
    • Scripts
    • None
    • Hide
      mkdir '/tmp/space test'
      cd '/tmp/space test'
      wget https://download.jboss.org/wildfly/16.0.0.Final/wildfly-16.0.0.Final.tar.gz
      wget https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz
      tar xf wildfly-16.0.0.Final.tar.gz
      tar xf openjdk-11+28_linux-x64_bin.tar.gz
      JAVA_HOME='/tmp/space test/jdk-11' ./wildfly-16.0.0.Final/bin/standalone.sh 
      
      Show
      mkdir '/tmp/space test' cd '/tmp/space test' wget https://download.jboss.org/wildfly/16.0.0.Final/wildfly-16.0.0.Final.tar.gz wget https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz tar xf wildfly-16.0.0.Final.tar.gz tar xf openjdk-11+28_linux-x64_bin.tar.gz JAVA_HOME= '/tmp/space test/jdk-11' ./wildfly-16.0.0.Final/bin/standalone.sh

      When a user setup a JDK in a path containing a space, wildfly yields the following output :

      =========================================================================
      
        JBoss Bootstrap Environment
      
        JBOSS_HOME: /tmp/space test/wildfly-16.0.0.Final
      
        JAVA: /tmp/space test/jdk-11/bin/java
      
        JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true 
      
      =========================================================================
      
      org.jboss.modules.ModuleNotFoundException: java.se
      	at org.jboss.modules.Module.addPaths(Module.java:1266)
      	at org.jboss.modules.Module.link(Module.java:1622)
      	at org.jboss.modules.Module.relinkIfNecessary(Module.java:1650)
      	at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:296)
      	at org.jboss.modules.Main.main(Main.java:437)
      

      The problem lies inside bin/common.sh :

      setModularJdk() {
        $JAVA --add-modules=java.se -version > /dev/null 2>&1 && MODULAR_JDK=true || MODULAR_JDK=false
      }
      

      Since the test fails due to the variable being split, the final $JAVA_OPTS misses options such as --add-modules=java.se.

      The $JAVA variable can be quoted to fix the problem :

      setModularJdk() {
        "$JAVA" --add-modules=java.se -version > /dev/null 2>&1 && MODULAR_JDK=true || MODULAR_JDK=false
      }
      

              jaikiran Jaikiran Pai (Inactive)
              george.trudeau George Trudeau (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: