4 Replies Latest reply on Mar 20, 2007 9:51 PM by rogerdengcn

    Exploded WebModul: Can web-uri point outside of jboss?

    daisukeyon

      I want to used a exploded deployment for a webmodule, and the exploded directory (web-uri) is outside of jboss, is this possible?
      If tested it on Oracle OC4J and Bea Weblogic, and this works. Is this not standard?

      application.xml:

       <module>
       <ejb>catalogserver.jar</ejb>
       </module>
      
       <module>
       <web>
       <web-uri>D:\data/prg/TRUNK/platform/ext/webmc/web/webroot</web-uri>
       <context-root>/webmc</context-root>
       </web>
       </module>
      



      results in:
      17:42:07,387 INFO [EARDeployer] Init J2EE application: file:/D:/data/prg/TRUNK/appserver/jboss-4.0.4/server/default/deploy/hybrisplatform.ear/
      17:42:07,403 ERROR [MainDeployer] Could not initialise deployment: file:/D:/data/prg/TRUNK/appserver/jboss-4.0.4/server/default/deploy/hybrisplatform.ear/
      org.jboss.deployment.DeploymentException: url file:/D:/data/prg/TRUNK/appserver/jboss-4.0.4/server/default/deploy/hybrisplatform.ear/D:/data/prg/TRUNK/platform/ext/webmc/web/webroot could not be opened, does it exist?
       at org.jboss.deployment.DeploymentInfo.<init>(DeploymentInfo.java:211)
       at org.jboss.deployment.EARDeployer.init(EARDeployer.java:250)
       at org.jboss.deployment.MainDeployer.init(MainDeployer.java:861)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:798)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
       at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      


      It looks like the path
      file:/D:/data/prg/TRUNK/appserver/jboss-4.0.4/
       server/default/deploy/hybrisplatform.ear/D:/data/prg/TRUNK/platform/ext/webmc/web/webroot
      


      is obviously not valid, but why is the web-uri path appended to the ear directory, in spite of using it as an absolute path?
      Has the web-uri path always to point INSIDE the jboss folder?

      Thanks in advance, for every comment.

        • 1. Re: Exploded WebModul: Can web-uri point outside of jboss?
          thomasmarkus

          I have exactly the same problem.

          It is very annoying that you cannot have your web application at some place on your harddirk where you have checked out from cvs/svn and have the appserver at a different place.

          We have a given filestructure, our exploded directories do NOT have a ".war" ending (hence they cannot be used as exploded dirs) and the webapps of our j2ee application are wide spreaded at different locations.

          It is so cool in oc4j and other appservers and very important if you can use something like

          <web-uri>D:\data/prg/TRUNK/platform/ext/webmc/web/webroot</web-uri>
          


          or

          <web-uri>../../ext/webmc/web/webroot</web-uri>
          


          and do NOT have everything packed and copied at a single place and name the directory xy.ear/ or the war's xy.war/.

          any suggestions? I'm sure we just missed something in the documentaiton.?


          • 2. Re: Exploded WebModul: Can web-uri point outside of jboss?
            starksm64

            Its not required by the spec to support such deployments. We have a long standing feature request for this that I have upped the priority on for the next release:
            http://jira.jboss.com/jira/browse/JBAS-1486

            • 3. Re: Exploded WebModul: Can web-uri point outside of jboss?
              thomasmarkus

              thanks for the quick reply.

              We have patched just one line in EARDeployer.java and AbstractWebContainer.java and it seems to work.

              EARDeployer: starting from line 247 (4.0.4src), this will give the possibility to add directories outside the EAR-package:

              if (di.isDirectory)
              {
               File f = new File(parentDir, fileName);
               //XXX start we added the next line
               if(!f.exists()) f = new File(fileName);
               //XXX end
               sub = new DeploymentInfo(f.toURL(), di, getServer());
              }
              


              AbstractWebContainer: starting from line 276, this will disable the need for a webapplication directory to end with ".war":

              public boolean accepts(DeploymentInfo sdi)
              {
               // Should be checking for .war and .war/
               boolean accepts = super.accepts(sdi);
              
               //XXX start, added next line
               if( ! accepts ) if ( sdi.webContext!=null ) accepts = true;
               //XXX end
               ...
              




              • 4. Re: Exploded WebModul: Can web-uri point outside of jboss?
                rogerdengcn

                Thanks Thomasmarkus 's patch, It works very well for exploded ear. But I want to deploy a exploded war with web-uri point to directory outside of the ear file. I changed the code from 256 line of EARDeployer, it works for me. Hope the later JBoss AS release support this feature, it's very important if application want to support more than one J2EE AS(sicne other J2EE AS have such feature, even it is not J2EE mandatory feature).

                // if( nestedURL == null )
                // throw new DeploymentException("Failed to find module file: "+fileName);
                // sub = new DeploymentInfo(nestedURL, di, getServer());
                
                 if( nestedURL == null ) {
                 File f = new File(fileName);
                 if (f.exists())
                 {
                 sub = new DeploymentInfo(f.toURL(), di, getServer());
                 } else {
                 throw new DeploymentException("Failed to find module file: "+fileName);
                 }
                 } else {
                 sub = new DeploymentInfo(nestedURL, di, getServer());
                 }