Uploaded image for project: 'JBoss Web Server'
  1. JBoss Web Server
  2. JWS-880

RemoteHostValve NullPointerException only once on first request

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • None
    • JWS 3.1.0 SP1 ER1
    • tomcat8
    • None
    • Hide

      1. Fresh install of JWS 3.1 Tomcat 8 (including tomcat-native, this only affects APR)
      2. Edit server.xml so default Connector has enableLookups="true"
      3. Add a RemoteHostValve. For example:

      <Valve className="org.apache.catalina.valves.RemoteHostValve" allow="localhost"/>
      

      4. Send a request:

      # curl -v http://127.0.0.1:8080/
      *   Trying 127.0.0.1...
      * TCP_NODELAY set
      * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
      > GET / HTTP/1.1
      > Host: 127.0.0.1:8080
      > User-Agent: curl/7.53.1
      > Accept: */*
      > 
      < HTTP/1.1 500 Internal Server Error
      < Server: Apache-Coyote/1.1
      < Transfer-Encoding: chunked
      < Date: Mon, 08 Jan 2018 17:56:53 GMT
      < Connection: close
      < 
      * Closing connection 0
       
      
      Show
      1. Fresh install of JWS 3.1 Tomcat 8 (including tomcat-native, this only affects APR) 2. Edit server.xml so default Connector has enableLookups="true" 3. Add a RemoteHostValve. For example: <Valve className= "org.apache.catalina.valves.RemoteHostValve" allow= "localhost" /> 4. Send a request: # curl -v http: //127.0.0.1:8080/ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) > GET / HTTP/1.1 > Host: 127.0.0.1:8080 > User-Agent: curl/7.53.1 > Accept: */* > < HTTP/1.1 500 Internal Server Error < Server: Apache-Coyote/1.1 < Transfer-Encoding: chunked < Date: Mon, 08 Jan 2018 17:56:53 GMT < Connection: close < * Closing connection 0

    Description

      When I have enableLookups enabled and a RemoteHostValve configured, I get a NullPointerException for the first request. Other requests don't seem to trigger the NPE.

      08-Jan-2018 12:46:48.274 SEVERE [http-apr-8080-exec-1] org.apache.coyote.http11.AbstractHttp11Processor.process Error processing request
       java.lang.NullPointerException
      	at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
      	at java.util.regex.Matcher.reset(Matcher.java:309)
      	at java.util.regex.Matcher.<init>(Matcher.java:229)
      	at java.util.regex.Pattern.matcher(Pattern.java:1093)
      	at org.apache.catalina.valves.RequestFilterValve.isAllowed(RequestFilterValve.java:369)
      	at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:311)
      	at org.apache.catalina.valves.RemoteHostValve.invoke(RemoteHostValve.java:95)
      	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
      	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100)
      	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687)
      	at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2445)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:748)
      

      Attachments

        Activity

          People

            rhn-support-csutherl Coty Sutherland
            rhn-support-rbost Robert Bost
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: