Tomcat在自定义CORS过滤器上抛出奇怪的错误

时间:2014-10-22 01:08:01

标签: java tomcat websocket cors

我正在运行Tomcat 7.0.56并且正在使用WebSockets。我需要一些自定义的CORS参数,所以我使用了交易公司的CORSFilter。

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)

我确实在全局的Tomcat服务器上包含了所有正确的jar文件。有趣的是这曾经很好用;我重新部署了项目,我开始在日志中收到此错误。我不认识堆栈跟踪中的任何包名称,并且我没有改变类。

1 个答案:

答案 0 :(得分:0)

升级到CORS过滤器的2.2.1版(或更高版本)。它修复了一个使默认构造函数非公共的回归错误,这可能是导致此错误消息的原因。