【问题标题】:Context Initialization Failed - probably error in commons-collections上下文初始化失败 - 可能是公共集合中的错误
【发布时间】:2014-05-09 16:43:19
【问题描述】:

当我将我的 EAR 文件发布到 Websphere 时,我收到了四个不同 bean 的错误:

[5/9/14 8:54:44:485 CDT] 00000018 DefaultListab I org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@63706370: defining beans      [updateMPETask,processingNotifyerTask,calendarTask1,calendarTask2,calendarTask3,calendarTask4,calendarTask5,calendarTask6,calendarTask7,datasetNotifyerTask,updateMPEJobDetail,processingNotifyerJobDetail,calendarJob1Detail,calendarJob2Detail,calendarJob3Detail,calendarJob4Detail,calendarJob5Detail,calendarJob6Detail,calendarJob7Detail,datasetNotifyerJobDetail,updateMPENotifyerCronTrigger,processingNotifyerCronTrigger,calendar1CronTrigger,calendar2CronTrigger,calendar3CronTrigger,calendar4CronTrigger,calendar5CronTrigger,calendar6CronTrigger,calendar7CronTrigger,datasetNotifyerCronTrigger,quartzScheduleFactory]; root of factory hierarchy
[5/9/14 8:54:44:485 CDT] 00000018 ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'updateABCJobDetail' defined in ServletContext resource [/WEB-INF/classes/resources/dvl/ictt-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org/apache/commons/collections/SetUtils.orderedSet(Ljava/util/Set;)Ljava/util/Set;
Caused by: java.lang.NoSuchMethodError: org/apache/commons/collections/SetUtils.orderedSet(Ljava/util/Set;)Ljava/util/Set;
at org.quartz.JobDetail.<init>(JobDetail.java:85)

在寻找解决方案时,我发现很多论坛都说这可能是由于 commons-collections.jar 的重复或过时版本造成的。

所以我从 Classpath 中删除了文件 commons-collections.jar 并粘贴了从 http://mvnrepository.com/artifact/commons-collections/commons-collections/3.2.1 下载的 commons-collections-3.2.1.jar。任何线索都会被接受。

我的类路径有这些文件:

【问题讨论】:

标签: spring servlets websphere


【解决方案1】:

发生此错误是因为您的应用程序最终使用了 WebSphere 内部的 Commons Collections 类(WebSphere 将 Commons Collections 用于自己的目的),而不是捆绑在您的应用程序中的 Commons Collections。

根据 WebSphere 的文档,每当您的应用程序使用 WebSphere 也在内部使用的第三方库(Commons Collections 就是其中之一)时,您应该:

  1. 在您的模块中包含您的第三方库(例如WEB-INF/lib)
  2. 将应用程序的类加载模式设置为PARENT_LAST

这将导致您的应用程序使用捆绑的 Commons Collections 而不是 WebSphere 的。

【讨论】:

    猜你喜欢
    • 2016-06-09
    • 2015-04-26
    • 1970-01-01
    • 2015-12-15
    • 1970-01-01
    • 1970-01-01
    • 2018-09-29
    • 2015-11-12
    • 2015-06-06
    相关资源
    最近更新 更多