Java 自定义ContextLoaderListener类在Websphere中不工作

Java 自定义ContextLoaderListener类在Websphere中不工作,java,spring,spring-mvc,websphere,web.xml,Java,Spring,Spring Mvc,Websphere,Web.xml,自定义ContextLoaderListener类在Websphere中不起作用,并引发以下错误。这在Tomcat、JBoss和Weblogic中也可以很好地工作 java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? 我的自定义上下文加载器类如下所示: public class CustomContextListener extends Cont

自定义ContextLoaderListener类在Websphere中不起作用,并引发以下错误。这在Tomcat、JBoss和Weblogic中也可以很好地工作

java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
我的自定义上下文加载器类如下所示:

public class CustomContextListener extends ContextLoaderListener {
     //implemented contextInitized() and contextDestroyed() methods
}
在web.xml中,添加如下:

<listener>
  <listener-class>com.comp.app.context.CustomContextListener</listener-class>
</listener>

ContextLoaderListener
的要点是它的
contextInitialized()
方法在
ServletContext
中初始化和注册
WebApplicationContext
。如果您在未调用
super
实现的情况下重写了此方法,它将不会注册任何
WebApplicationContext

我找到了问题的根本原因。这里的问题不在于自定义上下文加载器。我没有在spring应用程序上下文xml文件中正确配置JNDI名称。现在自定义类工作正常,错误消失。

请发布整个
web.xml
文件。您正在使用哪个版本的Servlet API?请添加自定义实现的代码。My web.xml包含以下版本信息<代码>我的自定义实现类具有初始化某些必需属性和启动作业等的代码,它还具有对超级实现的调用。感谢您的回复,我的自定义类具有对
contextInitialized()
方法的超级实现的调用,但位于方法的末尾,而不是方法的开头(上下文初始化需要我的代码)。
 00000026 DispatcherSer E org.springframework.web.servlet.FrameworkServlet initServletBean Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name configMgr: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: xxxx; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [xxxxxx] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}