Note that there are some explanatory texts on larger screens.

plurals
  1. POExceptions in actionMethods are packed inside PropertyNotFoundException
    primarykey
    data
    text
    <p>We are currently using the OmniFaces FullAjaxExceptionHandlerFactory to redirect any exceptions in the application to a general error page. This page then examines the exception and determines its type so that we can display a particular (and hopefully more helpful) message for certain known error cases.</p> <p>However, under certain circumstances all we get is a PropertyNotFoundException with no attached causes or details instead of the actual exception that the program throws. This thwarts my attempt to recognize known error cases.</p> <p>I figured out the circumstances under which this happens: I wrote a composite component that encapsulates an <code>h:commandLink</code>. To pass in the action method I used retargeting like so:</p> <pre><code>&lt;cc:attribute name="action" targets="link" required="true" /&gt; </code></pre> <p>and, accordingly, </p> <pre><code>&lt;h:commandLink id="link" value="test" /&gt; </code></pre> <p>This works fine, but as said above: If the action stumbles upon an exception during execution, this original exception will not be handed to the error page. Only a PropertyNotFoundException shows up and tells me, the action method could not be found - without any info about the actual problem.</p> <p>I tried to pass in the method in a different way, for example as</p> <pre><code>&lt;cc:attribute name="bean" required="true" /&gt; &lt;cc:attribute name="method" required="true" /&gt; &lt;cc:attribute name="param" /&gt; </code></pre> <p>and</p> <pre><code>&lt;h:commandLink id="link" value="test" action="#{cc.attrs.bean[cc.attrs.method](cc.attrs.param)}" /&gt; </code></pre> <p>In this case I get the right exceptions handed over, but the method fails for cases where the using page does not pass a param. A method like <code>doSomething()</code> will then not be found (IllegalArgumentException). However, I'd rather like to use one component throughout the application with or without parameters instead of forcing some workaround here for the different usages.</p> <p>Are there other ways to avoid the retargeting approach or can we change something, so that a retargeted method does not result in the unhelpful PropertyNotFoundExecption?</p> <p>EDIT: If possible, I'd prefer the retargeting, as it's less of an limitation to the use of the component. The above alternative for example would only allow for actions with one parameter. :/</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload