1 2 Previous Next 23 Replies Latest reply on Feb 7, 2007 5:53 PM by peterj Go to original post
      • 15. Re: Explicit document source root using context/docbase
        gburcher

        Thanks for the suggestion. I had already seen the UsingContextDotXML wiki entry. This entry presumes that I have a web-app root directory, say MyWebApp.war, located in the jboss-install\server\default\deploy\jbossweb-tomcat55.sar directory.

        The entry says to put the context.xml file in MyWebApp.war\WEB-INF. My whole purpose is to put the MyWebApp.war directory somewhere else, outside of the JBoss install directory. But I tried it anyway. I put an empty MyWebApp.war directory with WEB-INF in the jbossweb-tomcat55.sar directory. I put my context.xml file in WEB-INF. Here are the contents of the context.XML file:

        <Context docBase="c:/MyLocation/MyWebApp.war" reloadable="true">
        </Context>


        In the c:/MyLocation/MyWebApp.war directory I put the full deployment tree, including WEB-INF, that would normally go under the jbossweb-tomcat55.sar directory. With this configuration I get a 404 error on any jsp that I try to hit. Not sure if I could put the docBase value inside jboss-web.xml instead of context.xml. Can't find documentation of the allowed contents of jboss-web.xml.

        It seems like there should be a way to define a web-app/context outside of the root directory for the web-app/context and specify the location of the root directory. Otherwise, there is a catch-22. I want to specify the root location of my web-app, but jboss/tomcat has to look inside the root location of my web-app to read the configuration info.

        I'm close to giving up on this one. Is there anyone associated with JBoss development who can offer help?

        • 16. Re: Explicit document source root using context/docbase
          j2ee_junkie

          If you don't want my help, I'll be happy to move on. In past versions of Tomcat, context elements were added to the server.xml config file. Now that is discouraged in favor of web-app specific context.xml files. However, in your case, I think you should add your context configuration inside Tomcat's server.xml file.

          cgriffith

          • 17. Re: Explicit document source root using context/docbase
            gburcher

            Sorry, I didn't mean to say that your help was not appreciated. The wiki entry that you cited was a useful suggestion. It's just that, at this point, I have read through that entry and all other config documentation that seems to be available, tried all the suggested techniques and none of it seems to work for what I want to do.

            I tried putting the Context entry under the Host entry of the server.xml file and that did not work either. If I have no MyWebApp.war in the JBoss install path and provide Context entry inside server.xml setting docBase to MyWebApp.war directory located outside of the JBoss install path, I get a series of errors on JBoss startup. Root error seems to be:

            org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.


            I can spend some more time researching this error but, before doing that, I was hoping for some confirmation that putting the Context definition inside the server.xml was definitely the correct approach.

            Like you, I had seen JBoss config docs that suggest not to put Context entries inside of server.xml anymore.


            • 18. Re: Explicit document source root using context/docbase
              j2ee_junkie

              I have tried to get this to work too, but only been able to get static content to be made available. Sorry.

              cgriffith

              • 19. Re: Explicit document source root using context/docbase
                gburcher

                I found a suggestion in another thread, dated 3/21/2006:

                AFAIK, deploying a war by simply deploying a context.xml is not supported.

                You can configure JBoss to scan external directories for deployment; look at the server/.../conf/jboss-service.xml file, DeploymentScanner MBean, URLs attribute.

                _________________
                Brian Stansberry
                Lead, AS Clustering
                JBoss, a division of Red Hat


                I added my external directory to the URLs attribute under the DeploymentScanner MBean in server.xml. At startup, JBoss finds my deployment directory, reads the \WEB-INF\web.xml file located in the deployment directory, but I get this error:

                09:04:35,626 ERROR [MainDeployer] Could not create deployment: file://C:/dev/test.war org.jboss.ws.WSException: java.lang.ClassNotFoundException: com.my.package.MyServlet


                I have my .class files in an expanded package/directory structure located under \WEB-INF\classes. JBoss cannot find the class associated with my servlet definition in web.xml. I tried adding this to my web.xml:

                <class-loader>
                 <simple-loader path="c:/dev/test.war/WEB-INF/xsl"/>
                 <compiling-loader path="c:/dev/test.war/WEB-INF/classes"/>
                 <library-loader path="c:/dev/test.war/WEB-INF/lib"/>
                 </class-loader>
                


                Not sure if these elements are supported by JBoss in web.xml under the web-app element. I had used these elements as part of my Caucho Resin web.xml file. This class-loader info did not seem to help, still got ClassNotFoundException.

                Has anyone tried using this technique with the DeploymentScanner? Any help on how to help JBoss find the .class files?

                • 20. Re: Explicit document source root using context/docbase
                  azariah

                  I am facing the same problem. Previous posts in this thread point to solutions for serving static content outside JBoss/Tomcat install, but I need a way to deploy JSPs and servlets outside JBoss/Tomcat. Specifically, I need JBoss/Tomcat to run the web application directly from the source tree, so that JSP / Java file changes in the web application do not require a rebuild and redeploy.

                  Anyone know how to achieve this?

                  Thanks
                  Azariah

                  • 21. Re: Explicit document source root using context/docbase
                    peterj

                    Look at the URLs attribute of the last mbean in server/default/conf/jboss-service.xml.

                    • 22. Re: Explicit document source root using context/docbase
                      azariah

                      Thanks for your reply. Adding the WAR file location under URLs in server/default/conf/jboss-service.xml works fine. However, I need to use the directory which contains the expanded WAR file.

                      I have tried "file:/c:/MyApp", "file:/c:/MyApp/", "file:/c:/MyApp/WEB-INF" and "file:/c:/MyApp/WEB-INF/web.xml". Each attempt fails with different errors.

                      With "file:/c:/MyApp/" the errors were:

                      2007-02-07 13:39:13,821 ERROR [org.jboss.deployment.scanner.URLDeploymentScanner] Incomplete Deployment listing:

                      --- Packages waiting for a deployer ---
                      org.jboss.deployment.DeploymentInfo@75567bae { url=file:/C:/mg32/MailGate/Java/webapps/adminPortal/src/WEB-INF/classes/com/tumbleweed/tda/mg/admin/ApplicationEventHandler.class }
                      deployer: null
                      status: null
                      state: INIT_WAITING_DEPLOYER
                      watch: file:/C:/mg32/MailGate/Java/webapps/adminPortal/src/WEB-INF/classes/com/tumbleweed/tda/mg/admin/ApplicationEventHandler.class
                      altDD: null
                      lastDeployed: 1170884348258
                      lastModified: 1170884348258
                      mbeans:

                      org.jboss.deployment.DeploymentInfo@2013ee8e ...

                      • 23. Re: Explicit document source root using context/docbase
                        peterj

                        Try: file://c:/myapp.war

                        You need the .war suffix so that the deployer will know what it is deploying. Of course, this means you will probably have to rename your directory.

                        1 2 Previous Next