7 Replies Latest reply on Sep 26, 2002 4:40 AM by ewen

    Jetty Configuration Questions

    Miles Clark Newbie

      Hi -

      I'm running JBoss 3.0.1 w/Jetty, and a config questions:

      * JBoss appears to create a new temporary document root for HTML documents when deploying the jetty SAR. Is there a way to specify that Jetty use a specific non-temporary directory for web content? For instance can I specify "/usr/local/htdocs" as the document root for Jetty, so I can publish an html/jsp file simply by copying it into that directory? If so how?

      Thanks very much in advance!

      Miles

        • 1. Re: Jetty Configuration Questions
          Julian Gosnell Expert

          I want to serve content from outside a war
          -------------------------------------------------

          To serve external content, you can step outside the J2EE way of doing
          things and use Jetty's proprietary configuration mechanism to tell it
          to serve pages from anywhere on your disc.

          Add something like this to the ConfigurationElement in
          jbossweb.sar/META-INF/jboss-service.xml, to serve static pages:


          /documents/*
          /docroot/
          TRUE


          This example maps the context /documents to the directory /docroot, so
          to retrieve e.g. /docroot/myfile.html you would hit
          http://localhost:8080/documents/myfile.html.

          from :

          http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/contrib/jetty/FAQ?rev=HEAD&content-type=text/vnd.viewcvs-markup


          Jules

          • 2. Re: Jetty Configuration Questions
            Doug Donohoe Newbie

            I added this (as the last entry in the block):


            <!-- JDD - testing serving pages from /docs as / context -->


            /documents/*
            /docs/
            TRUE






            but it causes this error on startup. Any ideas? It is pretty
            similar to your example

            19:57:56,031 INFO [jbossweb] Registered jboss.web:Jetty=0,ServletHttpContext=0,context=/documents
            19:57:56,040 ERROR [jbossweb] problem configuring Jetty:
            java.lang.NoSuchMethodException: class org.mortbay.jetty.servlet.ServletHttpContext.setServingResources(class java.lang.String)
            at org.mortbay.xml.XmlConfiguration.set(XmlConfiguration.java:356)
            at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:227)
            at org.mortbay.xml.XmlConfiguration.call(XmlConfiguration.java:496)
            at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:231)
            at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:163)
            at org.jboss.jetty.Jetty.setXMLConfiguration(Jetty.java:355)
            at org.jboss.jetty.Jetty.setConfigurationElement(Jetty.java:328)
            at org.jboss.jetty.JettyService.createService(JettyService.java:165)
            at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:136)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:967)
            at $Proxy5.create(Unknown Source)
            at org.jboss.system.ServiceController.create(ServiceController.java:314)
            at org.jboss.system.ServiceController.create(ServiceController.java:242)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy3.create(Unknown Source)
            at org.jboss.deployment.SARDeployer.create(SARDeployer.java:217)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:755)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:615)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy4.deploy(Unknown Source)
            at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:427)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:648)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:499)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:261)
            at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:164)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:967)
            at $Proxy0.start(Unknown Source)
            at org.jboss.system.ServiceController.start(ServiceController.java:396)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy3.start(Unknown Source)
            at org.jboss.deployment.SARDeployer.start(SARDeployer.java:249)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:564)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:324)
            at org.jboss.system.server.ServerImpl.start(ServerImpl.java:221)
            at org.jboss.Main.boot(Main.java:142)
            at org.jboss.Main$1.run(Main.java:375)
            at java.lang.Thread.run(Thread.java:491)

            • 3. Re: Jetty Configuration Questions
              Alan Newbie

              I get the same thing, what is going wrong?

              • 4. Re: Jetty Configuration Questions
                Julian Gosnell Expert

                OK,

                The FAQ is out of date.

                I'll have a look around, as soon as I have time, and post a working solution.

                Thanks for spotting this guys.

                Jules

                • 5. Re: Jetty Configuration Questions
                  PC Sien Newbie

                  What about directing JBoss/Jetty to unpack the war to a specified directory? Can this be done?

                  • 6. Re: Jetty Configuration Questions
                    Julian Gosnell Expert

                    No, The spec does not guarantee that the war will be unpacked at all.

                    Look around on jetty.mortbay.org in the docs, I am sure that there will be an example of something similar.

                    Alternatively, try on jetty-discuss@yahoogroups.com

                    Please post the forum when you have the answer.


                    Jules

                    • 7. Re: Jetty Configuration Questions
                      ewen Newbie

                      Hi, a simply way to do this.
                      create new directory named XXX.war. like this one: JBOSS_DIST\server\default\deploy\XXX.war\
                      and then, copy your web application to it.

                      just try it.
                      i think so.