Details
Description
This happens when having XWiki as the ROOT webapp.
The scenario is the following :
- Scheduler job calls mailsender.sendMailFromTemplate
- mail sender creates a new ExternalServletURLFactory, initialized with the calling context, which has a XWikiServletRequestStub as request
- URL factory initialization calls XWiki#getWebAppPath to get the context path
- #getWebAppPath calls contextPath = context.getRequest().getContextPath(); which generates a NPE
- ... NPE is caught and a wrong context path is computed from the context URL, base on context.getURL().getPath();
For example, <host>/bin/bin/Sandbox/Test, when the servlet path is the standard one.