6 Replies Latest reply on Jan 28, 2011 4:25 AM by amigo amigo

    [resolved] Configuration externalization (properties file)?

    S T Newbie

      Hello,

       

      I was wondering if it was possible to externalize (use of variables) values in jboss-esb.xml through properties files?

       

      For example, Instead of defining my JMS provider as follow:

       

      <jms-provider connection-factory="ConnectionFactory"
         jndi-URL="tcp://localhost:61616"
         jndi-context-factory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" name="jms-prov">

      ...

       

      I would like to as it implemented something like that:

       

      <jms-provider connection-factory="ConnectionFactory"
          jndi-URL="${jms-prov.jndi-url}"
          jndi-context-factory="
      ${jms-prov.jndi-context-factory}" name="jms-prov">

      ...


      With "jms-prov.jndi-url" and "jms-prov.jndi-context-factory" being properties defined in an external .properties file to be specified in jboss-esb.xml for example. I would like this way to be abble to put any of the jboss-esb.xml configuration I like in such an external properties file.

       

      - Is something like that possible?

      - If so, can you tell me how to set this up?

       

      Thank you very much,

      Regards,

      Seb!

        • 1. Re: Configuration externalization (properties file)?
          Magesh Bojan Master

          Yes it is possible via System properties, does it not work for you when using -D property in the command line? You can specify these properties in your own properties file using the System Properties Service.

          • 2. Re: Configuration externalization (properties file)?
            S T Newbie

            Hello,

             

            Thank you for your help.

            I tried to modify my "jboss-service.xml" file to add the following section:

             

            But I got the following errors while starting my server:

             

            14:55:07,062 DEBUG [ProfileServiceBootstrap] Failed to build ManagedDeployment for: AbstractKernelDeployment@46a658{name=file:/D:/Programs/JBoss/jboss-soa-p.5.0.0/jboss-as/server/default/conf/bootstrap/logging.xml installed=true beanFactories=[AbstractBeanMetaData@52f73e{name=LogBridgeHandler bean=org.jboss.logbridge.LogBridgeHandler properties= constructor=null autowireCandidate=true}]}
            org.jboss.deployers.spi.DeploymentException: Error deploying: file:/D:/Programs/JBoss/jboss-soa-p.5.0.0/jboss-as/server/default/conf/bootstrap/logging.xml
                at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
                at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.deploy(BeanMetaDataFactoryVisitor.java:136)
                at org.jboss.system.server.profileservice.ProfileServiceBootstrap.initBootstrapMDs(ProfileServiceBootstrap.java:426)
                at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:242)
                at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
                at org.jboss.Main.boot(Main.java:221)
                at org.jboss.Main$1.run(Main.java:556)
                at java.lang.Thread.run(Unknown Source)
            Caused by: java.lang.IllegalStateException: ClassLoader has not been set
                at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit.getClassLoader(AbstractDeploymentUnit.java:154)
                at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.addBeanComponent(BeanMetaDataFactoryVisitor.java:60)
                at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.deploy(BeanMetaDataFactoryVisitor.java:126)
                ... 6 more

             

            [...]

             

            14:55:07,182 DEBUG [ProfileServiceBootstrap] Failed to build ManagedDeployment for: AbstractKernelDeployment@95a253{name=file:/D:/Programs/JBoss/jboss-soa-p.5.0.0/jboss-as/server/default/conf/bootstrap/vfs.xml installed=true beanFactories=[AbstractBeanMetaData@1d41116{name=VFSCache bean=null properties=[realCache, permanentRoots] constructor=AbstractConstructorMetaData@8e4805{parameters=[null] factoryClass=org.jboss.virtual.spi.cache.VFSCacheFactory factoryMethod=getInstance} autowireCandidate=true start=AbstractLifecycleMetaData@11a4bd4{ whenRequired=ControllerState@1adfbe3{Start} parameters= }}, AbstractBeanMetaData@1742c56{name=VfsNamesExceptionHandler bean=org.jboss.virtual.plugins.context.helpers.NamesExceptionHandler properties= constructor=AbstractConstructorMetaData@adf91{parameters=[java.lang.String]} autowireCandidate=true}]}
            org.jboss.deployers.spi.DeploymentException: Error deploying: file:/D:/Programs/JBoss/jboss-soa-p.5.0.0/jboss-as/server/default/conf/bootstrap/vfs.xml
                at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
                at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.deploy(BeanMetaDataFactoryVisitor.java:136)
                at org.jboss.system.server.profileservice.ProfileServiceBootstrap.initBootstrapMDs(ProfileServiceBootstrap.java:426)
                at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:242)
                at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
                at org.jboss.Main.boot(Main.java:221)
                at org.jboss.Main$1.run(Main.java:556)
                at java.lang.Thread.run(Unknown Source)
            Caused by: java.lang.IllegalStateException: ClassLoader has not been set
                at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit.getClassLoader(AbstractDeploymentUnit.java:154)
                at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.addBeanComponent(BeanMetaDataFactoryVisitor.java:60)
                at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.deploy(BeanMetaDataFactoryVisitor.java:126)
                ... 6 more

             

            [...]

             

            14:55:08,314 DEBUG [SARDeployer] Parsing: jboss-service.xml
            14:55:08,354 DEBUG [SARDeployer] Error during deploy: vfsfile:/D:/Programs/JBoss/jboss-soa-p.5.0.0/jboss-as/server/default/conf/jboss-service.xml
            org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfsfile:/D:/Programs/JBoss/jboss-soa-p.5.0.0/jboss-as/server/default/conf/jboss-service.xml
                at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
                at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:362)
                at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:322)
                at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:294)
                at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:234)
                at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1440)
                at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1158)
                at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1099)
                at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
                at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
                at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
                at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
                at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823)
                at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:782)
                at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
                at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
                at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
                at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
                at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403)
                at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
                at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
                at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
                at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
                at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775)
                at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
                at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308)
                at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)
                at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
                at org.jboss.Main.boot(Main.java:221)
                at org.jboss.Main$1.run(Main.java:556)
                at java.lang.Thread.run(Unknown Source)
            Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
                at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
                at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
                at org.jboss.deployers.vfs.spi.deployer.JAXPDeployer.doParse(JAXPDeployer.java:212)
                at org.jboss.deployers.vfs.spi.deployer.JAXPDeployer.parse(JAXPDeployer.java:186)
                at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parseAndInit(AbstractVFSParsingDeployer.java:256)
                at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse(AbstractVFSParsingDeployer.java:239)
                at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:355)
                ... 33 more
            14:55:08,364 ERROR [AbstractKernelController] Error installing to Parse: name=vfsfile:/D:/Programs/JBoss/jboss-soa-p.5.0.0/jboss-as/server/default/conf/jboss-service.xml state=Not Installed mode=Manual requiredState=Parse
            org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfsfile:/D:/Programs/JBoss/jboss-soa-p.5.0.0/jboss-as/server/default/conf/jboss-service.xml
                at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
                at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:362)
                at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:322)
                at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:294)
                at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:234)
                at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1440)
                at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1158)
                at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1099)
                at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
                at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
                at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
                at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
                at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823)
                at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:782)
                at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
                at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
                at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
                at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
                at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403)
                at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
                at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
                at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
                at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
                at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775)
                at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
                at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308)
                at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)
                at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
                at org.jboss.Main.boot(Main.java:221)
                at org.jboss.Main$1.run(Main.java:556)
                at java.lang.Thread.run(Unknown Source)
            Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
                at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
                at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
                at org.jboss.deployers.vfs.spi.deployer.JAXPDeployer.doParse(JAXPDeployer.java:212)
                at org.jboss.deployers.vfs.spi.deployer.JAXPDeployer.parse(JAXPDeployer.java:186)
                at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parseAndInit(AbstractVFSParsingDeployer.java:256)
                at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse(AbstractVFSParsingDeployer.java:239)
                at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:355)
                ... 33 more

             

            And then after that a lot of "ClassNotFound" exceptions.

             

            Can you tell me whatis wrong in my configuration?

            Can you also tell me once I have set up these properties how I can refer to them in mys jboss-esb.xml file?

             

            Thank you,

            Seb!

            • 3. Configuration externalization (properties file)?
              S T Newbie

              Hi,

               

              This error was apparently due to my "UltraEdit" editor that must be putting some "unsupported" caracter (or meta-caracter) in the file...

              Editing it with note pad worked (after several over server starting issues that I solved).

               

              Resolved!

              Thanks,

              Seb!

              • 4. [resolved] Configuration externalization (properties file)?
                amigo amigo Newbie

                Please, show  your example.

                 

                How you set parameters in jboss-esb.xml. I tryed as ${param} , but it isn't worked for me.

                • 5. [resolved] Configuration externalization (properties file)?
                  S T Newbie

                  Hi,

                   

                  1) First you need to add this "mbean" into your "[server]/conf/jboss-service.xml":

                   

                  <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">[PROPERTIES_FILE_PATH]</attribute>  

                        <!-- Set properties using the properties file style. -->

                        <attribute name="Properties" />

                  </mbean>

                   

                  where [PROPERTIES_FILE_PATH] is the path to the properties file in which you define your variables ("./conf/applications.properties" for me)

                   

                  2) Of course you need to put your properties file at the location you specified in the mbean

                   

                  3) You use your variable as is in your jboss-esb.xml: "${variable-name}"

                   

                  4) You have to restart your server.

                   

                  Hope this helps: cannot tell you more, this is all I did.

                  Regards,

                  Seb!

                  • 6. [resolved] Configuration externalization (properties file)?
                    amigo amigo Newbie

                    Thanks for your reply. It works. Althought it's not good variant to set application properties to system properties, but i understood that there is not another way.

                     

                    But i don't understand one thing. I updated my property file, updated  mbean and looked that one have updated properties. I see it across mbean operation 'showall', but jboss-esb didn't change its properties.

                     

                    How i can update these properties in my esb application without redeploy? Or need redeploy every time when want to change properties?