0
J'ai créé un projet avec la configuration follwoing:SpringBeanFacesELResolver ne fonctionne pas avec tomcat el
faces-config.xml
<faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
web.xml
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
et pom.xml
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
</dependency>
UserQuery. java
@Component("userQuery")
@SpringViewScope
public class UserQuery implements Serializable
{
private String test = "test";
//getter, setter for test
}
test.xhtml
#{userQuery} // this works, returns userquery object
#{userQuery.test} //throw null pointer exception
exception:
SEVERE: Error Rendering View[/test.xhtml]
javax.el.ELException: /test.xhtml: null
at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:90)
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:207)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1899)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1899)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:451)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at org.ocpsoft.rewrite.faces.RewriteViewHandler.renderView(RewriteViewHandler.java:186)
Caused by: java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at java.beans.Introspector.isAssignable(Introspector.java:809)
PS: quand je supprimer SpringBeanFacesELResolver et utiliser au lieu de jsf @ManagedBean @component # {} userQuery.test fonctionne également mais je ne veux pas utiliser de cette façon.
Qu'est-ce qui ne va pas avec le printemps?
J'utilise tomcat 8.5.16