Deployment descriptor elements are in order. For version 2.3, order is
<!ELEMENT web-app (icon?, display-name?, description?,
distributable?, context-param*, filter*, filter-mapping*,
listener*, servlet*, servlet-mapping*, session-config?, mimemapping*,
welcome-file-list?, error-page*, taglib*, resourceenv-
ref*, resource-ref*, security-constraint*, login-config?,
security-role*, env-entry*, ejb-ref*, ejb-local-ref*)>
Are you validating your descriptor file against dtd file?
If you use any
IDE and mentioned your listener element after servlet element, you will see error message.