解決:Exception java.lang.SecurityException: class "javax.servlet.FilterRegistration"

來源:互聯網
上載者:User
異常說明

java.lang.SecurityException: class “javax.servlet.FilterRegistration“‘s signer information does not match signer information of other classes in the same package

解決誤區

在ideal中運行本地spark出現class “javax.servlet.FilterRegistration” 不匹配,在網上查了很多:
1. 有讓刪除javax.servlet開頭的庫的【未解決】

有讓參考http://stackoverflow.com/questions/28086520/spark-application-throws-javax-servlet-filterregistration 的【不知所云,未解決】

有讓【未解決】
正確解決方案

於是我們需要在pom.xml中,視情況把不同版本的servlet-api給“除掉”,這裡我選擇的是除掉hadoop-common中的舊版本servlet-api:

<dependency>    <groupId>org.apache.hadoop</groupId>    <artifactId>hadoop-common</artifactId>    <exclusions>        <exclusion>            <groupId>javax.servlet</groupId>            <artifactId>*</artifactId>        </exclusion>    </exclusions></dependency>

依次檢查完所有的間接依賴,一個個處理好,再重新編譯器,測試,直到程式可以正常跑起來。
這裡需要特別注意,如果程式運行前export的CLASSPATH中的某個路徑裡有舊的jar包,一定要清理乾淨再測試,否則可能你已經在pom.xml中解決了問題,但無論怎麼測都不行,仍然還是jar包衝突,結果發現是CLASSPATH中的某個路徑下的舊jar包沒清理乾淨導致的,那就浪費時間了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.