I developed an application using JSF 1.1.01 and Spring 1.2.6 and when trying to access the first page an EvaluationException occurs, saying the Named Object was not found.
It's a simple JSF application with two JSP's using a bean created by Spring. When trying to link the bean (JSF) to the service (created by Spring) using the DelegatingVariableResolver the error occurs.
Here's the contents of the files :
web.xml
-------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
/**
* Geeft de table component terug die gebonden is aan deze bean.
* @return {@link UIData tabel} die gebonden is aan deze bean.
*/
public UIData getTable() {
return table;
}
/**
* Zet de table component die gebonden is aan deze bean.
* @param table die op de jsp staat.
*/
public void setTable(UIData table) {
this.table = table;
}
public List getGevondenLeden() {
return gevondenLeden;
}
public void setGevondenLeden(List gevondenLeden) {
this.gevondenLeden = gevondenLeden;
}
public Lid getLid() {
return lid;
}
public void setLid(Lid lid) {
this.lid = lid;
}
public ZoekKenmerken getZoekKenmerken() {
return zoekKenmerken;
}
public void setZoekKenmerken(ZoekKenmerken zoekKenmerken) {
this.zoekKenmerken = zoekKenmerken;
}
public ServiceProvider getServiceProvider() {
return serviceProvider;
}
public void setServiceProvider(ServiceProvider serviceProvider) {
this.serviceProvider = serviceProvider;
}
}
Stacktrace
----------
[13-8-06 14:50:40:469 CEST] 642c149 ApplicationIm E com.sun.faces.application.ApplicationImpl Managedbean zoekLidBean could not be created Expression Error: Named Object: 'serviceProvider' not found.
[13-8-06 14:50:40:750 CEST] 642c149 ApplicationIm E com.sun.faces.application.ApplicationImpl TRAS0014I: The following exception was logged javax.faces.el.EvaluationException: Expression Error: Named Object: 'serviceProvider' not found.
at com.sun.faces.config.ManagedBeanFactory.getScopeForSingleExpression(ManagedBeanFactory.java:998)
at com.sun.faces.config.ManagedBeanFactory.hasValidLifespan(ManagedBeanFactory.java:931)
at com.sun.faces.config.ManagedBeanFactory.evaluateValueBindingGet(ManagedBeanFactory.java:892)
at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:553)
at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:234)
at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:253)
at com.sun.faces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:78)
at org.springframework.web.jsf.DelegatingVariableResolver.resolveVariable(DelegatingVariableResolver.java:110)
at com.sun.faces.el.impl.NamedValue.evaluate(NamedValue.java:125)
at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:146)
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
at javax.faces.component.UIOutput.getValue(UIOutput.java:147)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:82)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:191)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:169)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:712)
at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:616)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:539)
at com.sun.faces.taglib.html_basic.InputTextTag.doEndTag(InputTextTag.java:524)
at org.apache.jsp._zoekLeden._jspService(zoekLeden.jsp :9)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:351)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:705)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:803)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1171)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:203)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1171)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:203)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:300)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:246)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:652)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:448)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:936)
.
Can someone please help me because this is taking me 5 weeks now. Any help is appreciated.
Thank you.
Richard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As far as I can see, serviceProvider isn't defined anywhere. As you say, it should be managed by Spring, right? So there's one crucial part missing: You don't initialize jsf-spring. You should do this by using de.mindmatters.faces.spring.context.ContextLoaderListener as well. I think this should solve your problem. Have a look at the JavaDoc, especially the doc on the packages de.mindmatters.faces.spring.context and de.mindmatters.faces.spring.config.
HTH,
Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for your response. I tried to solve this using the org.springframework.web.context.ContextLoaderListener but this didn't work. Can you explain the difference between the springframework ContextLoaderListener and the mindmatters Listener ?
Thanks
Richard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
They are no alternatives, you have to use both. One initializes Spring, the other initializes JSF-Spring. Have a look at the testsuite for an example web.xml.
HTH, Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Richard
Could you please let me know if you found the solution to your problem as i am sailing in the same boat with almost similar code.
I agree with Thomas that you need to define your service provider and declare it in application-context.xml which i did but still i have the same problem
Also i disagree with Thomas that we need de.mindmatters.faces.spring.context.ContextLoaderListener to intialize JSF-spring. I am sure their is way to do without this Listener as there are number of examples available on the web without this Listener
Anyhow i would appreciate Thomas or you helping me without using mindmatter Listener
Regards
Bansi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
could you please point me to one of those examples? If they are like the one you posted on https://sourceforge.net/forum/message.php?msg_id=3905899, they're not of much use here. That one doesn't use jsf-spring at all. It uses JSF and it uses spring, right. But it uses the DelegatingVariableResolver contained in spring to combine the two frameworks. If you want to use jsf-spring and want to benefit from its extended integration, you definitely have to use jsf-spring's ContextLoaderListener/ConfigLoaderListener as well. Actually, you have to use three "initializers":
1. javax.faces.webapp.FacesServlet (or jsf-spring's DispatcherServlet) that initializes JSF
2. org.springframework.web.context.ContextLoaderListener that initializes spring's context
3. de.mindmatters.faces.spring.context.ContextLoaderListener or de.mindmatters.faces.spring.config.ConfigLoaderListener (you can use either one of them or both of them, depending on what you want to achieve - but at least one of them) that initialize jsf-spring's context(s) and wire up all the context relations
If you want to avoid our listener, you can't use jsf-spring. The listener is an integral part of it.
HTH, Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Thomas
Thanks for quick response. I really appreciate it. As i am new to JSF & Spring i would like to take Step by Step. From your response i understand jsf-spring provides extended integration and i also did some reading on jsf-sprinf forums regarding mindmatter Listener. But i am still wondering can't i make jsf-spring integration work without mindmatter listener just to get started learning or developing prototype. I agree for production code i need something like jsf-spring mindmatter listener. But as i am new and going thru numerous articles available on the web they all use Spring Variable resolver in faces-config.xml i.e
org.springframework.web.jsf.DelegatingVariableResolver and org.springframework.web.context.ContextLoaderListener in the web.xml to get the integration work. I just wanna get thru this first phase and then take a deep dive by looking into jsf-spring. I would really appreciate your help in this regard.
Thanks for your time in advance
regards
Bansi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
2. combine them using jsf-spring
If this is our choice, you don't need Spring's DelegatingVariableResolver (delete it from your faces-config.xml) - just copy jsf-spring to your WEB-INF/lib and fire it up using our ContextLoaderListener in addition to Spring's ContextLoaderListener.
That's it. Both alternatives are quite easy to setup. If you want to reduce your library dependencies, start off with the first. This will give you bean access from your JSF managed beans to your Spring beans. When this is enough for your application's needs, stick with that. I you need some more complex integration, like event propagation between the two frameworks, message handling, all the Spring features for your JSF managed beans or configuration of JSF components using Spring, just switch to the second.
HTH,
Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Thomas
Thanks for quick response. You are absolutely right. Thanks for providing the roadmap into jsf-spring integration. To get started i am working on the first option hoping to move on to second option . But the first option doesnt work for me it gives the following error
javax.servlet.jsp.JspException: javax.faces.FacesException: javax.faces.el.EvaluationException: Expression Error: Named Object: 'springBean' not found.
The root cause for the error is "<managed-property>" under <managed-bean> from JSF which references Spring Bean. It is not able to evaluate JSF Expression Language. Then i tried following permutations and combinations
-> instead of using JSF EL, i hardcoded the property value and it worked
Any pointers/suggestions will be highly appreciate.
Regards
Bansi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
your snippets look correct, I just created a similar application and it worked. I don't know what else might be wrong with your setup. You don't have a FacesServlet in your snippets, but I assume you have it in your web.xml.
Anyway, this is not a problem with jsf-spring, you don't use jsf-spring at all. This might even be a problem with the packaging of your app, since the class is not found as you said in your other posting, which could be a MyEclipse issue. All in all, this is the wrong forum for your problem.
Cheers, Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thomas
Finally i decided to use jsf-spring and as suggested by you in one of the above messages i exactly did the following
combine them using jsf-spring
If this is our choice, you don't need Spring's DelegatingVariableResolver (delete it from your faces-config.xml) - just copy jsf-spring to your WEB-INF/lib and fire it up using our ContextLoaderListener in addition to Spring's ContextLoaderListener
I have used jsf-spring.jar from jsf-spring 2.6
The moment i deploy my application i get the following errors
as the error message states, there have been previous errors that caused the listener to fail staring up. Please search your logs for those error messages as they contain the root cause.
Regards, Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry I did'nt respond to your comments. I got it working and just forgot I was here.
The trick for me was that I tried MyFaces instead of JSF and accidentaly downloaded also some new versions of other Jar's (commons-collections etc. etc). When this didn't work I deleted MyFaces but forgot to change to the old dependend libraries.
When I tried it again it suddenly worked.
It went to far to determine step by step which jar it was so I went on developing my application.
The jars I now use are:
cgilib-full 2.0.2
commons-beanutils 1.7.0
commons-collections 3.1
commons-digester 1.6
commongs-logging 1.0.4
dom4j 1.6.1
ehcache 1.1
hibernate 3.0.3
jsf-api 1.1.01
jsf-impl 1.1.01
jstl 1.1.2
jta 1.0
spring 1.2.6
standard 1.1.2
Hope this helps you.
Regards,
Richard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I developed an application using JSF 1.1.01 and Spring 1.2.6 and when trying to access the first page an EvaluationException occurs, saying the Named Object was not found.
It's a simple JSF application with two JSP's using a bean created by Spring. When trying to link the bean (JSF) to the service (created by Spring) using the DelegatingVariableResolver the error occurs.
Here's the contents of the files :
web.xml
-------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>notFound.html</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>error.html</location>
</error-page>
<taglib>
<taglib-uri>http://java.sun.com/jsf/core</taglib-uri>
<taglib-location>/WEB-INF/tld/jsf_core-1.1.01.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsf/html</taglib-uri>
<taglib-location>/WEB-INF/tld/html_basic-1.1.01.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsf/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c-1.0.tld</taglib-location>
</taglib>
</web-app>
faces-config.xml
----------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<application>
<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
</application>
<managed-bean>
<managed-bean-name>zoekLidBean</managed-bean-name>
<managed-bean-class>nl.aalten.lencos.beans.ZoekLidBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>serviceProvider</property-name>
<value>#{serviceProvider}</value>
</managed-property>
</managed-bean>
<!-- navigation rules voor bewerk klacht -->
<navigation-rule>
<from-view-id>/public/zoekLeden.jsp</from-view-id>
<navigation-case>
<from-outcome>zoeken</from-outcome>
<to-view-id>/public/toonLeden.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
zoekLeden.jsp
-------------
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>Overzicht leden van de Lenco's</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" href="style/style.css" />
</head>
<body>
<h1>Overzicht Leden</h1>
<f:view>
<h:form id="toonLedenForm">
<h:inputText id="Naam" size="10" value="#{zoekLidBean.zoekKenmerken.naam}" /><br><br>
<h:commandButton type="submit" id="zoeken" value="Zoeken" action="#{zoekLidBean.zoekLeden}" />
</h:form>
</f:view>
</body>
</html>
ZoekLidBean
-----------
/* $Id:$
*
* Created by ${user}
* Created on ${date}
* Copyright VVK, ${year}.
*/
package nl.aalten.lencos.beans;
import java.util.Iterator;
import java.util.List;
import javax.faces.component.UIData;
import nl.aalten.lencos.domain.Lid;
import nl.aalten.lencos.domain.ZoekKenmerken;
import nl.aalten.lencos.service.ServiceProvider;
/**
* @author Richard Aalten
*
*/
public class ZoekLidBean {
/** constante om verder te navigeren naar de volgende pagina. */
protected static final String ZOEKEN = "zoeken";
/** zoek kenmerken die gebruiker heeft ingevoerd. */
private ZoekKenmerken zoekKenmerken;
private List gevondenLeden;
private Lid lid;
private ServiceProvider serviceProvider;
/** Property voor de datatable. */
private UIData table;
/**
* Default constructor
*
*/
public ZoekLidBean() {
zoekKenmerken = new ZoekKenmerken();
}
/**
* Na het zoeken naar leden, naar {@link #ZOEKEN}
* @return String voor navigatie.
*/
public String zoekLeden() {
System.out.println("In de methode ZoekLeden");
System.out.println("ServiceProvider" + getServiceProvider());
gevondenLeden = getServiceProvider().zoekLeden();
// Iterator it = gevondenLeden.iterator();
// while (it.hasNext()) {
// Lid l = (Lid) it.next();
// System.out.println(l.getId() + " : " + l.getVoorLetters() + " " + l.getTussenVoegsel() + " " + l.getAchterNaam());
// }
return ZOEKEN;
}
// ========================================================================================
//
// Getters and setters
//
//
// ========================================================================================
/**
* Geeft de table component terug die gebonden is aan deze bean.
* @return {@link UIData tabel} die gebonden is aan deze bean.
*/
public UIData getTable() {
return table;
}
/**
* Zet de table component die gebonden is aan deze bean.
* @param table die op de jsp staat.
*/
public void setTable(UIData table) {
this.table = table;
}
public List getGevondenLeden() {
return gevondenLeden;
}
public void setGevondenLeden(List gevondenLeden) {
this.gevondenLeden = gevondenLeden;
}
public Lid getLid() {
return lid;
}
public void setLid(Lid lid) {
this.lid = lid;
}
public ZoekKenmerken getZoekKenmerken() {
return zoekKenmerken;
}
public void setZoekKenmerken(ZoekKenmerken zoekKenmerken) {
this.zoekKenmerken = zoekKenmerken;
}
public ServiceProvider getServiceProvider() {
return serviceProvider;
}
public void setServiceProvider(ServiceProvider serviceProvider) {
this.serviceProvider = serviceProvider;
}
}
Stacktrace
----------
[13-8-06 14:50:40:469 CEST] 642c149 ApplicationIm E com.sun.faces.application.ApplicationImpl Managedbean zoekLidBean could not be created Expression Error: Named Object: 'serviceProvider' not found.
[13-8-06 14:50:40:750 CEST] 642c149 ApplicationIm E com.sun.faces.application.ApplicationImpl TRAS0014I: The following exception was logged javax.faces.el.EvaluationException: Expression Error: Named Object: 'serviceProvider' not found.
at com.sun.faces.config.ManagedBeanFactory.getScopeForSingleExpression(ManagedBeanFactory.java:998)
at com.sun.faces.config.ManagedBeanFactory.hasValidLifespan(ManagedBeanFactory.java:931)
at com.sun.faces.config.ManagedBeanFactory.evaluateValueBindingGet(ManagedBeanFactory.java:892)
at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:553)
at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:234)
at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:253)
at com.sun.faces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:78)
at org.springframework.web.jsf.DelegatingVariableResolver.resolveVariable(DelegatingVariableResolver.java:110)
at com.sun.faces.el.impl.NamedValue.evaluate(NamedValue.java:125)
at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:146)
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
at javax.faces.component.UIOutput.getValue(UIOutput.java:147)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:82)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:191)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:169)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:712)
at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:616)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:539)
at com.sun.faces.taglib.html_basic.InputTextTag.doEndTag(InputTextTag.java:524)
at org.apache.jsp._zoekLeden._jspService(zoekLeden.jsp :9)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:351)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:705)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:803)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1171)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:203)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1171)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:203)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:300)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:246)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:652)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:448)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:936)
.
Can someone please help me because this is taking me 5 weeks now. Any help is appreciated.
Thank you.
Richard
As far as I can see, serviceProvider isn't defined anywhere. As you say, it should be managed by Spring, right? So there's one crucial part missing: You don't initialize jsf-spring. You should do this by using de.mindmatters.faces.spring.context.ContextLoaderListener as well. I think this should solve your problem. Have a look at the JavaDoc, especially the doc on the packages de.mindmatters.faces.spring.context and de.mindmatters.faces.spring.config.
HTH,
Thomas
Thomas,
Thank you for your response. I tried to solve this using the org.springframework.web.context.ContextLoaderListener but this didn't work. Can you explain the difference between the springframework ContextLoaderListener and the mindmatters Listener ?
Thanks
Richard
They are no alternatives, you have to use both. One initializes Spring, the other initializes JSF-Spring. Have a look at the testsuite for an example web.xml.
HTH, Thomas
Hi Richard
Could you please let me know if you found the solution to your problem as i am sailing in the same boat with almost similar code.
I agree with Thomas that you need to define your service provider and declare it in application-context.xml which i did but still i have the same problem
Also i disagree with Thomas that we need de.mindmatters.faces.spring.context.ContextLoaderListener to intialize JSF-spring. I am sure their is way to do without this Listener as there are number of examples available on the web without this Listener
Anyhow i would appreciate Thomas or you helping me without using mindmatter Listener
Regards
Bansi
Hi Bansi,
could you please point me to one of those examples? If they are like the one you posted on https://sourceforge.net/forum/message.php?msg_id=3905899, they're not of much use here. That one doesn't use jsf-spring at all. It uses JSF and it uses spring, right. But it uses the DelegatingVariableResolver contained in spring to combine the two frameworks. If you want to use jsf-spring and want to benefit from its extended integration, you definitely have to use jsf-spring's ContextLoaderListener/ConfigLoaderListener as well. Actually, you have to use three "initializers":
1. javax.faces.webapp.FacesServlet (or jsf-spring's DispatcherServlet) that initializes JSF
2. org.springframework.web.context.ContextLoaderListener that initializes spring's context
3. de.mindmatters.faces.spring.context.ContextLoaderListener or de.mindmatters.faces.spring.config.ConfigLoaderListener (you can use either one of them or both of them, depending on what you want to achieve - but at least one of them) that initialize jsf-spring's context(s) and wire up all the context relations
If you want to avoid our listener, you can't use jsf-spring. The listener is an integral part of it.
HTH, Thomas
Hi Thomas
Thanks for quick response. I really appreciate it. As i am new to JSF & Spring i would like to take Step by Step. From your response i understand jsf-spring provides extended integration and i also did some reading on jsf-sprinf forums regarding mindmatter Listener. But i am still wondering can't i make jsf-spring integration work without mindmatter listener just to get started learning or developing prototype. I agree for production code i need something like jsf-spring mindmatter listener. But as i am new and going thru numerous articles available on the web they all use Spring Variable resolver in faces-config.xml i.e
org.springframework.web.jsf.DelegatingVariableResolver and org.springframework.web.context.ContextLoaderListener in the web.xml to get the integration work. I just wanna get thru this first phase and then take a deep dive by looking into jsf-spring. I would really appreciate your help in this regard.
Thanks for your time in advance
regards
Bansi
Hi Bansi,
well, you just got to make a choice:
1. combine JSF and Spring using the integration code contained in Spring
For this, you just need JSF and Spring libraries and use the DelegatingVariableResolver from Spring. See http://static.springframework.org/spring/docs/1.2.x/reference/webintegration.html#jsf for details.
2. combine them using jsf-spring
If this is our choice, you don't need Spring's DelegatingVariableResolver (delete it from your faces-config.xml) - just copy jsf-spring to your WEB-INF/lib and fire it up using our ContextLoaderListener in addition to Spring's ContextLoaderListener.
That's it. Both alternatives are quite easy to setup. If you want to reduce your library dependencies, start off with the first. This will give you bean access from your JSF managed beans to your Spring beans. When this is enough for your application's needs, stick with that. I you need some more complex integration, like event propagation between the two frameworks, message handling, all the Spring features for your JSF managed beans or configuration of JSF components using Spring, just switch to the second.
HTH,
Thomas
Hi Thomas
Thanks for quick response. You are absolutely right. Thanks for providing the roadmap into jsf-spring integration. To get started i am working on the first option hoping to move on to second option . But the first option doesnt work for me it gives the following error
javax.servlet.jsp.JspException: javax.faces.FacesException: javax.faces.el.EvaluationException: Expression Error: Named Object: 'springBean' not found.
The root cause for the error is "<managed-property>" under <managed-bean> from JSF which references Spring Bean. It is not able to evaluate JSF Expression Language. Then i tried following permutations and combinations
-> instead of using JSF EL, i hardcoded the property value and it worked
Any pointers/suggestions will be highly appreciate.
Regards
Bansi
Thomas,
Here are the snippets of code
Code:
web.xml :
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Code:
faces-config.xml
<application>
<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
</application>
<managed-bean>
<description>JSF managed bean referencing a spring bean</description>
<managed-bean-name>JsfBean</managed-bean-name>
<managed-bean-class>test.JsfBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>springBean</property-name>
<value>#{springBean}</value>
</managed-property>
</managed-bean>
Code:
application-context.xml :
<bean id="springBean" class="test.SpringBean">
<property name="text"><value>some example text</value></property>
</bean>
The weird thing i notice about MyEclipse 5.0 is when i reopen it after some time it puts a red cross mark and says test.JsfBean not found
The JSP Page
Code:
<h:outputText value="#{JsfBean.springBean.text}" />
Code:
package test;
public class JsfBean {
private SpringBean springBean;
public JsfBean() {
super();
}
public SpringBean getSpringBean() {
return springBean;
}
public void setSpringBean(SpringBean paramSpringBean) {
springBean = paramSpringBean;
}
}
Code:
package test;
public class SpringBean {
String text;
public SpringBean() {
super();
}
public String getText() {
return text;
}
public void setText(String paramText) {
text = paramText;
}
}
Hi Bansi,
your snippets look correct, I just created a similar application and it worked. I don't know what else might be wrong with your setup. You don't have a FacesServlet in your snippets, but I assume you have it in your web.xml.
Anyway, this is not a problem with jsf-spring, you don't use jsf-spring at all. This might even be a problem with the packaging of your app, since the class is not found as you said in your other posting, which could be a MyEclipse issue. All in all, this is the wrong forum for your problem.
Cheers, Thomas
Thomas
Finally i decided to use jsf-spring and as suggested by you in one of the above messages i exactly did the following
combine them using jsf-spring
If this is our choice, you don't need Spring's DelegatingVariableResolver (delete it from your faces-config.xml) - just copy jsf-spring to your WEB-INF/lib and fire it up using our ContextLoaderListener in addition to Spring's ContextLoaderListener
I have used jsf-spring.jar from jsf-spring 2.6
The moment i deploy my application i get the following errors
Sep 12, 2006 3:49:08 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
Sep 12, 2006 3:49:08 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Sep 12, 2006 3:49:08 PM org.apache.catalina.core.StandardContext start
SEVERE: Context startup failed due to previous errors
Regards
Bansi
Hi Bansi,
as the error message states, there have been previous errors that caused the listener to fail staring up. Please search your logs for those error messages as they contain the root cause.
Regards, Thomas
Bansi/Thomas,
Sorry I did'nt respond to your comments. I got it working and just forgot I was here.
The trick for me was that I tried MyFaces instead of JSF and accidentaly downloaded also some new versions of other Jar's (commons-collections etc. etc). When this didn't work I deleted MyFaces but forgot to change to the old dependend libraries.
When I tried it again it suddenly worked.
It went to far to determine step by step which jar it was so I went on developing my application.
The jars I now use are:
cgilib-full 2.0.2
commons-beanutils 1.7.0
commons-collections 3.1
commons-digester 1.6
commongs-logging 1.0.4
dom4j 1.6.1
ehcache 1.1
hibernate 3.0.3
jsf-api 1.1.01
jsf-impl 1.1.01
jstl 1.1.2
jta 1.0
spring 1.2.6
standard 1.1.2
Hope this helps you.
Regards,
Richard