3 Replies Latest reply on Sep 10, 2010 9:19 AM by michael.faber

    Resource path issue with Jboss AS 5.0

    muthukumaran_m

      Hi,

       

      We are currently porting our application from Jboss AS 4.2 to 5.0, in 4.2 our applciaton works properly but we have issues in 5.0

       

      We have all the resources files like, hibernate mapping xmls, other configuration xmls, jasper files under the WEB-INF\classes inside our application war file.

       

      In jboss AS 5.0 we have issues accessing those files under WEB-INF\classes. For the example our application is unable to read the jasper file in Jboss AS 5.0 but the same code works properly in Jboss AS 4.2

       

      Here is a sample code

       

      File jasperFile = new File("/TestReport.jasper");

       

      returns the follwing result

       

      - in 4.2

      jasperFile:D:\Softwares\jboss-AS-4.2\jboss-as\server\TEST_PROPS\tmp\deploy\tmp55974TEST-exp.war\WEB-INF\classes\TestReport.jasper

       

      - in 5.0

      jasperFile:D:\Softwares\jboss-AS-5.0\jboss-as\server\TEST_PROPS\deploy\TEST.war\WEB-INF\classes\TestReport.jasper

       

       

      I also noticed that in Jboss 5.0 the folder "D:\Softwares\jboss-eap-5.0\jboss-as\server\TWE_TE\tmp\deploy" is empty.

       

      Please help resolve this issue

        • 1. Re: Resource path issue with Jboss AS 5.0
          jaikiran

          That's not how you get access to resources in a JavaEE applications. Instead you should use something like:

           

                  URL resource = this.getClass().getClassLoader().getResource("TestReport.jasper");
          • 2. Re: Resource path issue with Jboss AS 5.0
            muthukumaran_m

            Thanks Jai for your point...I agree with you.... but there are lot of place in our application we have this code and it was working fine in 4.2 and the effort to change them will be huge....

             

            Any Idea on why we are not seeing the war exploded in the tmp folder?

            • 3. Re: Resource path issue with Jboss AS 5.0
              michael.faber

              M Muthukumaran schrieb:

               

              Any Idea on why we are not seeing the war exploded in the tmp folder?

              You should see the exploded archives in the tmp folder. But they are no longer exploded to the tmp/deploy folder but directly to the tmp folder (I am using the default server configuration). Each archive is exploded in an own folder which is named in an id-like fashion (for example "4h2i4u3j-1sx049-gcx59ckb-1-gcx5at6i-a0"). Clean up the tmp folder before restarting the server, so you can be sure to catch the right folder, as there can be multiple folders for each archive for multiple starts of the server.