2 Replies Latest reply on Jul 5, 2005 4:25 PM by zedonis

    Problem with automatically exploded .sar file

    zedonis

      I am running some code that requires an xml file on the classpath, and would like to deploy it to JBoss. I can deploy the code with the xml file inside an ear file without any problems. However, it does not work when I deploy it inside a sar file. After some digging, it looks like only the .jar files are exploded into the server/default/tmp/<sar file> directory.

      I can deploy an exploded directory instead of the sar file, but this is less than ideal because of the number of deploys I will need to do. Rewriting the code isn't an option.

      Any ideas? Thanks

        • 1. Re: Problem with automatically exploded .sar file
          starksm64

          URLs resolve differently against directory base URLS vs a jar file. Without the details of what is being done that does not work I can't say more than look into this.

          • 2. Re: Problem with automatically exploded .sar file
            zedonis

            As it turns out, rewriting the code was a better option than manually exploding the .sar file each time, so that is what we did. The underlying code was using

            classLoader.getResource(filename)
            which we were able to change to
            classLoader.getResourceAsStream(filename)

            The first call gets a URL, and the second an Input Stream. When the first bit of code is called with "bar.xml", it fails while looking for: C:\jboss-4.0.1sp1\server\default\tmp\deploy\tmp20951foo.sar-contents\bar.xml It can't find the file, because it is not unpacked into the temp directory..

            The second one finds the file, without looking in the temporary directory, by getting it directly from foo.sar.

            I still don't know why the .ear file is fully exploded into it's temporary directory, and the .sar file is only partially exploded (only .jar files.)