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;
On my web.xml I set the CorsFilter,
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!
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!