4 Replies Latest reply on Oct 29, 2009 6:50 AM by thomasgo

    deploy unpacked wars in external directory

    thomasgo

      Hi,

      I have a maven project that contains a web module along with several other jars. The jars are deployed as an EAR into deploy/ but the war should not, for development reasons (changing the pages should not require a rebuild).

      So I added the war directory to in jboss-service.xml. The structure is <project dir>/src/main/webapp/myapp.war and I registered <project dir>/src/main/webapp/.

      However, on startup I get:

      19:26:49,764 ERROR [ContextConfig] Exception fixing docBase: {0}
      java.util.zip.ZipException: The system can't find the given path (this might not be fully correct, since I translated it from the German message)
       at java.util.zip.ZipFile.open(Native Method)
       at java.util.zip.ZipFile.<init>(ZipFile.java:203)
       at java.util.jar.JarFile.<init>(JarFile.java:132)
       at java.util.jar.JarFile.<init>(JarFile.java:70)
       at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:56)
       at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:41)
       at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:78)
       .....


      What am I missing?

        • 1. Re: deploy unpacked wars in external directory
          jaikiran

          Sorry, but i did not understand the details you posted. But looking at your subject line, i guess you want this http://www.jboss.org/community/wiki/HowtodeploymyapplicationinanexternaldirectoryinJBoss-5. I am assuming you are using JBoss AS5. If not, post the exact version of the server.

          • 2. Re: deploy unpacked wars in external directory
            thomasgo

            A sorry, no I'm currently using JBoss 4.2.3.GA.

            The problem is that I told JBoss where to look for applications and it finds the war folders (unpacked applications) in the external directory. But on startup it seems to have difficulties to read the folder. It looks like JBoss is assuming that the application is packed in an archive (at least that's what I think the line "java.util.zip.ZipFile.open(Native Method)" wants to tell me).

            • 3. Re: deploy unpacked wars in external directory
              thomasgo

              No luck yet.

              I tried deploying an exploded ear containing an exploded war in an external directory, and it works like a charm.

              But when I deploy the exploded war directly it doesn't work. Very strange.

              • 4. Re: deploy unpacked wars in external directory
                thomasgo

                Finally, I have found the error.

                I had

                deploy/,file://C:/<project dir>/src/main/webapp/
                which worked with an unpacked EAR lying in the folder (e.g. C:/<project dir>/src/main/webapp/myapp.ear) but not with an unpacked war.

                Changing this to
                deploy/,file:///C:/<project dir>/src/main/webapp/
                (one more slash after file:) enabled JBoss to read the directory it found. This now works.

                What I still don't understand:

                Reflecting on the change I remembered that a preceding slash marks the path as absolute. If the slash is missing the path is relative to the server, hence 'deploy/' and not '/deploy/'.

                Stripping the protocol from my path results in C:/<project dir>/src/main/webapp/ which would mean the path should be relative to the server. It thus makes sense that JBoss couldn't read myapp.war inside that path, since a path /C://.../myapp.war doesn't exist.

                What is strange though, is that JBoss found myapp.war inside that (non-existing) path and had no problems loading myapp if it was an ear (i.e. myapp.ear).