1 2 Previous Next 26 Replies Latest reply: Aug 3, 2012 9:21 PM by xiang yingbing RSS

Properties files in JBoss 7

Ralf Battenfeld Novice

Hello

 

First of all congratulation for the fantastic work on JBoss 7!

 

I tried out JBoss 7.0.0.Final, especially to learn the new concepts and to find the impacts for our existing application. We are using heavily the properties-services by defining properties files. I saw that individual properties are definable on different levels but not for properties files. Is this feature somehow provided and I didn't realize it or is on the roadmap?

 

Thanks

Ralf

  • 1. Re: Properties files in JBoss 7
    Jim Dwyer Novice

    Did you find a way to deploy properties files?  Seems like an obvious thing to do.  Anybody know how to deploy a properties file?

  • 2. Re: Properties files in JBoss 7
    Riccardo Pasquini Novice

    in the domain you can set properties per server group and every server in it will have them...

  • 3. Re: Properties files in JBoss 7
    Ralf Battenfeld Novice

    Hi Riccardo

     

    Single properties or properties files? I didn't found a way of passing a properties file.

  • 4. Re: Properties files in JBoss 7
    Riccardo Pasquini Novice

    Single properties but you can use the jboss-admin CLI to create a set of properties via sh... it becomes something like to hot-deploy (once) a property file...

     

    so i thought you can use a scriptable way to call

     

    /server-group=dragon/system-property:add(name=test1,value=test1)

     

    but it fails :_(

     

    [domain@localhost:9999 /] /server-group=dragon/system-property:add(name=test1,value=test1)     

    {

        "outcome" => "failed",

        "failure-description" => {"domain-failure-description" => "profile may not be null "},

        "rolled-back" => true

    }

     

    even if

     

    [domain@localhost:9999 /] /server-group=dragon:read-children-names(child-type=system-property)

    {

        "outcome" => "success",

        "result" => [

            "dragon.instance.name",

            "dragon.module.name",

            "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR"

        ]

    }

     

    so i'm quite confused... references for the CLI are https://docs.jboss.org/author/display/AS7/Management+Clients

     

    bye

     

    EDIT: the :add operation seems to try to add a new server-group...

  • 5. Re: Properties files in JBoss 7
    Jim Titlow Newbie

    I am also trying to work with system properties in a standalone server and I see examples of declaring them in the domain model as <system-properties> but this does not appear to work with the standalone model.  I get a parsing error with an unexpected element exception but the schema seems to support the notion of <system-properties> for custom properties.  I have also tried the CLI as Riccardo suggested but there does not appear to be a valid add method under the system property path in the CLI.  It appears that once a system property is defined that the -P option at startup will support the passing of a system properties file with values. Anyone have further suggestions?  Thanks...

  • 6. Re: Properties files in JBoss 7
    Jim Dwyer Novice

    It is possible to read properties files here:

     

     

        <management>
            <security-realms>
                <security-realm name="PropertiesMgmtSecurityRealm">
                    <authentication>
                        <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
                    </authentication>
                </security-realm>
            </security-realms>
            <management-interfaces>
                <native-interface interface="management" port="9999"/>
                <http-interface interface="management" port="9990"/>
            </management-interfaces>
        </management>

     


    I don't see anything in the xsd that would allow property files to be read in the <system-properties> area.

     

    I will look again.

  • 7. Re: Properties files in JBoss 7
    Jim Titlow Newbie

    Thanks Jim... I was wondering about that but thought that may be specific to defining a security realm.  Here is the example that I find in the domain.xml:

     

    <system-properties>

            <!-- IPv4 is not required, but setting this helps avoid unintended use of IPv6 -->

            <property name="java.net.preferIPv4Stack" value="true"/>

    </system-properties>

     

    But this does not work in the standalone.xml and it seems as though this would be the acceptable mechanism for defining a custom system property.  In the Admin Guide they briefly discuss system properties and scoping but the Admin Guide discusses a <system-property> element (contrary to the definition in the domain.xml using the <system-properties> element) defined inside a <server> element.  That did not work for me as well and I would have figured that it would be possible to define such in a standalone.xml configuration file.  I will give your post a shot as well.  Thanks...

  • 8. Re: Properties files in JBoss 7
    Jim Titlow Newbie

    A bit more experimenting may have answered the original post (or at least my perspective on the question). The Admin Guide states that properties can be passed into the standalone at startup using the the -P or --properties option (like previous versions of JBoss).  The example would be standalone.sh -P=<path to your properties file>.  The properties file is just a name=value pair list (like previous versions of JBoss).  The values for standalone are set as a part of the boot process so you will see in the boot.log the complete list of properties defined (default as well as custom properties you may have defined).  This would preclude the need to define system properties in the configuration xml.  I would still be curious as to the proper xml syntax to define custom system properties in the standalone.xml in the event I did not want to pass in a name=value pair property file at startup.  And if this is possible in a standalone since the properties seem to set as a part of the boot process.  As stated in the domain mode the system propertiesare applied to servers in the domain at server launch which I imagine means that they are passed in and present for the boot process.

  • 9. Re: Properties files in JBoss 7
    Riccardo Pasquini Novice

    in the domain there is a flag to set them as boot properties

  • 10. Re: Properties files in JBoss 7
    Jim Dwyer Novice

    I tried the -P and --properties option and they didn't work for me.  Did they work for you?

  • 11. Re: Properties files in JBoss 7
    Jim Titlow Newbie

    Yes, they did work for me.  They did not work for me in the previous beta versions so that was the reason I was looking at possibly making use of system properties.  If you are passing in properties using the -P or --properties option I would recommend checking the boot.log to see if the properties did make it into the boot process.  You should see your name=value pair during the boot process in the boot.log.  If they are there then it is a matter of getting the properties recognized by the standalone.xml using the syntax of ${property_name} in the xml.  I see that for the jboss properties (such as jboss.server.log.dir in the logging configuration they do not use that syntax (which is the syntax we used in previous versions of JBoss) and that is what had me confused. I went back to the old syntax of ${property_name} in the xml and it works fine for me now.  Hope this helps...

  • 12. Re: Properties files in JBoss 7
    Jim Dwyer Novice

    OK.  Will look into it.  It seems to me that it would be better if you could configure the system from one spot. In this case the standalone.xml file.  Having to use the command line is starting to make the configuration more complicated.  I prefer one way of doing things. 

  • 13. Re: Properties files in JBoss 7
    jaikiran pai Master

    JimDwyer wrote:

     

    It seems to me that it would be better if you could configure the system from one spot. In this case the standalone.xml file.  Having to use the command line is starting to make the configuration more complicated.  I prefer one way of doing things. 

    So you want to point to a properties file from the <system-properties> element in your configuration files (standalone.xml)?

  • 14. Re: Properties files in JBoss 7
    Jim Dwyer Novice

    Yes,  The <management> block allows you to define a properties file from standalone.xml.  Generic properties files are read from the command line.  This is confusing and inconsistent.  The <system-properties> block of the standalone.xml should let you define the properties files you want to use.  i.e.  Properties file usage should be standardized.

1 2 Previous Next