1 Reply Latest reply on Apr 21, 2012 5:55 AM by sfcoy

    Where's the best place to put a resource in an EAR on JBoss AS 7?

    sboscarine

      Hello All,

      I am porting an ear from JBoss EAP 4.3 to JBoss AS 7 (and then EAP 6, once it's available).

       

      Our application has multiple wars that need to access a config file.  We use the following syntax:

      getClass().getClassLoader().getResource(CONFIG_FILE);
      

      and put the config file in our Maven project under /${ear-project-root}/src/main/application/APP-INF/classes. 

       

      Under src/main/application/META-INF/application.xml, we have:

        <module>
          <java>APP-INF/classes</java>
        </module
      

       

      This used to work in 4.3, but now I get:

      JBAS014775:New missing/unsatisfied dependencies: service jboss.deployment.subunit."app.ear".APP-INF/classes.STRUCTURE (missing) dependents: [service jboss.deployment.unit."app.ear".PARSE]
      

      I can see in the target directory that there's definitely an APP-INF/classes with files in it.

       

      I just need a folder where I can stick configs and have multiple wars access them.  I don't much care where it is.

       

      Any advice on how to create a shared config folder in an ear?

       

      Thanks in advance,

      Steven

        • 1. Re: Where's the best place to put a resource in an EAR on JBoss AS 7?
          sfcoy

          Jar your config file up and place it in the app.ear/lib directory.

           

          Make sure you update to the JEE6 EAR file schema.

           

          app.ear

          - META-INF

          -- application.xml

          - lib

          -- config.jar

          -- other.jar

          -- ...

          - web-module.war,

          - ejb-module.jar

          - etc

           

          Technically, there is no location in an EAR file that is accessible through a classloader. It seems that earlier versions of JBoss allowed this, but it was not spec-compliant behaviour and therefore not portable.