Class org.springframework.web.jsf.el.SpringBeanFacesELResolver must extend the type javax.el.ELResolver

风流意气都作罢 提交于 2019-12-04 02:31:22

From the spring documentation, you will see that for org.springframework.web.jsf.el.SpringBeanFacesELResolver:

delegates to the Spring's 'business context' WebApplicationContext first, then to the default resolver of the underlying JSF implementation

and for org.springframework.web.jsf.DelegatingVariableResolver:

will first delegate value lookups to the default resolver of the underlying JSF implementation and then to Spring's 'business context' WebApplicationContext

As you can see, the behavior is very different. If you don't care about order, you are fine, but if you actually did intend to use org.springframework.web.jsf.el.SpringBeanFacesELResolver then all you have to do is ensure the version of el-api.jar in your dependencies is compatible with your version of spring. For me, I have this (in my maven pom):

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>3.0.5.RELEASE</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>el-api</artifactId>
    <version>6.0.32</version>
    <type>jar</type>
    <scope>provided</scope>
</dependency>
Javadroid

To solve this type of problem you should extend project with javax prefix because Class ELResolver is an abstract class under javax.el package.

Here is code:

    <application>
      <javax.el-resolver>
        org.springframework.web.jsf.el.SpringBeanFacesELResolver
      </javax.el-resolver>      
    </application>

More information about ELResolver class you can get by link.

This is possibly a ClassLoader configuration issue. If the SpringBeanFacesELResolver's parent class is from a different ClassLoader to the one used by the JSF classes doing the bootstrapping, the check to see if it is an instance of ELResolver will fail.

Problems like this can happen if you have a META-INF/faces-config.xml in the global classpath, but I suppose there could be other causes.

It would help if you posted information on what container you are using, the classloader policy for your application and where you've placed any third party libraries (such as the Facelets and Spring libs).

Carlos JFB

Configure your Project facets. For run with your local server

Please check the JAR files you are using in application. Again the class paths set in application. I think it is because of the class conflicts in application class paths.

Well my problem disappeared substituting these lines by:

<!-- variable/property resolver registration -->
    <application>
        <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
        <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
    </application>

hope it helps!

Thanks #saadi90, from mvnrepository.com I found this and it solved the problem:

<dependency>
   <groupId>org.glassfish.web</groupId>
   <artifactId>el-impl</artifactId>
   <version>2.2</version>
</dependency>

You need the el-impl dependency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!