1 Reply Latest reply on Aug 15, 2003 7:52 PM by Jon Barnett

    Problem expanding .war file during runtime

    nginterface Newbie

      Hi all,
      I'm fairly new to JBoss and I am having the following problem: I have created a .war file that contains a web services enabled application. The .war file is basically a compressed directory structure (using ant) that has a subfolder under the top-level folder. There are a couple of XML files that needs to be accessed during run time by the .class files (they are not servlets) in the top-level folder -- is there any way to tell JBoss to expand the .war file once it is dropped into the deploy folder (at least on run-time), so that the .class files can access the xml files in the subfolder of the top-level directory (within the .war directory structure)? My impression is that Tomcat should automatically expand .war files on deployment, but for some reason it doesn't seem to do so and the .class files cannot access the xml files in the subdirectory.

      I am using JBoss 3.2.1 with Tomcat.

      One more thing, why do the file access in any given deployed .class file tries to access the "<jboss-install-root>/bin" directory??

      Thanks in advance...

        • 1. Re: Problem expanding .war file during runtime
          Jon Barnett Master

          If you want to use unpacked WARs, you should perform this as part of your deployment. The default for standalone Tomcat is to unpack a WAR but is not the only way it will operate.

          Under the J2EE specs, it is not necessary to unpack a WAR and many app servers do not do this - that is, they do not materialise the entire WAR file structure to the local file system, particularly if the WAR is stored in a DB, stored on a remote file system or accessed via a URL.

          Since I assume that the class methods are invoked from a servlet, you might consider redesigning so the servlet passes a context reference so you can obtain a file in the WAR via getResourceAsStream("..."). This would also make your application more easily portable since you are not reliant on unpacked WARs.

          The JVM uses the JBoss bin directory as the starting reference as this is the directory in which the JVM was started.

          I think those are the set of options available.