问题描述
简而言之,此问题是由于焊缝与JSF 1.2的不兼容所致,在将来的发行版中不会修复(请参见此处)。
我认为可以通过三种方式进行:
- 升级您的应用程序代码以与JSF 2.x一起使用。
- 必要时排除焊接子系统(可能需要重新配置wildfly的默认cdi设置)。
-
ConversationAwareViewHandler
适当地修补类,以在使用旧JSF API时采取不同的行动。
对我来说,只有一个选项可以修补JSF注入模块,因为无法进行应用程序升级,而选项2将需要对应用程序进行较大的重组。
解决方法
我目前正在将JSF-1.2应用程序迁移到Wildfly 8 Final,并被卡住了:(
首先,我已经阅读了很多有关问题的文章(例如https://community.jboss.org/message/845006或将JSF
1.2 Seam应用程序迁移到WildFly Beta
1),但是建议的解决方案(不包括焊接子系统)没有不为我工作。
我做了什么:
- 我在这里遵循了multi-jsf功能教程,并安装了JSF 1.2作为wildfly的模块(确切地说是3个模块)。
- 接下来是我将javax.faces.api和com.sun.jsf-impl(主插槽)的排除项以及与1.2插槽对应的依赖项添加到我的战争的jboss-deployment-structure.xml中。
- 由于该应用程序使用的是Tomahawk和Tomahawk Sandbox(我也在耳边进行部署),因此我也排除了主要插槽,并包括了用于这些部署的两个模块的1.2插槽。
我的问题:
-
当我尝试调用部署的初始页面(login.xhthml)时,出现以下错误,该错误是由插槽1.2中的模块’org.jboss.as.jsf-injection’引起的
错误[请求] UT005023:对/backoffice/login.faces的异常处理请求:java.lang.NoSuchMethodError:javax.faces.context.FacesContext.getAttributes()Ljava / util / Map;
[exec]在org.jboss.weld.jsf.ConversationAwareViewHandler.getActionURL(ConversationAwareViewHandler.java:103)
[exec]在javax.faces.application.ViewHandlerWrapper.getActionURL(ViewHandlerWrapper.java:147)
[exec]在com.sun.facelets.FaceletViewHandler.getActionURL(FaceletViewHandler.java:807)
[exec] at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer.getActionUrl(HtmlRenderer.java:77)
[exec] at org.apache.myfaces.custom.form.HtmlFormRenderer.getActionUrl(HtmlFormRenderer.java:45)
[exec] at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlFormRendererBase.encodeBegin(HtmlFormRendererBase.java:102)
[exec] at org.apache.myfaces.custom.form.HtmlFormRenderer.encodeBegin(HtmlFormRenderer.java:134)
javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:816)上的[exec]
javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)上的[exec]
javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)上的[exec]
[exec]在com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:594)
[exec]在com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
[exec] com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
[exec]在com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
[exec]在javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
[exec]在io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
[exec]在io.undertow.servlet.handlers.FilterHandler $ FilterChainImpl.doFilter(FilterHandler.java:130)
[exec]在com.jamonapi.JAMonFilter.doFilter(JAMonFilter.java:57)
[exec]在io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56)
[exec]在io.undertow.servlet.handlers.FilterHandler $ FilterChainImpl.doFilter(FilterHandler.java:132)
[exec]在org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:190)
[exec]在io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56)
[exec]在io.undertow.servlet.handlers.FilterHandler $ FilterChainImpl.doFilter(FilterHandler.java:132)
[exec]在org.apache.myfaces.custom.conversation.ConversationServletFilter.doFilter(ConversationServletFilter.java:78)
[exec]在io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56)
[exec]在io.undertow.servlet.handlers.FilterHandler $ FilterChainImpl.doFilter(FilterHandler.java:132)
[exec]在org.apache.myfaces.custom.requestParameterProvider.RequestParameterServletFilter.doFilter(RequestParameterServletFilter.java:66)
[exec]在io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56)
[exec]在io.undertow.servlet.handlers.FilterHandler $ FilterChainImpl.doFilter(FilterHandler.java:132)
[exec]位于de.voebzvd.indra.backoffice.webapp.AvoidCachingFilter.doFilter(AvoidCachingFilter.java:53)
[exec]在io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56)
[exec]在io.undertow.servlet.handlers.FilterHandler $ FilterChainImpl.doFilter(FilterHandler.java:132)
[exec]在org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:188)
[exec]在io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56)
[exec]在io.undertow.servlet.handlers.FilterHandler $ FilterChainImpl.doFilter(FilterHandler.java:132)
[exec]位于de.voebzvd.logging.BaseFilter.doFilter(BaseFilter.java:44)
[exec]在io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56)
[exec]在io.undertow.servlet.handlers.FilterHandler $ FilterChainImpl.doFilter(FilterHandler.java:132)
[exec]位于de.voebzvd.logging.NDCFilter.doFilter(NDCFilter.java:50)
[exec]在io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56)
[exec]在io.undertow.servlet.handlers.FilterHandler $ FilterChainImpl.doFilter(FilterHandler.java:132)
[exec]在io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
[exec]在io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
[exec]在io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
[exec]在org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
[exec]在io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
[exec]在io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113)
[exec]在io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52)
[exec]在io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
[exec]在io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)
[exec]在io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
[exec]在io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
[exec]在io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
[exec] org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
[exec]在io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
[exec]在io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
[exec]在io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)
[exec]在io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
[exec]在io.undertow.servlet.handlers.ServletInitialHandler.access $ 000(ServletInitialHandler.java:73)
[exec]在io.undertow.servlet.handlers.ServletInitialHandler $ 1.handleRequest(ServletInitialHandler.java:146)
[exec]在io.undertow.server.Connectors.executeRootHandler(Connectors.java:168)
[exec]在io.undertow.server.HttpServerExchange $ 1.run(HttpServerExchange.java:687)
[exec]在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[exec] at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)
[exec]在java.lang.Thread.run(Thread.java:744)
该错误是由ConversationAwareViewHandler引起的,它包含在模块org.jboss.as.jsf-injection中的jar
weld-core-jsf-2.1.2.Final.jar中,该模块也与JSF 1.2模块一起安装。该类仍引用JSF 2.2 API,因此失败。
从战斧排除焊接子系统,我的战争也没有奏效。我尝试了这个:
<sub-deployment name="myfaces-tomahawk-core.jar">
<exclude-subsystems>
<subsystem name="weld" />
</exclude-subsystems>
<exclusions>
<module name="javax.faces.api" slot="main" />
<module name="com.sun.jsf-impl" slot="main" />
</exclusions>
<dependencies>
<module name="com.sun.jsf-impl" slot="1.2" />
<module name="javax.faces.api" slot="1.2" />
<module name="org.apache.commons.beanutils" />
<module name="org.apache.commons.lang" />
<module name="org.apache.commons.logging" />
</dependencies>
</sub-deployment>
<sub-deployment name="myfaces-tomahawk-sandbox.jar">
<exclude-subsystems>
<subsystem name="weld" />
</exclude-subsystems>
<exclusions>
<module name="javax.faces.api" slot="main" />
<module name="com.sun.jsf-impl" slot="main" />
</exclusions>
<dependencies>
<module name="com.sun.jsf-impl" slot="1.2" />
<module name="javax.faces.api" slot="1.2" />
<module name="org.apache.commons.beanutils" />
<module name="org.apache.commons.collections" />
<module name="org.apache.commons.lang" />
<module name="org.apache.commons.logging" />
</dependencies>
</sub-deployment>
<sub-deployment name="backoffice.war">
<exclude-subsystems>
<subsystem name="weld" />
</exclude-subsystems>
<exclusions>
<module name="javax.faces.api" slot="main" />
<module name="com.sun.jsf-impl" slot="main" />
</exclusions>
<dependencies>
<module name="com.sun.jsf-impl" slot="1.2" />
<module name="javax.faces.api" slot="1.2" />
<module name="net.sourceforge.jamonapi" />
<module name="org.apache.commons.beanutils" />
<module name="org.apache.commons.codec" />
<module name="org.apache.commons.lang" />
<module name="org.apache.commons.logging" />
</dependencies>
</sub-deployment>
我还能做什么?