6 Replies Latest reply on Jul 18, 2012 8:12 AM by Marcus Goth

    System properties substitution in subsystems

    Marcus Goth Newbie

      I'm trying to use system properties in datasources and security subsystem.

       

      I looks like that both subsystems don't support system properties.

       

      I'm starting jboss in domain mode with the -P=somePropertyFile option. I specified a datasource.url=aLinkToMyDbServer in the property file und used ${datasource.url} in the <connection-url>section but i doesn't pick up the value instead its using  "${datasource.url}" as a value.

       

      Can someone confirm that system property substitution is working at all and is it just not working for these 2 subsystems, should it work in all subsystems or only in selected subsystems.

       

      If it only works in selected subsystem, can someone please name them, THANKS?

        • 1. Re: System properties substitution in subsystems
          Tomaz Cerar Master

          Hi and welcome to forums.

           

          best way to check which attributes support expressions and which dont is to connect with cli to server.

          and run command

          :read-resource-description(recursive=true)

          on resource(subsystem) you would like check.

           

          for instance for datasources you could run

          /subsystem=datasources:read-resource-description(recursive=true)

           

          or just for datasources:

          /subsystem=datasources/data-source=ExampleD:read-resource-description

           

          and you would get something like this:

            "attributes" => {

                "connection-url" => {

                    "type" => STRING,

                    "description" => "The JDBC driver connection URL",

                   "expressions-allowed" => true,

                    "nillable" => false,

                    "min-length" => 1L,

                    "max-length" => 2147483647L,

                    "access-type" => "read-write",

                    "storage" => "configuration",

                    "restart-required" => "no-services"

                },

                "driver-class" => {

                    "type" => STRING,

                    "description" => "The fully qualified name of the JDBC driver class",

                    "expressions-allowed" => true,

                    "nillable" => true,

                    "min-length" => 1L,

                    "max-length" => 2147483647L,

                    "access-type" => "read-write",

                    "storage" => "configuration",

                    "restart-required" => "no-services"

                },

                "datasource-class" => {

          ...

          ...

          and expression-allowed = true tells you that attribute supports expressions.

          so what you are trying to do with datasources should work.

           

          keep in mind that propertes are related to server (host controler) and not to domain controller (unless they are global)

          so every server should define them speratly if you are doing this with -P

          better way would be to define system properties in configuration and that can be shared between all servers in domain.

           

          --

          tomaz

          • 2. Re: System properties substitution in subsystems
            Marcus Goth Newbie

            thanks its works for datasources now but not for security subsystem due to expressions-allowed = false. Can i use System Properties in cli to write the configuration?

            • 3. Re: System properties substitution in subsystems
              Tomaz Cerar Master

              Hey,

               

              what exactly are you trying to do with security configuration that does not work?

               

              is it similar to this https://issues.jboss.org/browse/AS7-5177

              or is something else?

               

              --

              tomaz

              • 4. Re: System properties substitution in subsystems
                Marcus Goth Newbie

                I try to create a login-modules with cli

                 

                the command lookslike this

                 

                /profile=full-ha/subsystem=security/security-domain=myLDAPDomain/authentication=classic/:add(login-modules=[{"code"=>"org.jboss.security.auth.spi.LdapExtLoginModule","flag"=>"required",\

                                    "module-options"=>[("java.naming.factory.initial"=>"com.sun.jndi.ldap.LdapCtxFactory"),\

                                              ("java.naming.provider.url"=>"${ldap.url}"),\

                                              ("java.naming.security.authentication"=>"simple"),\

                                              ...

                See the ${ldap.url}, that is specified in a property file. But since the securtiy subsystem doesn't allow expressions it won't work. So my idea was to use system parameters when i build the config file with cli. But none of the parameter get resolved it is just writing "${ldap.url}" instead.

                 

                In production the admin just wants to run a script that sets up a new jboss depending on a property file for different environments.

                 

                Why not allowing expressions in all subsystems that would make things allot easier!

                • 5. Re: System properties substitution in subsystems
                  Tomaz Cerar Master

                  Hi,

                   

                  not allowing expressions for all attributes in all subsystems has historical reasons and we are trying to fix that.

                  You can follow AS7-4788 which tracks work that is beeing done in this area. We hope it will be completed for 7.2

                   

                   

                  Your problem is exacly the same as one described in AS7-5177 i have assigned it to myself and will fix it shortly.

                   

                   

                  --

                  tomaz

                  1 of 1 people found this helpful
                  • 6. Re: System properties substitution in subsystems
                    Marcus Goth Newbie

                    Thanks! Will these changes be part of EAP6.0.1 as well. If so I'll just wait for the next release.