I'm currently migrating a JSF-1.2 app to Wildfly 8 Final and am stuck :(
First of all, I've read many post with related issues (e.g. https://community.jboss.org/message/845006 or Migrate JSF 1.2 Seam app to WildFly Beta 1) but the proposed solution (excluding the weld subsystem) doesn't work for me.
What I did:
- I followed the multi-jsf feature tutorial here and installed JSF 1.2 as a module for wildfly (to be exact, 3 modules).
- The next was that I added exclusions for javax.faces.api and com.sun.jsf-impl (main slots) as well as the corresponding dependencies to the 1.2 slots to my jboss-deployment-structure.xml for my war.
- Since the app is using Tomahawk and Tomahawk Sandbox which I am also deploying with my ear, I also excluded the main slots and included the 1.2 slots of both modules for these deployments.
My problem:
- When I try to call the initial page of the deployment (login.xhthml), I get the following error which is caused by the module 'org.jboss.as.jsf-injection' in slot 1.2
ERROR [request] UT005023: Exception handling request to /backoffice/login.faces: java.lang.NoSuchMethodError: javax.faces.context.FacesContext.getAttributes()Ljava/util/Map; [exec] at org.jboss.weld.jsf.ConversationAwareViewHandler.getActionURL(ConversationAwareViewHandler.java:103) [exec] at javax.faces.application.ViewHandlerWrapper.getActionURL(ViewHandlerWrapper.java:147) [exec] at 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) [exec] at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:816) [exec] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928) [exec] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933) [exec] at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:594) [exec] at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110) [exec] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) [exec] at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [exec] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) [exec] at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [exec] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) [exec] at com.jamonapi.JAMonFilter.doFilter(JAMonFilter.java:57) [exec] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [exec] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [exec] at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:190) [exec] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [exec] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [exec] at org.apache.myfaces.custom.conversation.ConversationServletFilter.doFilter(ConversationServletFilter.java:78) [exec] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [exec] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [exec] at org.apache.myfaces.custom.requestParameterProvider.RequestParameterServletFilter.doFilter(RequestParameterServletFilter.java:66) [exec] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [exec] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [exec] at de.voebzvd.indra.backoffice.webapp.AvoidCachingFilter.doFilter(AvoidCachingFilter.java:53) [exec] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [exec] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [exec] at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:188) [exec] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [exec] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [exec] at de.voebzvd.logging.BaseFilter.doFilter(BaseFilter.java:44) [exec] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [exec] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [exec] at de.voebzvd.logging.NDCFilter.doFilter(NDCFilter.java:50) [exec] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [exec] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [exec] at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [exec] at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [exec] at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [exec] at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78) [exec] at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [exec] at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [exec] at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [exec] at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [exec] at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [exec] at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [exec] at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [exec] at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [exec] at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61) [exec] at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [exec] at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [exec] at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [exec] at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [exec] at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [exec] at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [exec] at io.undertow.server.Connectors.executeRootHandler(Connectors.java:168) [exec] at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687) [exec] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [exec] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [exec] at java.lang.Thread.run(Thread.java:744)
The error is caused by the ConversationAwareViewHandler which is contained in the jar weld-core-jsf-2.1.2.Final.jar in module org.jboss.as.jsf-injection which I also installed with the JSF 1.2 modules. This Class still references JSF 2.2 API and fails accordingly.
Excluding the weld subsystem from tomahawk and my war did also not work. I tried this:
<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>
What can I do else?
To make it short, this problem is caused by an incompatibility of weld and JSF 1.2 that won't be fixed in future releases (see here).
In my opinion there are three ways one can go:
- Upgrade your application code to work with JSF 2.x.
- Exclude the weld subsystem where necessary (will likely require reconfiguring the default-cdi settings of wildfly).
- Patch the class
ConversationAwareViewHandler
appropriately to act differently in case of the old JSF API.
For me, there was only the option to patch the JSF-injection module since an application upgrade was not possible and option 2 would require a larger restructuring of the application.
来源:https://stackoverflow.com/questions/22758645/jsf-1-2-on-wildfly-8-final-weld-core-jsf-is-still-referencing-jsf-2-2-api