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) <a...@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-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


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

Reply via email to