Apache Tomcat上卡特琳娜为CORS过滤Maven的依赖 [英] apache tomcat catalina as maven dependency for CORS filter

查看:2642
本文介绍了Apache Tomcat上卡特琳娜为CORS过滤Maven的依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的web应用程序使用org.apache.catalina.filters.CorsFilter。所以我指定的Maven的依赖

I'm using org.apache.catalina.filters.CorsFilter in my webapp. So I specify the maven dependency

<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat-catalina</artifactId>
    <version>7.0.50</version>
</dependency>

现在,如果我说的范围是因提供或运行服务器无法启动,

Now, If I say the scope is "provide" or "runtime" the server doesn't start, because of

java.lang.ClassNotFoundException: org.apache.catalina.filters.CorsFilter

本类不在从jbossews卡特琳娜JAR / lib目录是7.0.40可用

This class is not available in the catalina jar from jbossews/lib which is 7.0.40

时很容易对openshift升级的tomcat?或者,如果任何人都可以提出一个解决方案,它是非常AP preciated。

Is it easy to "upgrade" tomcat on openshift? or if anybody can suggest a solution, it is much appreciated.

非常感谢,

推荐答案

这为我工作:

        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-catalina</artifactId>
            <version>7.0.42</version>
            <scope>provided</scope>
        </dependency>

7.0.50尝试也工作。你能仔细检查,有躺在身边没有竞争的jar文件的版本?或许有没有实际习惯由JVM类的旧版本。在Linux下,ls -l命令的/ proc / $ CATALINA_PID / FD,可能会显示正在使用的jar文件。

Trying 7.0.50 also worked. Can you double-check that there are no competing jar file versions lying around? Perhaps there is an older version without the class actually getting used by the JVM. Under Linux, "ls -l /proc/$CATALINA_PID/fd", may show which jar file is being used.

另外,还要确保在Tomcat服务器的最新版本,足以运行此。

Also make sure to run this in a recent enough version of the Tomcat server.

这篇关于Apache Tomcat上卡特琳娜为CORS过滤Maven的依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆