Apache axis logging - ClassCastException while using it inside a Jira plugin

僤鯓⒐⒋嵵緔 提交于 2019-12-07 19:23:26

Including axis-1.3-atlassian-1 only results

java.lang.ClassNotFoundException: org.apache.axis.transport.http.AdminServlet

Due to my application needs AdminServlet which is included in appache axis library. Finally when I included both it works fine with me.

    <dependency>
        <groupId>org.apache.axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.3-atlassian-1</version>
        <scope>provided</scope>
    </dependency>

Discoveries: Atlassian forked the axis library and Jira now uses axis-1.3-atlassian-1 and not the latest axis-1.4 from Apache; axis-1.3-atlassian-1 uses the 1.0.4 version of commons-logging, not 1.1.1 like axis-1.4.

Changing the dependency of the plugin from axis-1.4 to axis-1.3-atlassian-1 solved the problem. It is my suspicion that SLF4JLogFactory could cast to org.apache.commons.logging.LogFactory in 1.0.4 but not 1.1.1, but I haven't tested it.

If in Jira, be sure to give the scope of the dependency as "provided" or you'll run in to problems due to stuff being loaded twice. Here's a pom snippet:

    <dependency>
        <groupId>axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.3-atlassian-1</version>
        <scope>provided</scope>
    </dependency>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!