spring 类 org.springframework.web.jsf.el.SpringBeanFacesELResolver 必须扩展类型 javax.el.E​​LResolver

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1201021/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 03:55:07  来源:igfitidea点击:

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

springjsfelfacelets

提问by markitus82

I am trying to integrate Spring into a JSF application.

我正在尝试将 Spring 集成到 JSF 应用程序中。

In faces-config.xml, I have included this:

在 中faces-config.xml,我已经包含了这个:

<application>       
  <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
  <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>

but it shows a weird warning which I can't get rid of:

但它显示了一个我无法摆脱的奇怪警告:

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

Any ideas?

有任何想法吗?

采纳答案by markitus82

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!

希望能帮助到你!

回答by Lucas

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

spring 文档中,您将看到 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

首先委托给 Spring 的“业务上下文”WebApplicationContext,然后委托给底层 JSF 实现的默认解析器

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

对于 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

将首先将值查找委托给底层 JSF 实现的默认解析器,然后委托给 Spring 的“业务上下文”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):

如您所见,行为非常不同。如果你不关心顺序,那你很好,但如果你真的打算使用 org.springframework.web.jsf.el.SpringBeanFacesELResolver 那么你所要做的就是确保你的 el-api.jar 的版本依赖项与您的 spring 版本兼容。对我来说,我有这个(在我的 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>

回答by Javadroid

To solve this type of problem you should extend project with javax prefixbecause Class ELResolveris an abstract classunder javax.el package.

为了解决这类问题,你应该与扩建项目javax prefix,因为Class ELResolverabstract classjavax.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.

您可以通过链接获得有关 ELResolver 类的更多信息。

回答by McDowell

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.

这可能是 ClassLoader 配置问题。如果 SpringBeanFacesELResolver 的父类与执行引导的 JSF 类使用的 ClassLoader 不同,则检查它是否是 ELResolver 的实例将失败。

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.

如果全局类路径中有 META-INF/faces-config.xml,可能会发生这样的问题,但我想可能还有其他原因。

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).

如果您发布有关您使用的容器、应用程序的类加载器策略以及您放置任何第三方库(例如 Facelets 和 Spring 库)的信息,将会有所帮助。

回答by Carlos JFB

Configure your Project facets. For run with your local server

配置您的项目方面。与您的本地服务器一起运行

enter image description here

在此处输入图片说明

回答by pulsar14

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

谢谢#saadi90,从mvnrepository.com我发现了这个并解决了这个问题:

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

回答by Umesh Aawte

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.

请检查您在应用程序中使用的 JAR 文件。再次在应用程序中设置类路径。我认为这是因为应用程序类路径中的类冲突。

回答by Saadi

You need the el-impldependency

您需要el-impl依赖项