3 Replies Latest reply on Dec 16, 2002 11:15 AM by jules

    [ Jetty ] addContext : Problem

    kryptontri

      Hello,

      Jboss Ver 3.04
      Jetty Ver 4.2 (?)

      Scenario:
      I deploy my application as an ear ( which contains a war etc and an images folder.
      I want users to upload photos and then serve them, yet i wish to keep that packaged ear separate.

      I add the following to the
      \deploy\jbossweb.sar\META-INF\jboss-service.xml


      /
      G:/projects/live/jboss/jboss-3.0.4/server/myserver/deploy/myapp/docroot
      TRUE


      This should allow me to access anything under the docroot folder AND the doc root under inside the war (?).

      No luck :-( ( see below )

      21:26:30,799 INFO [JettyService] Creating
      21:26:31,080 INFO [jbossweb] Registered jboss.web:Jetty=0,SocketListener=0
      21:26:31,160 INFO [jbossweb] Registered jboss.web:Jetty=0,AJP13Listener=0
      21:26:31,500 INFO [jbossweb] Registered jboss.web:Jetty=0,ServletHttpContext=0,context=/
      21:26:31,520 INFO [jbossweb] Checking Resource aliases
      21:26:31,530 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:357)
      at org.jboss.jetty.Jetty.setConfigurationElement(Jetty.java:330)
      at org.jboss.jetty.JettyService.createService(JettyService.java:165)
      at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:136)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      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:978)
      at $Proxy5.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:315)
      at org.jboss.system.ServiceController.create(ServiceController.java:243)
      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

      Ok so i comment out the tag regarding ServingResources and .. jetty starts up fine ... BUT .. i still cannot access resources/files under docroot/*

      I have done some research and have not found much w.r.t this issue.

      Can anybody help me with this or recommend an alternative approach ?

      I have a few options:

      1) Try again with Jetty/Jboss
      2) Write a File/Image Servlet to serve content from this dir

      Any Ideas People ?

      Thanks K.

        • 1. Re: [ Jetty ] addContext : Problem
          kryptontri

          Hi People,

          Any ideas with this issue ? I am still stuck and have to make a decision in the next few days ?

          Thanks Again,
          K

          • 2. Re: [ Jetty ] addContext : Problem


            If your intention is to write uploaded files into the deploy directory - then you are doing it wrong. Anything in the deploy dir should be considered temporary - not a place to keep important data.

            You should pass a working directory as a param to your webapp and upload and serve files from there.

            If you want to map this working directory to a Jetty context, in jboss-service.xml, to save explicitly serving the files yourself then ask on jetty-discuss@yahoogroups about the setServingResources() method on Context, which was dropped a while ago. I am sure Greg will point you in the right direction.

            Let me know the answer and I will update my Jetty/Jboss FAQ,


            Jules

            • 3. Re: [ Jetty ] addContext : Problem