7 Replies Latest reply on Aug 31, 2008 10:47 AM by dagger33

    how to handle application properties(meta data)?

    amitguz

      Is there a way to keep properties in application level, meaning to use
      configurable application meta data (i.e - such the *.properties file)?

      currently as far as I know the only choise I have is to use the jboss-service.xml in the JBOSS_HOME/<default server>/conf.
      but I want to use the properties only for my application and not for all the application deployed in JBOSS.

      <mbean code="org.jboss.varia.property.SystemPropertiesService"
       name="jboss.util:type=Service,name=SystemProperties">
      
       <!-- Load properties from each of the given comma seperated URLs -->
       <attribute name="URLList">
       ./conf/local.properties
       </attribute>
      
       <!-- Set properties using the properties file style. -->
       <attribute name="Properties">
       property1=This is the value of my property
       property2=This is the value of my other property
       </attribute>
      
       </mbean>
      


        • 1. Re: how to handle application properties(meta data)?
          dimitris

          You can deploy the SystemPropertiesService along with your application (e.g. a xx-service.xml descriptor inside your .ear referenced by a statement).

          But those will be globally visible inside the VM, there is no "scoped" namespace of properties. If you deploy the same set of properties twice within 2 different applications, the latter deployment will overwrite the former one.

          • 2. Re: how to handle application properties(meta data)?
            amitguz

            Thanks for your quick answer Dimitris.

            but still I don't fully understand your answer, because I tried to add my own jboss-services.xml file to the EAR (in the META-INF directory)
            but it doesn't work, I couldn't access the properties, only when I use
            the jboss-services in JBOSS_HOME//conf it works.
            and as far as I understand jboss-services must be referenced to MBEAN (SAR) not to EAR, so how can I do it?

            can u give me an example of how to do it?
            and what do u mean by referenced by a statement?


            e.g. a xx-service.xml descriptor inside your .ear referenced by a statement


            Thanks a lot amit

            • 3. Re: how to handle application properties(meta data)?
              dimitris

              A myproperties-service.xml with an mbean entry similar with the one you put inf conf/jboss-service.xml. This can go in the root of your ear. Then reference this file with a "module" entry in your META-INF/application.xml so it's loaded.

              • 4. Re: how to handle application properties(meta data)?
                amitguz

                I'm a little confused, how can I reference an xml file (myjboss-service.xml) within the EAR descriptor (application.xml) ?
                the module tag can only have childrens tag such as .

                • 5. Re: how to handle application properties(meta data)?
                  dimitris

                  META-INF/jboss-app.xml

                  
                  ...
                   <module>myjboss-service.xml</module>
                  ...
                  

                  see docs/dtd/jboss-app_4_0.dtd

                  • 6. Re: how to handle application properties(meta data)?
                    amitguz

                    but now I'm receiving the following error code:

                    File META-INF/jboss-app.xml process error. Line: 9. Error message: The content of element type "module" must match "(service|har)


                    by the way, I'm using JBOSS 4.0.3.



                    • 7. Re: how to handle application properties(meta data)?
                      dagger33

                      Aaah, he must has meant to include it in a "service" tag

                      <jboss-app>
                       <!--
                       <module>
                       <service>hibernate-service.xml</service>
                       </module>
                       -->
                       <module>
                       <har>sandboxtest.har</har>
                       </module>
                      </jboss-app>
                      


                      See the commented section. (I did however have some trouble implementing it...and finally put it in the META-INF of the har file where it was picked up by JBoss. Don't know if anyone else have been having trouble with this)

                      Also, you might want to have a look at the documentation:
                      http://docs.jboss.org/jbossas/jboss4guide/r5/adminguide.pdf