Hello,
i have this problem: i have a jsf web applciation (which use facelets) and has a couple of backing beans for managing visual components. I tried to integrate spring because i want it to manage the business logic objects. For doing this i used jsf-spring project and i followed the steps in the quickstart tutorial:
1)i imported the required libraries: spring.jar, commons-logging.jar, jsf-spring.jar, cglib-nodep-2.1_3.jar
2) i changed my web.xml configuraiton file adding the following lines
<listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
</listener>
<listener>
<listener-class>de.mindmatters.faces.spring.context.ContextL oaderListener</listener-class>
</listener>
3) i created a new xml file in the WEB-INF directory called applicationContext.xml for spring environment and i defined i bean inside
<?xml version="1.0" encoding="UTF-8"?/gt;
<!DOCTYPE beans PUBLIC
"-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="timeService" class="springbeans.TimeServiceImpl" />
</beans>
4) i coded the class for the bean implementation (TimeServiceImpl.java)
5) i used the bean inside another bean called UserBean, which is defined in the jsf context (it's defined in the facescontext.xml file)
the first time i tried to run the application it gave me one error and then surfing in the web i discovered that i must add another line in the web.xml file:
<listener> <listener-class>org.springframework.web.context.request.Requ estContextListener</listener-class>
</listener>
finally after this change my application started, so i got the welcome page.
The problem comes when i click on a button which has the backing bean, called UserBean and defined before, bound behind. This bean is instantiated but i have the following error coming from spring:
javax.faces.el.EvaluationException: /components/loginForm.xhtml @16,125 value="#{UserBean.username}": org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'UserBean' defined in ServletContext resource [/WEB-INF/faces-config.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [backingbeans.Role] for property 'role'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [backingbeans.Role] for property 'role': no matching editors or conversion strategy found
As you can notice the UserBean has a property called role, which type is a complex type and defined by the class Role. Without the spring integration everything works fine, but now i have this error. Do you know how can i solve it? Why is sping managing the creation of the bean, even if the bean itself is defined in the jsf context and not in the spring context?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
i have this problem: i have a jsf web applciation (which use facelets) and has a couple of backing beans for managing visual components. I tried to integrate spring because i want it to manage the business logic objects. For doing this i used jsf-spring project and i followed the steps in the quickstart tutorial:
1)i imported the required libraries: spring.jar, commons-logging.jar, jsf-spring.jar, cglib-nodep-2.1_3.jar
2) i changed my web.xml configuraiton file adding the following lines
<listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
</listener>
<listener>
<listener-class>de.mindmatters.faces.spring.context.ContextL oaderListener</listener-class>
</listener>
3) i created a new xml file in the WEB-INF directory called applicationContext.xml for spring environment and i defined i bean inside
<?xml version="1.0" encoding="UTF-8"?/gt;
<!DOCTYPE beans PUBLIC
"-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="timeService" class="springbeans.TimeServiceImpl" />
</beans>
4) i coded the class for the bean implementation (TimeServiceImpl.java)
5) i used the bean inside another bean called UserBean, which is defined in the jsf context (it's defined in the facescontext.xml file)
the first time i tried to run the application it gave me one error and then surfing in the web i discovered that i must add another line in the web.xml file:
<listener> <listener-class>org.springframework.web.context.request.Requ estContextListener</listener-class>
</listener>
finally after this change my application started, so i got the welcome page.
The problem comes when i click on a button which has the backing bean, called UserBean and defined before, bound behind. This bean is instantiated but i have the following error coming from spring:
javax.faces.el.EvaluationException: /components/loginForm.xhtml @16,125 value="#{UserBean.username}": org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'UserBean' defined in ServletContext resource [/WEB-INF/faces-config.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [backingbeans.Role] for property 'role'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [backingbeans.Role] for property 'role': no matching editors or conversion strategy found
As you can notice the UserBean has a property called role, which type is a complex type and defined by the class Role. Without the spring integration everything works fine, but now i have this error. Do you know how can i solve it? Why is sping managing the creation of the bean, even if the bean itself is defined in the jsf context and not in the spring context?