在迁移到jsf 1.2时尝试加载应用程序上下文时出现空指针异常。
下面是堆栈跟踪
[ERROR] [com.sun.faces.lifecycle.InvokeApplicationPhase] [] - # {CustomerSearchBean.searchCustomers}: javax.faces.el.EvaluationException:
java.lang.NullPointerException
javax.faces.FacesException: #{CustomerSearchBean.searchCustomers}: javax.faces.el.EvaluationException: java.lang.NullPointerException
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
... 29 more
Caused by: java.lang.NullPointerException
at com.tms.cdqi.presentation.jsf.bean.customerprofile.CustomerSearchBean.searchCustomers(CustomerSearchBean.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
下面是faces-xml
<managed-bean>
<description>This bean is used for customer profile</description>
<managed-bean-name>CustomerSearchBean</managed-bean-name>
<managed-bean-class>com.tms.cdqi.presentation.jsf.bean.customerprofile.CustomerSearchBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>commandInvoker</property-name>
<value>#{commandInvoker}</value>
</managed-property>
<managed-property>
<property-name>applicationContextFactory</property-name>
<value>#{cdqiApplicationContextFactory}</value>
</managed-property>
</managed-bean>
编辑1: 下面是Application context xml
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="cdqiApplicationContextFactory"
class="com.tms.cdqi.framework.context.CDQIApplicationContextFactoryImpl" />
编辑2代码
The application context where null pointer is occurring
CDQIApplicationContext context = this.getApplicationContextFactory()
.getApplicationContext();