Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4614

Print error message when action method not found

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.1
    • 4.0.2, 2.3-next-M9, 4.1.0-RC1
    • General
    • None

    Description

      Given the following example (also attached), where the number of method parameters does not match and the method cannot be called, an exception should be thrown.

      XHTML:

      <h:form id="frmTest">
          <p:commandButton value="Click"
                           action="#{testView.onClick}"/>
      </h:form> 

      Java:

      public void onClick(Object parameter) {
          System.out.println("Button clicked");
      } 

      MyFaces does not throw an exception, while Mojarra throws:

      Juli 12, 2023 1:44:32 PM com.sun.faces.lifecycle.InvokeApplicationPhase execute
      WARNUNG: #{testView.onClick}: /test.xhtml @17,60 action="#{testView.onClick}": Method not found: TestView(string=Welcome to PrimeFaces!!!, integer=null, decimal=null, localDateTime=null, list=[TestObject(id=8e4d3985-c2f7-47dc-a5de-7e51acc41ec1, name=Thriller, artist=Michael Jackson, released=1982), TestObject(id=93adce20-fadb-4e8a-b16b-72eb9d03ae0e, name=Back in Black, artist=AC/DC, released=1980), TestObject(id=93e267a0-d6f9-4303-a82b-51ef16f88b02, name=The Bodyguard, artist=Whitney Houston, released=1992), TestObject(id=29ebc993-d665-47ec-844f-c14a34dc0554, name=The Dark Side of the Moon, artist=Pink Floyd, released=1973)]).onClick()
      jakarta.faces.FacesException: #{testView.onClick}: /test.xhtml @17,60 action="#{testView.onClick}": Method not found: TestView(string=Welcome to PrimeFaces!!!, integer=null, decimal=null, localDateTime=null, list=[TestObject(id=8e4d3985-c2f7-47dc-a5de-7e51acc41ec1, name=Thriller, artist=Michael Jackson, released=1982), TestObject(id=93adce20-fadb-4e8a-b16b-72eb9d03ae0e, name=Back in Black, artist=AC/DC, released=1980), TestObject(id=93e267a0-d6f9-4303-a82b-51ef16f88b02, name=The Bodyguard, artist=Whitney Houston, released=1992), TestObject(id=29ebc993-d665-47ec-844f-c14a34dc0554, name=The Dark Side of the Moon, artist=Pink Floyd, released=1973)]).onClick()
          at com.sun.faces.application.ActionListenerImpl.getNavigationOutcome(ActionListenerImpl.java:83)
          at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:62)
          at org.primefaces.application.DialogActionListener.processAction(DialogActionListener.java:54)
          at jakarta.faces.component.UICommand.broadcast(UICommand.java:205)
          at jakarta.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:858)
          at jakarta.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1332)
          at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:56)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:72)
          at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:159)
          at jakarta.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:691)
          at jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:449)
          at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1410)
          at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
          at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
          at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:170)
          at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
          at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
          at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
          at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
          at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
          at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
          at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
          at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
          at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303)
          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
          at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
          at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51)
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
          at org.eclipse.jetty.server.Server.handle(Server.java:563)
          at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
          at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
          at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
          at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
          at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
          at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
          at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
          at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416)
          at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385)
          at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)
          at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.produce(AdaptiveExecutionStrategy.java:194)
          at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
          at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
          at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
          at java.base/java.lang.Thread.run(Thread.java:833)
      Caused by: jakarta.el.MethodNotFoundException: /test.xhtml @17,60 action="#{testView.onClick}": Method not found: TestView(string=Welcome to PrimeFaces!!!, integer=null, decimal=null, localDateTime=null, list=[TestObject(id=8e4d3985-c2f7-47dc-a5de-7e51acc41ec1, name=Thriller, artist=Michael Jackson, released=1982), TestObject(id=93adce20-fadb-4e8a-b16b-72eb9d03ae0e, name=Back in Black, artist=AC/DC, released=1980), TestObject(id=93e267a0-d6f9-4303-a82b-51ef16f88b02, name=The Bodyguard, artist=Whitney Houston, released=1992), TestObject(id=29ebc993-d665-47ec-844f-c14a34dc0554, name=The Dark Side of the Moon, artist=Pink Floyd, released=1973)]).onClick()
          at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:74)
          at com.sun.faces.application.ActionListenerImpl.getNavigationOutcome(ActionListenerImpl.java:74)
          ... 49 moreJuli 12, 2023 1:44:32 PM com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseError
      SCHWERWIEGEND: jakarta.el.MethodNotFoundException: /test.xhtml @17,60 action="#{testView.onClick}": Method not found: TestView(string=Welcome to PrimeFaces!!!, integer=null, decimal=null, localDateTime=null, list=[TestObject(id=8e4d3985-c2f7-47dc-a5de-7e51acc41ec1, name=Thriller, artist=Michael Jackson, released=1982), TestObject(id=93adce20-fadb-4e8a-b16b-72eb9d03ae0e, name=Back in Black, artist=AC/DC, released=1980), TestObject(id=93e267a0-d6f9-4303-a82b-51ef16f88b02, name=The Bodyguard, artist=Whitney Houston, released=1992), TestObject(id=29ebc993-d665-47ec-844f-c14a34dc0554, name=The Dark Side of the Moon, artist=Pink Floyd, released=1973)]).onClick()
      jakarta.el.MethodNotFoundException: /test.xhtml @17,60 action="#{testView.onClick}": Method not found: TestView(string=Welcome to PrimeFaces!!!, integer=null, decimal=null, localDateTime=null, list=[TestObject(id=8e4d3985-c2f7-47dc-a5de-7e51acc41ec1, name=Thriller, artist=Michael Jackson, released=1982), TestObject(id=93adce20-fadb-4e8a-b16b-72eb9d03ae0e, name=Back in Black, artist=AC/DC, released=1980), TestObject(id=93e267a0-d6f9-4303-a82b-51ef16f88b02, name=The Bodyguard, artist=Whitney Houston, released=1992), TestObject(id=29ebc993-d665-47ec-844f-c14a34dc0554, name=The Dark Side of the Moon, artist=Pink Floyd, released=1973)]).onClick()
          at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:74)
          at com.sun.faces.application.ActionListenerImpl.getNavigationOutcome(ActionListenerImpl.java:74)
          at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:62)
          at org.primefaces.application.DialogActionListener.processAction(DialogActionListener.java:54)
          at jakarta.faces.component.UICommand.broadcast(UICommand.java:205)
          at jakarta.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:858)
          at jakarta.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1332)
          at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:56)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:72)
          at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:159)
          at jakarta.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:691)
          at jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:449)
          at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1410)
          at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
          at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
          at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:170)
          at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
          at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
          at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
          at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
          at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
          at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
          at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
          at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
          at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303)
          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
          at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
          at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51)
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
          at org.eclipse.jetty.server.Server.handle(Server.java:563)
          at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
          at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
          at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
          at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
          at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
          at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
          at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
          at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416)
          at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385)
          at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)
          at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.produce(AdaptiveExecutionStrategy.java:194)
          at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
          at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
          at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
          at java.base/java.lang.Thread.run(Thread.java:833) 

      What do you guys think?

      Attachments

        1. MYFACES-4614.zip
          9 kB
          Manuel K

        Activity

          People

            tandraschko Thomas Andraschko
            mkomko Manuel K
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: