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

Make standalone.sh more classpath friendly

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 18.0.0.Final
    • Class Loading
    • None

      Java 9+ no longer has jre/lib/ext, which was easiest way to add custom charset provider for use by JDBC data sources. The way to handle it now is to add charset jar on classpath or put it in app-specific lib/ext counterpart. It works well for apps like NetBeans or SquirrelSQL. I have found adding charset provider nearly impossible WildFly, which prevents migrating from Java 8 to 11, but a simple change to standalone.sh allows to solve that issue.

      I have tried various approaches:

      • classpath argument in JAVA_OPTS
      • custom global module with services set to true
      • JDBC driver module depending on custom module with services set to import
      • JDBC driver module with charset jar as resource (along driver jar)

      None of those method work. Finally I have found why the classpath argument doesn't work, it's because standalone.sh uses -jar option, which causes it to ignore classpath settings. By changing this line:

      -jar \""$JBOSS_HOME"/jboss-modules.jar\" \
      

      to

      -cp \""$JBOSS_HOME"/jboss-modules.jar:"$JBOSS_BASE_DIR"/lib/ext/*\" org.jboss.modules.Main \
      

      I was able to add charset jar on classpath by placing it in my profile/lib/ext directory.

      Please consider changing this code in standalone.sh to make the standalone/lib/ext directory actually useful for something.

      You may also try to investigate why isn't the charser provider loaded when using module approach. That might be some kind of bug.

              ropalka Richard Opalka
              dominik.derwinski Dominik DerwiƄski (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: