You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Scott Shipp <sc...@outlook.com> on 2018/03/29 14:36:03 UTC

On Tomcat 8.5.16, RemoteHostFilter throwing ServletException the property [allow] is not defined

Hi everyone,


I'm having a problem I haven't been able to address after reading the manual, googling and searching Stack Overflow, and asking around to other Tomcat users I know.


I'm using Tomcat 8.5.16, and trying to set up a RemoteHostFilter. When I start the application with the RemoteHostFilter, it fails to startup with the following stack trace:


Exception starting filter [Remote Host Filter] javax.servlet.ServletException: The property [allow] is not defined for filters of type [org.apache.catalina.filters.RemoteHostFilter]
    at org.apache.catalina.filters.FilterBase.init(FilterBase.java:52)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4590)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

I see the allow property mentioned in both the user guide documentation (here: https://tomcat.apache.org/tomcat-8.5-doc/config/filter.html#Remote_Host_Filter) and the javadoc (here: https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html).
RemoteHostFilter (Apache Tomcat 8.5.29 API Documentation)<https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html>
tomcat.apache.org
Extract the desired request property, and pass it (along with the specified request and response objects and associated filter chain) to the protected process ...




To troubleshoot, I set up a RemoteAddrFilter in my application's WEB-INF/web.xml using identical XML except for the value of the filter (obviously) and it works just fine.


Does anyone know what the "property [allow] is not defined" message means? I would intuit that it means there is no "allow" property at all in the RemoteHostFilter code, but I suppose it may also mean that the init-param xml tag is not the right one to use or that the value is unintelligible to Tomcat somehow.


Also, here's the relevant snippet from the web.xml, that I am trying to use:


<filter>
        <filter-name>Remote Host Filter</filter-name>
        <filter-class>org.apache.catalina.filters.RemoteHostFilter</filter-class>
        <init-param>
            <param-name>allow</param-name>
            <param-value>*\.example\.com</param-value>
        </init-param>
        <init-param>
            <param-name>denyStatus</param-name>
            <param-value>404</param-value>
        </init-param>
    </filter>

    <filter-mapping>
      <filter-name>Remote Host Filter</filter-name>
      <url-pattern>/url/path</url-pattern>
    </filter-mapping>

Scott


Re: On Tomcat 8.5.16, RemoteHostFilter throwing ServletException the property [allow] is not defined

Posted by Mark Thomas <ma...@apache.org>.
On 29/03/18 21:53, André Warnier (tomcat) wrote:
> Hi.
> Sorry for top-posting, but maybe a real dev would want to have a look at
> this.

Best to create a Bugzilla issue so it doesn't get lost.

> If you scroll below to the original post, it seems that putting an
> invalid value (a bad regex) in the param-value of the "allow" param,
> triggers an error message that is at least confusing :
> 
>>> Exception starting filter [Remote Host Filter]
> javax.servlet.ServletException: The property [allow] is not defined for
> filters of type [org.apache.catalina.filters.RemoteHostFilter]
>>>       at org.apache.catalina.filters.FilterBase.init(FilterBase.java:52)
> ...
> 
> That was for :
>>>           <init-param>
>>>               <param-name>allow</param-name>
>>>               <param-value>*\.example\.com</param-value>
>>>           </init-param>
> 
> The OP cited Tomcat 8.5.16.

Guessing as I am short on time...

There was an attempt to convert the value to a Pattern. That failed and
threw an exception. The IntrospectionUtils code caught it and assumed
the exception was due to the parameter not existing.

The fix is probably to catch the exception in the setter and log a
useful error message there.

Should be a fix suitable for a beginner.

Mark


> 
> On 29.03.2018 21:50, Scott Shipp wrote:
>> Gah! Well at least it was easy. Thanks Andre that was exactly right
>> and can't believe I overlooked that. Thanks again,
>>
>> Scott
>>
>>
>> ________________________________
>> From: André Warnier (tomcat) <aw...@ice-sa.com>
>> Sent: Thursday, March 29, 2018 8:45 AM
>> To: users@tomcat.apache.org
>> Subject: Re: On Tomcat 8.5.16, RemoteHostFilter throwing
>> ServletException the property [allow] is not defined
>>
>> On 29.03.2018 16:36, Scott Shipp wrote:
>>> Hi everyone,
>>>
>>>
>>> I'm having a problem I haven't been able to address after reading the
>>> manual, googling and searching Stack Overflow, and asking around to
>>> other Tomcat users I know.
>>>
>>>
>>> I'm using Tomcat 8.5.16, and trying to set up a RemoteHostFilter.
>>> When I start the application with the RemoteHostFilter, it fails to
>>> startup with the following stack trace:
>>>
>>>
>>> Exception starting filter [Remote Host Filter]
>>> javax.servlet.ServletException: The property [allow] is not defined
>>> for filters of type [org.apache.catalina.filters.RemoteHostFilter]
>>>       at org.apache.catalina.filters.FilterBase.init(FilterBase.java:52)
>>>       at
>>> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
>>>
>>>       at
>>> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
>>>
>>>       at
>>> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
>>>
>>>       at
>>> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4590)
>>>
>>>       at
>>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233)
>>>
>>>       at
>>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>>>       at
>>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
>>>
>>>       at
>>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
>>>       at
>>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
>>>       at
>>> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
>>>       at
>>> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
>>>
>>>       at
>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>>>       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>>       at
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>>>
>>>       at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>>>
>>>       at java.lang.Thread.run(Thread.java:748)
>>>
>>> I see the allow property mentioned in both the user guide
>>> documentation (here:
>>> https://tomcat.apache.org/tomcat-8.5-doc/config/filter.html#Remote_Host_Filter)
>>> and the javadoc (here:
>>> https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html).
>>>
>> Apache Tomcat 8 Configuration Reference (8.5.28
>> ...<https://tomcat.apache.org/tomcat-8.5-doc/config/filter.html#Remote_Host_Filter>
>>
>> tomcat.apache.org
>> The HTTP specification is clear that if no character set is specified
>> for media sub-types of the "text" media type, the ISO-8859-1 character
>> set must be used.
>>
>>
>>> RemoteHostFilter (Apache Tomcat 8.5.29 API
>>> Documentation)<https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html>
>>>
>>> tomcat.apache.org
>>> Extract the desired request property, and pass it (along with the
>>> specified request and response objects and associated filter chain)
>>> to the protected process ...
>>>
>>>
>>>
>>>
>>> To troubleshoot, I set up a RemoteAddrFilter in my application's
>>> WEB-INF/web.xml using identical XML except for the value of the
>>> filter (obviously) and it works just fine.
>>>
>>>
>>> Does anyone know what the "property [allow] is not defined" message
>>> means? I would intuit that it means there is no "allow" property at
>>> all in the RemoteHostFilter code, but I suppose it may also mean that
>>> the init-param xml tag is not the right one to use or that the value
>>> is unintelligible to Tomcat somehow.
>>>
>>>
>>> Also, here's the relevant snippet from the web.xml, that I am trying
>>> to use:
>>>
>>>
>>> <filter>
>>>           <filter-name>Remote Host Filter</filter-name>
>>>          
>>> <filter-class>org.apache.catalina.filters.RemoteHostFilter</filter-class>
>>>
>>>           <init-param>
>>>               <param-name>allow</param-name>
>>>               <param-value>*\.example\.com</param-value>
>>>           </init-param>
>>>           <init-param>
>>>               <param-name>denyStatus</param-name>
>>>               <param-value>404</param-value>
>>>           </init-param>
>>>       </filter>
>>>
>>>       <filter-mapping>
>>>         <filter-name>Remote Host Filter</filter-name>
>>>         <url-pattern>/url/path</url-pattern>
>>>       </filter-mapping>
>>>
>>
>> Hi.
>> I am not familiar with that filter, but I just looked at the doc you
>> are pointing to, and
>> I believe that the *<param-value>* that you indicate above is
>> invalid.  It should be a
>> regex, and the leading "*" there is wrong then.
>> Maybe it is just the error message that is wrong, and it is really
>> complaining about the
>> value ?
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


[OT] Re: On Tomcat 8.5.16, RemoteHostFilter throwing ServletException the property [allow] is not defined

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 29.03.2018 23:36, charlie arehart wrote:
> (And as I said in another thread, I don't propose these changes as if to say to someone, "now go do it". I'm saying it as someone who would try to step in and help, if permitted.)

I think that you can do that.
Have a look here :
http://tomcat.apache.org/getinvolved.html
You have already done the first step.
You can do the second step, whenever you want : if you see a question to which you can 
contribute a useful response, please do.
The next step would be the FAQ or Wiki. That's also fairly easy : go to 
https://wiki.apache.org/tomcat/FrontPage
and see the "If you do decide to contribute," paragraph.
(You could for example start by providing some additional examples, as a FAQ article. And 
I am sure that with a simple request on this list, a link to that FAQ could then be easily 
added to the main docs).
If you want to contribute directly by improving the docs, that gets a bit more involved, 
because it requires downloading the code, submitting patches etc. But it can be done (I 
did it once, at a time when I wasn't even sure what "diff" meant).
That will lead you here : http://www.apache.org/dev/contributors.html
(Note: the process for the documentation is exactly the same as for the code; and as a 
contribution, it will be appreciated in the same way - or even more, considering the 
inherent aversion of programmers toward documentation..)
And the ultimate reward (after a few years of hard and consciencious work) would be here :
http://tomcat.apache.org/whoweare.html


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: On Tomcat 8.5.16, RemoteHostFilter throwing ServletException the property [allow] is not defined

Posted by charlie arehart <ch...@carehart.org>.
> -----Original Message-----
> From: André Warnier (tomcat) <aw...@ice-sa.com> 
>
> Hi.
> Sorry for top-posting, but maybe a real dev would want to have a look at this.
> If you scroll below to the original post, it seems that putting an invalid value (a bad
> regex) in the param-value of the "allow" param, triggers an error message that is at least confusing :
> 
> >> Exception starting filter [Remote Host Filter] javax.servlet.ServletException: The property [allow] is not defined for filters of type [org.apache.catalina.filters.RemoteHostFilter]
>  >>       at org.apache.catalina.filters.FilterBase.init(FilterBase.java:52)
> ...
> 
> That was for :
> >>           <init-param>
> >>               <param-name>allow</param-name>
> >>               <param-value>*\.example\.com</param-value>
> >>           </init-param>
>
> The OP cited Tomcat 8.5.16.

FWIW, I'll throw out as well that the particular section of the doc page about that filter doesn't have an example (showing some sample XML for use with the filter), while many others (7  of the 14 filters listed) do. 

Of course, if one did read about the others they could see examples and perhaps connect dots. I just wonder if, had an example been there, the OP might have more readily seen his mistake. (And as I said in another thread, I don't propose these changes as if to say to someone, "now go do it". I'm saying it as someone who would try to step in and help, if permitted.)

/charlie


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: On Tomcat 8.5.16, RemoteHostFilter throwing ServletException the property [allow] is not defined

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
Hi.
Sorry for top-posting, but maybe a real dev would want to have a look at this.
If you scroll below to the original post, it seems that putting an invalid value (a bad 
regex) in the param-value of the "allow" param, triggers an error message that is at least 
confusing :

 >> Exception starting filter [Remote Host Filter] javax.servlet.ServletException: The 
property [allow] is not defined for filters of type 
[org.apache.catalina.filters.RemoteHostFilter]
 >>       at org.apache.catalina.filters.FilterBase.init(FilterBase.java:52)
...

That was for :
 >>           <init-param>
 >>               <param-name>allow</param-name>
 >>               <param-value>*\.example\.com</param-value>
 >>           </init-param>

The OP cited Tomcat 8.5.16.

On 29.03.2018 21:50, Scott Shipp wrote:
> Gah! Well at least it was easy. Thanks Andre that was exactly right and can't believe I overlooked that. Thanks again,
>
> Scott
>
>
> ________________________________
> From: André Warnier (tomcat) <aw...@ice-sa.com>
> Sent: Thursday, March 29, 2018 8:45 AM
> To: users@tomcat.apache.org
> Subject: Re: On Tomcat 8.5.16, RemoteHostFilter throwing ServletException the property [allow] is not defined
>
> On 29.03.2018 16:36, Scott Shipp wrote:
>> Hi everyone,
>>
>>
>> I'm having a problem I haven't been able to address after reading the manual, googling and searching Stack Overflow, and asking around to other Tomcat users I know.
>>
>>
>> I'm using Tomcat 8.5.16, and trying to set up a RemoteHostFilter. When I start the application with the RemoteHostFilter, it fails to startup with the following stack trace:
>>
>>
>> Exception starting filter [Remote Host Filter] javax.servlet.ServletException: The property [allow] is not defined for filters of type [org.apache.catalina.filters.RemoteHostFilter]
>>       at org.apache.catalina.filters.FilterBase.init(FilterBase.java:52)
>>       at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
>>       at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
>>       at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
>>       at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4590)
>>       at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233)
>>       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>>       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
>>       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
>>       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
>>       at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
>>       at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
>>       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>>       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>>       at java.lang.Thread.run(Thread.java:748)
>>
>> I see the allow property mentioned in both the user guide documentation (here: https://tomcat.apache.org/tomcat-8.5-doc/config/filter.html#Remote_Host_Filter) and the javadoc (here: https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html).
> Apache Tomcat 8 Configuration Reference (8.5.28 ...<https://tomcat.apache.org/tomcat-8.5-doc/config/filter.html#Remote_Host_Filter>
> tomcat.apache.org
> The HTTP specification is clear that if no character set is specified for media sub-types of the "text" media type, the ISO-8859-1 character set must be used.
>
>
>> RemoteHostFilter (Apache Tomcat 8.5.29 API Documentation)<https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html>
>> tomcat.apache.org
>> Extract the desired request property, and pass it (along with the specified request and response objects and associated filter chain) to the protected process ...
>>
>>
>>
>>
>> To troubleshoot, I set up a RemoteAddrFilter in my application's WEB-INF/web.xml using identical XML except for the value of the filter (obviously) and it works just fine.
>>
>>
>> Does anyone know what the "property [allow] is not defined" message means? I would intuit that it means there is no "allow" property at all in the RemoteHostFilter code, but I suppose it may also mean that the init-param xml tag is not the right one to use or that the value is unintelligible to Tomcat somehow.
>>
>>
>> Also, here's the relevant snippet from the web.xml, that I am trying to use:
>>
>>
>> <filter>
>>           <filter-name>Remote Host Filter</filter-name>
>>           <filter-class>org.apache.catalina.filters.RemoteHostFilter</filter-class>
>>           <init-param>
>>               <param-name>allow</param-name>
>>               <param-value>*\.example\.com</param-value>
>>           </init-param>
>>           <init-param>
>>               <param-name>denyStatus</param-name>
>>               <param-value>404</param-value>
>>           </init-param>
>>       </filter>
>>
>>       <filter-mapping>
>>         <filter-name>Remote Host Filter</filter-name>
>>         <url-pattern>/url/path</url-pattern>
>>       </filter-mapping>
>>
>
> Hi.
> I am not familiar with that filter, but I just looked at the doc you are pointing to, and
> I believe that the *<param-value>* that you indicate above is invalid.  It should be a
> regex, and the leading "*" there is wrong then.
> Maybe it is just the error message that is wrong, and it is really complaining about the
> value ?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: On Tomcat 8.5.16, RemoteHostFilter throwing ServletException the property [allow] is not defined

Posted by Scott Shipp <sc...@outlook.com>.
Gah! Well at least it was easy. Thanks Andre that was exactly right and can't believe I overlooked that. Thanks again,

Scott


________________________________
From: André Warnier (tomcat) <aw...@ice-sa.com>
Sent: Thursday, March 29, 2018 8:45 AM
To: users@tomcat.apache.org
Subject: Re: On Tomcat 8.5.16, RemoteHostFilter throwing ServletException the property [allow] is not defined

On 29.03.2018 16:36, Scott Shipp wrote:
> Hi everyone,
>
>
> I'm having a problem I haven't been able to address after reading the manual, googling and searching Stack Overflow, and asking around to other Tomcat users I know.
>
>
> I'm using Tomcat 8.5.16, and trying to set up a RemoteHostFilter. When I start the application with the RemoteHostFilter, it fails to startup with the following stack trace:
>
>
> Exception starting filter [Remote Host Filter] javax.servlet.ServletException: The property [allow] is not defined for filters of type [org.apache.catalina.filters.RemoteHostFilter]
>      at org.apache.catalina.filters.FilterBase.init(FilterBase.java:52)
>      at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
>      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
>      at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
>      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4590)
>      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233)
>      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
>      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
>      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
>      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
>      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
>      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>      at java.lang.Thread.run(Thread.java:748)
>
> I see the allow property mentioned in both the user guide documentation (here: https://tomcat.apache.org/tomcat-8.5-doc/config/filter.html#Remote_Host_Filter) and the javadoc (here: https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html).
Apache Tomcat 8 Configuration Reference (8.5.28 ...<https://tomcat.apache.org/tomcat-8.5-doc/config/filter.html#Remote_Host_Filter>
tomcat.apache.org
The HTTP specification is clear that if no character set is specified for media sub-types of the "text" media type, the ISO-8859-1 character set must be used.


> RemoteHostFilter (Apache Tomcat 8.5.29 API Documentation)<https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html>
> tomcat.apache.org
> Extract the desired request property, and pass it (along with the specified request and response objects and associated filter chain) to the protected process ...
>
>
>
>
> To troubleshoot, I set up a RemoteAddrFilter in my application's WEB-INF/web.xml using identical XML except for the value of the filter (obviously) and it works just fine.
>
>
> Does anyone know what the "property [allow] is not defined" message means? I would intuit that it means there is no "allow" property at all in the RemoteHostFilter code, but I suppose it may also mean that the init-param xml tag is not the right one to use or that the value is unintelligible to Tomcat somehow.
>
>
> Also, here's the relevant snippet from the web.xml, that I am trying to use:
>
>
> <filter>
>          <filter-name>Remote Host Filter</filter-name>
>          <filter-class>org.apache.catalina.filters.RemoteHostFilter</filter-class>
>          <init-param>
>              <param-name>allow</param-name>
>              <param-value>*\.example\.com</param-value>
>          </init-param>
>          <init-param>
>              <param-name>denyStatus</param-name>
>              <param-value>404</param-value>
>          </init-param>
>      </filter>
>
>      <filter-mapping>
>        <filter-name>Remote Host Filter</filter-name>
>        <url-pattern>/url/path</url-pattern>
>      </filter-mapping>
>

Hi.
I am not familiar with that filter, but I just looked at the doc you are pointing to, and
I believe that the *<param-value>* that you indicate above is invalid.  It should be a
regex, and the leading "*" there is wrong then.
Maybe it is just the error message that is wrong, and it is really complaining about the
value ?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: On Tomcat 8.5.16, RemoteHostFilter throwing ServletException the property [allow] is not defined

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 29.03.2018 16:36, Scott Shipp wrote:
> Hi everyone,
>
>
> I'm having a problem I haven't been able to address after reading the manual, googling and searching Stack Overflow, and asking around to other Tomcat users I know.
>
>
> I'm using Tomcat 8.5.16, and trying to set up a RemoteHostFilter. When I start the application with the RemoteHostFilter, it fails to startup with the following stack trace:
>
>
> Exception starting filter [Remote Host Filter] javax.servlet.ServletException: The property [allow] is not defined for filters of type [org.apache.catalina.filters.RemoteHostFilter]
>      at org.apache.catalina.filters.FilterBase.init(FilterBase.java:52)
>      at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
>      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
>      at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
>      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4590)
>      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233)
>      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
>      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
>      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
>      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
>      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
>      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>      at java.lang.Thread.run(Thread.java:748)
>
> I see the allow property mentioned in both the user guide documentation (here: https://tomcat.apache.org/tomcat-8.5-doc/config/filter.html#Remote_Host_Filter) and the javadoc (here: https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html).
> RemoteHostFilter (Apache Tomcat 8.5.29 API Documentation)<https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html>
> tomcat.apache.org
> Extract the desired request property, and pass it (along with the specified request and response objects and associated filter chain) to the protected process ...
>
>
>
>
> To troubleshoot, I set up a RemoteAddrFilter in my application's WEB-INF/web.xml using identical XML except for the value of the filter (obviously) and it works just fine.
>
>
> Does anyone know what the "property [allow] is not defined" message means? I would intuit that it means there is no "allow" property at all in the RemoteHostFilter code, but I suppose it may also mean that the init-param xml tag is not the right one to use or that the value is unintelligible to Tomcat somehow.
>
>
> Also, here's the relevant snippet from the web.xml, that I am trying to use:
>
>
> <filter>
>          <filter-name>Remote Host Filter</filter-name>
>          <filter-class>org.apache.catalina.filters.RemoteHostFilter</filter-class>
>          <init-param>
>              <param-name>allow</param-name>
>              <param-value>*\.example\.com</param-value>
>          </init-param>
>          <init-param>
>              <param-name>denyStatus</param-name>
>              <param-value>404</param-value>
>          </init-param>
>      </filter>
>
>      <filter-mapping>
>        <filter-name>Remote Host Filter</filter-name>
>        <url-pattern>/url/path</url-pattern>
>      </filter-mapping>
>

Hi.
I am not familiar with that filter, but I just looked at the doc you are pointing to, and 
I believe that the *<param-value>* that you indicate above is invalid.  It should be a 
regex, and the leading "*" there is wrong then.
Maybe it is just the error message that is wrong, and it is really complaining about the 
value ?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org