简体   繁体   中英

Tomcat throwing weird error on custom CORS filter

I am running a Tomcat 7.0.56 and am using WebSockets. I needed some custom CORS parameters, so i used the CORSFilter from thetransactioncompany.

SEVERE: Exception starting filter CORS
java.lang.IllegalAccessException: Class org.apache.catalina.core.DefaultInstanceManager can not access a member of class com.thetransactioncompany.cors.CORSFilter with modifiers ""
    at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:109)
    at java.lang.Class.newInstance(Class.java:368)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:140)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

I did include all the correct jar files on the Tomcat server globally. The funny thing is this used to work very well; i re-deployed the project and i started getting this error in the logs. I do not recognize any package name in the stack trace, and i did not alter the classes.

Upgrade to version 2.2.1 (or later) of the CORS Filter. It fixes a regression bug that has made the default constructor non-public, which is the probably cause of this error message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM