1 Reply Latest reply on May 27, 2011 5:10 AM by metallist

    Problem with SystemPropertiesService (JBoss 4 -> JBoss 6)

    metallist

      Hello everyone!

      I've run into some troubles while migrating my application from JBoss 4.2.3 GA to JBoss 6.0 Final. The problem is with accessing properties that I load via SystemPropertiesService & its URLList attribute in properties-service.xml from external configuration files (e.g. they reside in server/xxx/conf). In JBoss 4 I used the following approach to reading these properties:

       

      {code:java}

      ObjectName propObjectName = ObjectName.getInstance("jboss:name=SystemProperties,type=Service");

      SystemPropertiesServiceMBean props = (SystemPropertiesServiceMBean) MBeanProxy.get(SystemPropertiesServiceMBean.class, propObjectName, server);

      ...

      String someProperty = props.get(somePropertyName);

      {code}

       

      However, this code fails to compile for JBoss 6 because org.jboss.system.ServiceMBean which SystemPropertiesServiceMBean depends on is missing. So basically I've 2 questions:

      1. Is ServiceMBean really missing or is it that I just can't find it?
      2. What are the best practices to get properties from configuration files? Maybe there's a way to omit using SystemPropertiesService? I've read through a lot of discussions here but still I haven't seen any real guidelines. Maybe I'm just missing something.

       

      Thanks in advance for your help.