Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter mapping specifies an unknown filter name CorsFilter

Status
Not open for further replies.

imperialx

IS-IT--Management
Jul 21, 2009
2
US
Hi,

I'm a newbie in java world and installed Tomcat9 on a windows environment. What I'm trying to accomplish for the past days is to use the built-in Tomcat CorsFilter.

But I just notice the error logs with this message;

Java:
Caused by: java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name CorsFilter
	at org.apache.catalina.core.StandardContext.validateFilterMap(StandardContext.java:2975)
	at org.apache.catalina.core.StandardContext.addFilterMap(StandardContext.java:2940)
	at org.apache.catalina.startup.ContextConfig.configureContext(ContextConfig.java:1275)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1189)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:779)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:306)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5202)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)

On my web.xml I set the CorsFilter,

XML:
<filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>CorsFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

But if I remove the <filter> and <filter-mapping> tag for CorsFilter then localhost:8080/my-app/test works fine.

Am I missing a java package? Where to get the CorsFilter and how to deploy it?

Any help is much appreciated. Thanks!
 
That package should be bundled with Tomcat if the version is higher than 7.0.41 (in the tomcat-catalina.jar I guess). I'd try a Tomcat fresh installation.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top