Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330419 - reloading webapp duplicates StandardDescriptorProcessor
Summary: reloading webapp duplicates StandardDescriptorProcessor
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 7.2.x   Edit
Assignee: Jan Bartel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-16 21:03 EST by AngerClown CLA
Modified: 2010-11-16 22:30 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description AngerClown CLA 2010-11-16 21:03:05 EST
Build Identifier: 7.2.0.v20101020

Looking at JMX output in JConsole, I noticed that the web app context seems to be duplicating servlet mappings after a restart.

Running dump() just after the server has started shows this partial output:
...
 +-SessionHandler@3e4a9a7d started
    +-ConstraintSecurityHandler@6b754699 started
       +-[]
       +-/={TRACE={RoleInfo,F,C[]}}
       +-ServletHandler@13a78071 started
          +-[/]=>default{...}
          +-[*.jsp, *.jspf, *.jspx, *.xsp, *.JSP, *.JSPF, *.JSPX, .XSP]=>jsp{...}
...

After a restart, dump() returns:
+-SessionHandler@3e4a9a7d started
    +-ConstraintSecurityHandler@6b754699 started
       +-[]
       +-/={TRACE={RoleInfo,F,C[]}}
       +-ServletHandler@13a78071 started
          +-[/]=>default{...}
          +-[*.jsp, *.jspf, *.jspx, *.xsp, *.JSP, *.JSPF, *.JSPX, *.XSP]=>jsp{...}
          +-[/]=>default{...}
          +-[*.jsp, *.jspf, *.jspx, *.xsp, *.JSP, *.JSPF, *.JSPX, *.XSP]=>jsp{...}

Notice the servlet mappings are duplicated. If the webapp is reloaded again, there are 3 mappings for each servlet.

Further investigation shows that the following line in WebXmlConfiguration.configure() is to blame:
        context.getMetaData().addDescriptorProcessor(new StandardDescriptorProcessor());

Each time the app is configured (reloaded), it will add a new StandardDescriptorProcessor(). This processor is not removed in deconfigure(), so the web.xml files are processed multiple times.

Logic in other classes makes sure that the actual servlets are not loaded multiple times which is probably why this bug is not immediately apparent.

Reproducible: Always

Steps to Reproduce:
1. Create a webapp with at least 1 servlet mapping
2. Call webapp.dump()
3. Reload the webapp without stopping the server
4. Rerun webapp.dump()
Comment 1 Jan Bartel CLA 2010-11-16 22:30:46 EST
Fixed in trunk rev 2529.