Announcement Announcement Module
Collapse
No announcement yet.
Getting Bean within JSF ChangeListener Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting Bean within JSF ChangeListener

    Hi,

    i am trying to get a spring bean to react to a changeValue in JSF-Page:
    Code:
    ...
    BeanFactory beanFactory = new ClassPathXmlApplicationContext("classpath*:backingBeans.xml");
    		
    		ManageRoutingItemsBackBean bean = (ManageRoutingItemsBackBean)beanFactory.getBean("ManageRoutingItemsBackBean");
    ...
    My configuration files are:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <beans xmlns="http://www.springframework.org/schema/beans"
    	     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	     xmlns:aop="http://www.springframework.org/schema/aop"
    	     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
    
    <!-- Beans are configured in different files:
    	- All GUI relevant beans are found in backingBeans.xml
    	- All business logic can be found in services.xml
    	- Data access object are located in daoSupport.xml
     -->
    	<import resource="backingBeans.xml"/>
    	<import resource="services.xml"/>
    	<import resource="daoSupport.xml"/>
    	
    	
    </beans>
    and the resulting file is like:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    	
    	<bean id="ManageRoutingItemsBackBean"
    			class="de.hansenet.lnp.backBeans.ManageRoutingItemsBackBean"
    			scope="session">
    			<property name="serviceBean" ref="ManageRoutingItemsServiceBean"></property>
    	</bean>
    
    </beans>
    when i am trying to get the spring bean i got following error:

    Code:
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ManageRoutingItemsBackBean' is defined
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:387)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:968)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
    	at de.hansenet.lnp.actionListener.CheckAllListener.processValueChange(CheckAllListener.java:26)
    	at javax.faces.event.ValueChangeEvent.processListener(ValueChangeEvent.java:103)
    	at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:641)
    	at javax.faces.component.UIInput.broadcast(UIInput.java:486)
    	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:249)
    	at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:343)
    	at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:78)
    	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:199)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:145)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
    	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:139)
    	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446)
    	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
    	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2460)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
    	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
    	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:119)
    	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
    	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
    	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:157)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
    	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
    	at java.lang.Thread.run(Thread.java:595)
    What am i doing wrong here? Can anybody help?

    Regards,

    ak
Working...
X