为什么WildFly 10 + JSF 2.3无法与Omnifaces 2.6.1一起使用? [英] Why is WildFly 10 + JSF 2.3 not working with Omnifaces 2.6.1?

查看:98
本文介绍了为什么WildFly 10 + JSF 2.3无法与Omnifaces 2.6.1一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在Wildfly 10上使用jsf 2.3,primefaces 6和omnifaces 2.6.1来启动和运行应用程序.

I've been trying to get an app up and running using jsf 2.3, primefaces 6 and omnifaces 2.6.1 on Wildfly 10.

我已经拆分了jsf 2.3(api和impl)并完成了WildFly的设置.

I have already splitted the jsf 2.3 (api and impl) and completed the set up for WildFly.

应用程序可以顺利启动,而无需使用全功能2.6.1.但是正确的是,当我将omnifaces jar添加到应用程序类路径(/lib)时,此启动失败,并给出了下一个异常:

The applications starts smoothly without omnifaces 2.6.1. But right when I add the omnifaces jar to the application classpath (/lib) this one fails at start up, giving the next exception:

13:21:52,024 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 78) Critical error during deployment: : com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:457)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:237)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:200)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:171)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:234)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
    Caused by: java.lang.UnsupportedOperationException
at javax.faces.application.Application.getSearchExpressionHandler(Application.java:2001)
at javax.faces.application.ApplicationWrapper.getSearchExpressionHandler(ApplicationWrapper.java:815)
at com.sun.faces.config.processor.ApplicationConfigProcessor.setSearchExpressionHandler(ApplicationConfigProcessor.java:738)
at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:382)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:138)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:246)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:443)
... 21 more
    13:21:52,031 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 78) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
    Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:236)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
... 6 more
    Caused by: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:315)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:200)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:171)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:234)
... 8 more
    Caused by: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:457)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:237)
... 20 more
    Caused by: java.lang.UnsupportedOperationException
at javax.faces.application.Application.getSearchExpressionHandler(Application.java:2001)
at javax.faces.application.ApplicationWrapper.getSearchExpressionHandler(ApplicationWrapper.java:815)
at com.sun.faces.config.processor.ApplicationConfigProcessor.setSearchExpressionHandler(ApplicationConfigProcessor.java:738)
at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:382)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:138)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:155)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:246)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:443)
... 21 more

    13:21:52,059 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "processmanagement-1.0-SNAPSHOT")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
    Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
    Caused by: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
    Caused by: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
    Caused by: java.lang.UnsupportedOperationException"},
"WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.deployment.default-server.default-host./"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}
    13:21:52,066 ERROR [org.jboss.as.server] (management-handler-thread - 2) WFLYSRV0021: Deploy of deployment "processmanagement-1.0-SNAPSHOT.war" was rolled back with the following failure message: 
    {"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
Caused by: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
Caused by: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
Caused by: java.lang.UnsupportedOperationException"},
"WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.deployment.default-server.default-host./"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}

堆栈跟踪显示javax.faces.application.Application.Application.getSearchExpressionHandler方法正在'else'块内进入

The stack trace show that the method javax.faces.application.Application.getSearchExpressionHandler is entering inside the 'else' block

    public SearchExpressionHandler getSearchExpressionHandler() {

    if (defaultApplication != null) {
        return defaultApplication.getSearchExpressionHandler();
    } else {
        throw new UnsupportedOperationException();
    }

    }

这显然意味着defaultApplicatoin为null.有什么原因吗?我是否缺少omnifaces 2.6.1/jsf 2.3的任何重要配置?

Which obviously means defaultApplicatoin is null. Any reason why? Am I missing any important configuration for omnifaces 2.6.1/jsf 2.3?

提前谢谢!

推荐答案

这是WildFly中的错误.我已经报告了它: http://issues.jboss.org/browse/WFLY-8815 .

This is a bug in WildFly. I've already reported it: http://issues.jboss.org/browse/WFLY-8815.

到目前为止,它的内置WeldApplication已对JSF 2.2依赖项进行了硬编码.它实际上应该已经从JSF javax.faces.application.ApplicationWrapper ,它已经预定义了所有默认的委托方法,例如getSearchExpressionHandler(),但是JSF 2.2绑定的WeldApplication没有那个,因此您遇到了异常.

To the point, its builtin WeldApplication has hardcoded JSF 2.2 dependencies. It should actually have extended from JSF javax.faces.application.ApplicationWrapper which has all default delegate methods already predefined such as getSearchExpressionHandler(), but the JSF 2.2-tied WeldApplication didn't have that one and hence the exception you faced.

OmniFaces并没有错,只是一个触发器.对于其他任何具有自定义javax.faces.application.Application实现的以JSF为目标的库,您将面临完全相同的问题.

OmniFaces wasn't at fault, it was just a trigger. You would have faced exactly the same problem with any other JSF-targeted library having a custom javax.faces.application.Application implementation.

如果无法将JSF降级到2.2,并且您没有耐心等待WildFly家伙修复它,那么您可以按如下所示修改WildFly修复其损坏的WeldApplication.

If downgrading JSF back to 2.2 is not an option, and you don't have patience to wait for WildFly guys to get it fixed, then you could as below modify WildFly fix its broken WeldApplication.

  1. 查找已经已修复!这仅适用于Tomcat之类的东西.

  1. Find source code of org.jboss.as.jsf.injection.weld.WeldApplication (note: thus not org.jboss.weld.environment.servlet.jsf.WeldApplication which indeed has this bug already fixed! That's only for things like Tomcat).

public class WeldApplication extends ForwardingApplication {

public class WeldApplication extends ApplicationWrapper {

  • 替换构造函数中的第一行

  • Replace 1st line in constructor

    this.application = application;
    

    作者

    super(application);
    

  • 删除此方法

  • Remove this method

    @Override
    protected Application delegate() {
        init();
        return application;
    }
    

  • 替换两次出现的

  • Replace two occurrences of

    application.getExpressionFactory()
    

    作者

    getWrapped().getExpressionFactory()
    

  • 编译它,您将获得两个类:WeldApplication.classWeldApplication$AdjustableELResolver.class.

    转到WildFly安装的/modules/system/layers/base/org/jboss/as/jsf-injection/main文件夹.

    Go to /modules/system/layers/base/org/jboss/as/jsf-injection/main folder of your WildFly installation.

    在那里将wildfly-jsf-injection-10.1.0.Final.jar解压缩.

    浏览并删除未压缩JAR的/org/jboss/as/jsf/injection/weld子文件夹中的所有三个WeldApplication***.class文件,然后将两个新编译的文件放在其中.

    Browse and remove all three WeldApplication***.class files in /org/jboss/as/jsf/injection/weld subfolder of the unzipped JAR, and put the two newly compiled files in there.

    将文件夹重新压缩到新的wildfly-jsf-injection-10.1.0.Final.jar中,以覆盖旧的文件夹.

    Rezip the folder into a new wildfly-jsf-injection-10.1.0.Final.jar, overriding the old one.

    利润.

    这篇关于为什么WildFly 10 + JSF 2.3无法与Omnifaces 2.6.1一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆