We are converting an app from jsf 1.2 to jsf2 in wildfly 10, using spring 3.1.1 and mojarra 2.1.29-08. In doing so, we are getting a scope error like:
The scope of the object referenced by expression #{configConstant}, request, is shorter than the referring managed beans (UserSearchBean) scope of view
In our faces-config.xml, we define UserSearchBean like:
<managed-bean>
<managed-bean-name>UserSearchBean</managed-bean-name>
<managed-bean-class>com.mycompany.UserSearchBean</managed-bean-class>
<managed-bean-scope>view</managed-bean-scope>
<managed-property>
<property-name>configConstant</property-name>
<value>#{configConstant}</value>
</managed-property>
</managed-bean>
and in applicationContext.xml we have:
<import resource="../aaconfig.xml" ></import>
And in that aaconfig file we have:
<bean id="configConstant" scope="singleton"
class="com.mycompany.ConfigConstant" >
<property name="fileName">
<value>config.xml</value>
</property>
<property name="logofilename" value="${config.logofilename}" />
</bean>
From what we read, the singleton scope should be global, but the error message from wildfly says otherwise. We have these in web.xml
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<async-supported>true</async-supported>
</servlet>
<servlet>
<servlet-name>accessaudit</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
I just realized that other beans work fine, like this one. It injects fine with the correct scope. The only different I can immediately see is that configConstant has properties read from a properties file.
<bean id="userManager" class="com.mycompany.UserManager">
<property name="userManagerDAO">
<ref bean="userManagerDAOProxy" />
</property>
Any ideas on what is the issue or where to start looking?
Thank you!