0

I am using Birt viewer runtime in my web application along with Mechanize and have used log4j for logging in my application. It all was working fine, but then I used java mailing api in my application and I keep receiving this exception: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.

I initially was using mail.jar which was fine, for another requirement in my project, I started using mail.1.3.3.jar and it started throwing this exception. I think there is some jar conflict among Mechanize and latest java mail jars.

I need to use either mail.1.3.3.jar or java-mail-1.4.jar.

Please advice how shall I overcome this ??

Thanks.

4

1 回答 1

0

我能够摆脱它。

实际上,Mechanize(版本 0.11.1)的 jar 包含 pom.xml,我参考并了解了它在 HttpClient jar 上的用法。我在我的 Web 应用程序中使用了 4.2.1 版的 HTTPClient jar,它现在可以工作了。

这里要注意的一点是:pom.xml 有一个依赖:

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.0.1</version>
    <dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpmime</artifactId>
        <version>4.0.1</version>
    <dependency>
</dependencies>

<profiles>
    <profile>
    <id>latestHttpClient</id>
    <dependencies>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.2.1</version>
        </dependency>
    </dependencies>
    <profile>
<profiles>

现在这似乎是一个瓶颈,因为在一个环境中,旧版本的 jar 正在工作,而在其他环境中,新的。:(

于 2014-01-14T10:01:32.707 回答