-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Medium
-
Affects Version/s: 1.3
-
Component/s: None
Websphere 5.1 has an annoying bug where it won't initialise a ServletContextListener properly unless it directly implements the ServletContextListener interface.
We need to go through and make sure that all of our listeners implement the interface directly, instead of (well, as well as) inheriting it through a superclass.
From a Confluence comment:
When you install Confluence in WASv5.1 during DB setup step, you will meet such problem:
Configuring the database failed. Couldnt create the database schema.
java.lang.NullPointerException at
com.atlassian.confluence.setup.ConfluenceHibernateSetup.configureDatabase(ConfluenceHibernateSetup.java:84)
at com.atlassian.confluence.setup.ConfluenceHibernateSetup.configureDataSourceDatabase(ConfluenceHibernateSetup.java:61)
at com.atlassian.confluence.setup.actions.SetupDatasourceDatabaseAction.execute(SetupDatasourceDatabaseAction.java:60)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:171)
at com.atlassian.confluence.setup.actions.SetupCheckInterceptor.intercept(SetupCheckInterceptor.java:27) at
What's wrong?
It is WASv5.1 product's bug. Here is the code snippet of Confluence web.xml:
<listener>
<listener-class>bucket.container.ContainerContextLoaderListener</listener-class>
</listener>
When confluence application startup, Web Container should initial ContainerContextLoaderListener.java and call contextInitialized method to create SpringContainerContext.
But there is fatal bug in WASv5.1, WAS web container only can initialize classes which you explicitly declare implements ServletContextListener.
If you code like this:
package bucket.container;
......
public class ContainerContextLoaderListener
extends ContextLoaderListener{
....
public void contextInitialized(ServletContextEvent event)
....
}
WebSphere will not initialize this class & its' method contextInitialized.
How to resolve this issue?
Adjust the listener like below:
package bucket.container;
......
public class ContainerContextLoaderListener
extends ContextLoaderListener
implements ServletContextListener{
....
public void contextInitialized(ServletContextEvent event) { ..... }
....
}
Try it, you will resolve such problem.