You should be able to add an error-page tag to the server/xxx/deploy/jboss-web.deployer/conf/web.xml file. This is the master web.xml used for all web apps.
Yes, I understand you can do that if someone accesses your web application with the appropriate context root:
Then this will go to the 404 page defined in the myapp web.xml.
However, what happens if the user visits the following page that does not correspond to any current web app's context root?:
To handle that situation, also add the error page to the root context at server/default/jboss-web.deployers/ROOT.war.