3 Replies Latest reply on Feb 14, 2012 6:08 AM by lafr

    Loading resource file from ear-file

    lafr

      Coming from JBoss AS 6.0 and 4.24.

      I put a resorce file named mbi_deploy.xml into the root of my ear file.

      It was read on runtime using this: InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( "mbi_deploy.xml" );

       

      Using JBoss AS7 now the file is not found. Where to put it for AS7?

      For a web-application it seems to have put to WEB-INF/classes to be found.

        • 1. Re: Loading resource file from ear-file
          sfcoy

          Historically, JBoss classloading has not been very spec compliant which is why it's worked for you in the past.

           

          The best place to put this file depends upon its purpose and which classes need access to it. Classes in the EAR/lib and EAR/ejbs will not be able to access this file when it's in a WEB-INF/classes directory.

           

          You could bundle it in a jar file in your EAR/lib directory for example.

          • 2. Re: Loading resource file from ear-file
            lafr

            OK, let me give further details.

            I have a war file and an ear file.

            For both I put mbi_deploy.xml into the root directory.

             

            For the war file I now put mbi_deploy.xml info WEB-INF/classes and there it is found.

             

            Whee to put it in case of the ear file?

            OK, I'll ry the apparoach of putting it into the jar file with the code trying to read if (ear/lib/common.jar).

            • 3. Re: Loading resource file from ear-file
              lafr

              The resource file is now in ear/lib/common.jar where also the class is which load this file and interprets the content.