3 Replies Latest reply on Apr 28, 2015 5:00 AM by wdfink

    How to use Jboss 6 to serve static content

    zhujiabo1987

              I have a web application project, within the WEB-INF/ENV we have a app.property file. Recently, our manager wants me to find a way to put this app.property file into jBoss 6 server and create a reference within this application to find this app.property file. I know in Jboss 6 it can only deploy war file and I can't create virtual directory in jBoss 6. Can any one help me deploy this static content in jboss server and find a way to map this property file to the application. Thank you very much!

        • 1. Re: How to use Jboss 6 to serve static content
          wdfink

          You might pack the property into a jar and add it to the classpath, this can be done as a library to be available for all applicaitons.

          You can use the Classloader to find that property file then.

           

          Other option is to create an MBean to access the file and provide the configuration, this is a server specific approach and you need to do a bit work.

          If you use a database for this it might be a single point of configuration if you use a cluster. To read the configuration you might use a @Singleton bean

           

          An approach which is also used, but not spec compliant is to add a java property to the jboss start where the property file is located and read it directly. This is not conform to the EJB spec as you should not use IO in your application. Also this might have issues in a cluster as each node need the same configuration.

          • 2. Re: How to use Jboss 6 to serve static content
            zhujiabo1987

            Thank you very much for your answer. I create a ROOT.war file and deploy it on Jboss server.I use this folder as container to hold my properties files. Now I face  another challenge. Our application is using spring framework. and it use <context: property-placeholder location="path/app.properties"/> to load the properties file. Now since the app.properties file is stored on jboss server, what is the strategy to get this file mapped to our local application. Or if our application is deployed on the server, it can automatically get reference of this app.properties file.

            • 3. Re: How to use Jboss 6 to serve static content
              wdfink

              Sorry, did not have Spring knowledge