Hi Martynas, you are getting NPE because "request.getRemoteHost()" is
returning null value after you enableLookups! Maybe you have problem
resolving hostname in your env? Try to disable the valve and test "<%=
request.getRemoteHost() %>" in a simple jsp until you can get the right
value before re-enable the valve again.

--Zemian

On Mon, Aug 7, 2017 at 11:46 AM, Martynas Jusevičius <marty...@atomgraph.com
> wrote:

> Hi,
>
> I'm deploying WAR from Jenkins Docker container to Tomcat Docker container.
>
> In server.xml I have enableLookups to enable DNS lookups
>
>     <Connector port="8080" protocol="HTTP/1.1"
>                connectionTimeout="20000"
>                redirectPort="8443"
>                enableLookups="true"/>
>
> and in conf/Catalina/localhost/manager.xml I have
>
> <Context privileged="true" antiResourceLocking="false"
>          docBase="${catalina.home}/webapps/manager">
>   <Valve className="org.apache.catalina.valves.RemoteHostValve"
>          allow="jenkins" />
> </Context>
>
> There is also manager-script role and user in tomcat-users.xml but I won't
> post it because authentication works.
>
> The issue is RemoteHostValve. If I comment the Valve out, deployment works.
> If I enable it as shown here, in the localhost log I can see
>
> 07-Aug-2017 17:00:22.854 SEVERE [http-apr-8080-exec-1]
> org.apache.catalina.core.StandardHostValve.invoke Exception Processing
> /manager/text/list
>  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:377)
> at
> org.apache.catalina.valves.RequestFilterValve.process(
> RequestFilterValve.java:312)
> at
> org.apache.catalina.valves.RemoteHostValve.invoke(RemoteHostValve.java:84)
> at
> org.apache.catalina.core.StandardHostValve.invoke(
> StandardHostValve.java:141)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(
> ErrorReportValve.java:79)
> at
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(
> AbstractAccessLogValve.java:620)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:88)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(
> CoyoteAdapter.java:502)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.process(
> AbstractHttp11Processor.java:1132)
> at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.
> process(AbstractProtocol.java:684)
> at
> org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.
> run(AprEndpoint.java:2458)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)
> at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
> TaskThread.java:61)
> at java.lang.Thread.run(Thread.java:748)
>
>
> Can anyone explain what the issue is and how to fix it?
>
> Thanks
>
> Martynas
>

Reply via email to