Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-15572

[GSS](7.2.z) Getting Unable to find unambiguous method when Calling an Enum function from JSF page

    XMLWordPrintable

    Details

    • Target Release:
    • Steps to Reproduce:
      Hide

      Using the application attached:

      1. Build for EAP 7.1.4:

      Error page with the problematic no unambiguous function is shown

      2. Build for EAP 6.4.21:

      "PersonLeistung-2" is shown on page, no error

      Show
      Using the application attached: 1. Build for EAP 7.1.4: mvn clean install Copy ticket-webapp-1.0-SNAPSHOT.war to deployments-folder in JBoss 7.1.4 Start server In browser call _ http://localhost:8080/ticket-webapp-1.0-SNAPSHOT/suche.jsf_ Error page with the problematic no unambiguous function is shown 2. Build for EAP 6.4.21: mvn clean install -f pom6.xml Copy ticket-webapp-1.0-SNAPSHOT.war to deployments-folder in JBoss6.4.21 Start server In browser call _ http://localhost:8080/ticket-webapp-1.0-SNAPSHOT/suche.jsf_ "PersonLeistung-2" is shown on page, no error

      Description

      On JBoss EAP 7.0.9, EAP 7.1.4 and EAP 7.2-beta the application is getting the error [i.] and the same code doesn't get the error running on JBoss EAP 6.4.21. In my research, I could identify that this error only happens on JBoss EAP 7.1.4 when:

      1. The class called from the EL has a superclass;
      2. The method called from the EL use an Enum as a parameter;

      Note: If we remove the superclass or change the parameter to "String" for example, the error doesn't appear.

      Code

      a. The EL code:

      	<f:view>
      		<h:dataTable value="#{asfSfoSalesSucheQuery.asfLeistung}" var="leistung">
      			<h:column>
      				<f:facet name="header">
      					<h:outputText value="nameS" />
      				</f:facet>
      				<h:outputText value="#{leistung.getPersonendatum('ANTRAGSTELLER_1_DOMIZIL').nameS}" />
      			</h:column>
      		</h:dataTable>
      	</f:view>
      

      b. The Superclass:

      package de.entity;
      
      import de.constants.PartnerdatenId;
      
      public abstract class Leistung {
          abstract PersonDetails getPersonendatum(PartnerdatenId idPsn);
      }
      

      c. The implementation:

      package de.entity;
      
      import de.constants.PartnerdatenId;
      
      import java.util.HashMap;
      import java.util.Map;
      
      public class AsfLeistung extends Leistung {
      	
          private Map<PartnerdatenId, PersonLeistung> personenDaten = new HashMap<PartnerdatenId, PersonLeistung>();
      
          public AsfLeistung(String name, PartnerdatenId partnerdatenId) {
              PersonLeistung personLeistung = new PersonLeistung(name);
              personenDaten.put(partnerdatenId, personLeistung);
          }
      
          public PersonLeistung getPersonendatum(PartnerdatenId idPsn) {
              return personenDaten.get(idPsn);
          }
      }
      

      Debugging the jboss-el-api_3.0_spec-1.0.9.Final-redhat-1 code I found that:

      a. The Line 572, List<Wrapper> wrappers = Wrapper.wrap(constructors); is returning 2 wrappers when we have a superclass;

      b. The method *findWrapper(Class<?> clazz, List<Wrapper> wrappers, String name, Class<?>[] paramTypes, Object[] paramValues)

      {...}* throw the exeception because it doesn't match a method.

      c. The method *private static Wrapper resolveAmbiguousWrapper(Set<Wrapper> candidates, Class<?>[] paramTypes) {...}

      * can't find a match and resolve the Ambiguous Wrapper. *(Note that the ambiguous wrapper is happening because we have a superclass if we remove the superclass this method is not called)
      *
      d. I don't know why the EL code from JBoss EAP 6.4.21 is able to resolve the method with the Enum parameter even the XHTML page sending a string, and the JBoss EAP 7.1.4 don't.

      Note: Also, I can't find any extra information on the Release notes and I found the same behavior on EAP 7.0.x

      Note 2: I got the same error, even adding the Enum to the ELProcessor.

      import javax.annotation.PostConstruct;
      import javax.ejb.Singleton;
      import javax.el.ELManager;
      import javax.el.ELProcessor;
      
      @Singleton
      @javax.ejb.Startup
      public class Startup {
      
      	@PostConstruct
      	public void init() {
      	    ELProcessor elp = new ELProcessor();
      	    ELManager elm =  elp.getELManager();
      	    elm.importClass("de.constants.PartnerdatenId");
      	    
      	    elp.eval("PartnerdatenId.ANTRAGSTELLER_1_DOMIZIL");
      	}
      	
      }
      

      [i] Error

      {{javax.servlet.ServletException: Unable to find unambiguous method: class de.entity.AsfLeistung.getPersonendatum(java.lang.String)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
      at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
      at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
      at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:65)
      at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
      at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
      at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
      at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
      at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
      at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
      at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
      at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
      at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
      at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
      at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
      at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
      at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
      at io.undertow.server.Connectors.executeRootHandler(Connectors.java:330)
      at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:812)
      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)
      Caused by: javax.el.MethodNotFoundException: Unable to find unambiguous method: class de.entity.AsfLeistung.getPersonendatum(java.lang.String)
      at javax.el.Util.findWrapper(Util.java:322)
      at javax.el.Util.findMethod(Util.java:203)
      at javax.el.ELUtil.findMethod(ELUtil.java:295)
      at javax.el.BeanELResolver.invoke(BeanELResolver.java:405)
      at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
      at com.sun.el.parser.AstValue.getValue(AstValue.java:135)
      at com.sun.el.parser.AstValue.getValue(AstValue.java:203)
      at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
      at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
      at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
      at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
      at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
      at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
      at javax.faces.component.UIOutput.getValue(UIOutput.java:174)
      at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
      at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
      at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:920)
      at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)
      at com.sun.faces.renderkit.html_basic.TableRenderer.renderRow(TableRenderer.java:385)
      at com.sun.faces.renderkit.html_basic.TableRenderer.encodeChildren(TableRenderer.java:161)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:890)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:135)
      at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
      at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
      ... 39 more}}

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              soul2zimate Chao Wang
              Reporter:
              pedroho.silva Pedro Silva
              Tester:
              Daniel Cihak Daniel Cihak
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: