Jetty
  1. Jetty
  2. JETTY-1256

The new interface ServletContainerInitializer in servlet 3.0 cannot work well on Jetty

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 8.0.0.M1
    • Fix Version/s: 8.0.0.M2
    • Component/s: None
    • Labels:
      None
    • Environment:
      OS: Windows XP SP3
      JDK: Sun JDK 1.6.0_18
    • Number of attachments :
      3

      Description

      ServletContainerInitializer cannot work in jetty 8.0M1.

      In my test case, I use ServletContainerInitializer to find an load all the Servlet class and register one servlet:AddedServletOnStartup with its url-pattern: /add. But the container doesn't recognize it.

        Activity

        Hide
        Jan Bartel added a comment -

        #

        comment
        Hi Wang, For the normal jetty eclipse release, you need to enable the jetty-plus features to get this to work. However, I've just checked the etc/jetty-plus.xml file and its a bit out of date for that release. I'll fix it in trunk, but you need to edit your etc/jetty.xml file and add the following: <Call name="setAttribute"> <Arg>org.eclipse.jetty.webapp.configuration</Arg> <Arg> <Array type="java.lang.String"> <Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item> <Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item> <Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item> <Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item> <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item> <Item>org.eclipse.jetty.plus.webapp.Configuration</Item> <Item>org.eclipse.jetty.annotations.AnnotationConfiguration</Item> <Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item> <Item>org.eclipse.jetty.annotations.ContainerInitializerConfiguration</Item> </Array> </Arg> </Call>

        Then also ensure you have the plus and annotations OPTION enabled on the start line. Alternatively, download jetty-hightide where this is enabled by default.
        cheers Jan

        Show
        Jan Bartel added a comment - # comment Hi Wang, For the normal jetty eclipse release, you need to enable the jetty-plus features to get this to work. However, I've just checked the etc/jetty-plus.xml file and its a bit out of date for that release. I'll fix it in trunk, but you need to edit your etc/jetty.xml file and add the following: <Call name="setAttribute"> <Arg>org.eclipse.jetty.webapp.configuration</Arg> <Arg> <Array type="java.lang.String"> <Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item> <Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item> <Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item> <Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item> <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item> <Item>org.eclipse.jetty.plus.webapp.Configuration</Item> <Item>org.eclipse.jetty.annotations.AnnotationConfiguration</Item> <Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item> <Item>org.eclipse.jetty.annotations.ContainerInitializerConfiguration</Item> </Array> </Arg> </Call> Then also ensure you have the plus and annotations OPTION enabled on the start line. Alternatively, download jetty-hightide where this is enabled by default. cheers Jan
        Hide
        Jan Bartel added a comment -

        Greg, can you add the jetty-plus dependencies into the jetty-distribution build?

        Show
        Jan Bartel added a comment - Greg, can you add the jetty-plus dependencies into the jetty-distribution build?
        Hide
        Greg Wilkins added a comment -

        I've committed the update to get the annotation jars from Orbit
        r2209

        Show
        Greg Wilkins added a comment - I've committed the update to get the annotation jars from Orbit r2209
        Hide
        Jan Bartel added a comment -

        Also added jta jar from orbit to eclipse build for jetty 7. r2293.

        Show
        Jan Bartel added a comment - Also added jta jar from orbit to eclipse build for jetty 7. r2293.
        Hide
        Jan Bartel added a comment -

        Added the jta jars from jetty-7 distro to jetty-8.

        Show
        Jan Bartel added a comment - Added the jta jars from jetty-7 distro to jetty-8.
        Hide
        Neil Griffin added a comment -

        I found that I needed to enable the "annotations" feature in Jetty 8 in order to get the ServletContextInitializer feature to work. For more info, see Deploying JSF Portlets on Jetty and FACES-1668.

        Show
        Neil Griffin added a comment - I found that I needed to enable the "annotations" feature in Jetty 8 in order to get the ServletContextInitializer feature to work. For more info, see Deploying JSF Portlets on Jetty and FACES-1668 .

          People

          • Assignee:
            Jan Bartel
            Reporter:
            Wang Guang Zhe
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: