【问题标题】:different versions of a jar in the classpath类路径中不同版本的 jar
【发布时间】:2012-01-26 09:58:01
【问题描述】:

您好,这是following question 的后续问题。

我正在创建一个 Grails 插件作为复杂产品的包装器。该产品对 hibernate 等其他产品有很多依赖。问题是,grails 有一些相同的依赖项,但版本不同。例如。 Grails -> hibernate 3.6.7 其他产品 -> hibernate 3.5.6

我已按照解决方案中的描述修改了 BuildConfig.groovy:

dependencies {
    // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
    runtime ('org.ow2.bonita:bonita-server:5.6.1') {
        excludes "slf4j-jdk14"
    }
}

Grails 已解决所有依赖项并将所有需要的 jar 下载到本地存储库。 STS 可以从依赖项中解析所有类。在运行应用程序时,休眠存在问题:

Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.util.SoftLimitMRUCache.<init>(I)V

我认为错误是由于类路径中有多个休眠 jars 而出现的。如何解决?

提前感谢!

【问题讨论】:

    标签: grails classpath


    【解决方案1】:

    你检查过精美的手册吗?

    http://grails.org/doc/1.3.x/guide/3.%20Configuration.html#3.7.7%20Plugin%20JAR%20Dependencies

    您的项目中似乎需要旧版本的休眠。所以我想解决方案可能是

    • 创建插件项目
    • 移除休眠插件
    • 将 jar 文件放入项目中
    • 按照文档中的说明将休眠 jar 配置为 export=false(参见上面的链接)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-03
      • 2016-09-04
      • 2016-09-27
      • 1970-01-01
      • 2015-04-01
      • 2012-01-31
      • 1970-01-01
      • 2010-10-03
      相关资源
      最近更新 更多