[ https://issues.apache.org/jira/browse/JAMES-4087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17912385#comment-17912385 ]
calelin commented on JAMES-4087: -------------------------------- The error suggests that the matcher named "relay-allowed" cannot be loaded when it's referenced inside another matcher. This might be due to how the matcher is registered or how it's being looked up. Here's a revised configuration approach: {code:xml} <matcher name="relay-allowed" match="org.apache.james.mailetcontainer.impl.matchers.Or"> <matcher match="SMTPAuthSuccessful"/> <matcher match="SMTPIsAuthNetwork"/> <matcher match="SentByMailet"/> <matcher match="org.apache.james.jmap.mailet.SentByJmap"/> </matcher> <!-- Directly define the 'should-check-spam' matcher using the 'Not' matcher --> <matcher name="should-check-spam" match="org.apache.james.mailetcontainer.impl.matchers.Not"> <matcher match="org.apache.james.mailetcontainer.impl.matchers.Or"> <matcher match="SMTPAuthSuccessful"/> <matcher match="SMTPIsAuthNetwork"/> <matcher match="SentByMailet"/> <matcher match="org.apache.james.jmap.mailet.SentByJmap"/> </matcher> </matcher> {code} > Combining composite matchers > ---------------------------- > > Key: JAMES-4087 > URL: https://issues.apache.org/jira/browse/JAMES-4087 > Project: James Server > Issue Type: Bug > Components: Mailet Contributions > Reporter: Tran Hong Quan > Priority: Minor > > Today chaining composite matcher is not possible: > ``` > + <matcher name="relay-allowed" > match="org.apache.james.mailetcontainer.impl.matchers.Or"> > + <matcher match="SMTPAuthSuccessful"/> > + <matcher match="SMTPIsAuthNetwork"/> > + <matcher match="SentByMailet"/> > + <matcher match="org.apache.james.jmap.mailet.SentByJmap"/> > + </matcher> > + <matcher name="should-check-spam" > match="org.apache.james.mailetcontainer.impl.matchers.Not"> > + <matcher match="relay-allowed"/> > + </matcher> > ``` > yields error: > `Fatal error while starting > James","context":"default","exception":"jakarta.mail.MessagingException: Can > not load matcher relay-allowed\n\tat > org.apache.james.utils.GuiceMatcherLoader.getMatcher(GuiceMatcherLoader.java:50)\n\tat` > Expectation: chaining composite matchers should be doable. > Also, I spotted that we have a `notmatch` tag in our code (beside traditional > `match` tag used), we should try to add a few tests for it to make sure it is > usable. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org