Using the following RewriteValve-configuration and do a HTTP-request without a Host-Header generates a NPE (Some old HTTP1.0-clients and bots don't provide a Host-Header).
--------------------------
RewriteCond %
www.domain.invalid
RewriteRule .* - [F]
--------------------------
I reproduced this in JBossWeb2.1.3, but the bug is not yet fixed in trunk.
Stacktrace:
2010-01-08 16:26:27,845 ERROR [org.apache.catalina.connector.CoyoteAdapter] (http-0.0.0.0-9080-1) An exception or error occurred in the container during the request processing
java.lang.NullPointerException
at org.jboss.web.rewrite.TomcatResolver.resolve(TomcatResolver.java:59)
at org.jboss.web.rewrite.Substitution$ServerVariableElement.evaluate(Substitution.java:63)
at org.jboss.web.rewrite.Substitution.evaluate(Substitution.java:235)
at org.jboss.web.rewrite.RewriteCond.evaluate(RewriteCond.java:198)
at org.jboss.web.rewrite.RewriteRule.evaluate(RewriteRule.java:112)
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:293)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:905)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:592)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2036)
at java.lang.Thread.run(Thread.java:619)