Re: Could not rewrite recipient?
Thanks Benoit for your assistance and response. I am happy to help test and report issues with James and will look into downloading the source code and compiling/installing the fixed version as soon as I can... Marc.. On 01/29/2019 08:09 PM, Benoit Tellier wrote: > Wouldn't you mind building the fixed version of James and see if this > solves your issue? > > Thanks for the very valuable feedbacks! > > Cheers, > > Benoit -- Linux Counter
Re: Could not rewrite recipient?
Hi Marc, I will have a closer look to your issue. Let me expose my thoughts below... 1. The quick fix... To quickly solve your problem, in the case you are not interested by address rewrites, just remove the `RecipientRewriteTable` from recipientrewritetable.xml... 2. My analysis of the problem... - Apache James uses JPA to query SQL database in a generic fashion - Unit tests are written on top of an embedded derby database - This very query is quite complex and work like a charm on derby - But very sadly you tend to prove that it fails on top of MariaDB - SQL syntax corner cases might be involved here... For the record, here is how the JPA query looks like: @NamedQuery(name = "selectExactMappings", query = "SELECT rrt FROM JamesRecipientRewrite rrt WHERE (rrt.user LIKE :user) and (rrt.domain like :domain) ORDER BY rrt.domain DESC") It is very true that we miss manual and automated testing against other databases. Contributions are more than welcomed on this! Now that this is said, a quick fix would be to write less 'optimized code' generating more queries but with a simpler syntax that would be more portable. Once again, I worked on a fix... JIRA: https://issues.apache.org/jira/browse/JAMES-2655 FIX: https://github.com/linagora/james-project/pull/2145 Hope this solves your problem... Wouldn't you mind building the fixed version of James and see if this solves your issue? Thanks for the very valuable feedbacks! Cheers, Benoit On 1/26/19 10:36 AM, Marc Chamberlin wrote: > I have no way to grok what the intent is, nor the details of what this > query is expecting in the database, but upon a first look through the > SQL documentation I changed this query by putting quotes around the > question marks '?' in the LIKE clauses and MariaDB accepted it. i.e. - > > SELECT t0.DOMAIN_NAME, t0.USER_NAME, t0.TARGET_ADDRESS FROM > JAMES_RECIPIENT_REWRITE t0 WHERE (t0.USER_NAME LIKE '?' ESCAPE '\\' AND > t0.DOMAIN_NAME LIKE '?' ESCAPE '\\') ORDER BY t0.DOMAIN_NAME DESC; > > This is just a guess on my part, but me thinks this might be a bug in > how Apache James is constructing this query? Marc... > > > On 01/25/2019 01:25 PM, Marc Chamberlin wrote: >> SELECT t0.DOMAIN_NAME, t0.USER_NAME, t0.TARGET_ADDRESS FROM >> JAMES_RECIPIENT_REWRITE t0 WHERE (t0.USER_NAME LIKE ? ESCAPE '\\' AND >> t0.DOMAIN_NAME LIKE ? ESCAPE '\\') ORDER BY t0.DOMAIN_NAME DESC; > > - To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org For additional commands, e-mail: server-user-h...@james.apache.org
Re: Could not rewrite recipient?
I have no way to grok what the intent is, nor the details of what this query is expecting in the database, but upon a first look through the SQL documentation I changed this query by putting quotes around the question marks '?' in the LIKE clauses and MariaDB accepted it. i.e. - SELECT t0.DOMAIN_NAME, t0.USER_NAME, t0.TARGET_ADDRESS FROM JAMES_RECIPIENT_REWRITE t0 WHERE (t0.USER_NAME LIKE '?' ESCAPE '\\' AND t0.DOMAIN_NAME LIKE '?' ESCAPE '\\') ORDER BY t0.DOMAIN_NAME DESC; This is just a guess on my part, but me thinks this might be a bug in how Apache James is constructing this query? Marc... On 01/25/2019 01:25 PM, Marc Chamberlin wrote: > SELECT t0.DOMAIN_NAME, t0.USER_NAME, t0.TARGET_ADDRESS FROM > JAMES_RECIPIENT_REWRITE t0 WHERE (t0.USER_NAME LIKE ? ESCAPE '\\' AND > t0.DOMAIN_NAME LIKE ? ESCAPE '\\') ORDER BY t0.DOMAIN_NAME DESC; -- Linux Counter
Re: Could not rewrite recipient?
Thanks Garry, looks like some sort of syntax error is occurring. Interesting thing is I set up the mariadb server to log all queries and statements and I am seeing a lot of things coming in from the James server, but not the particular statement that is causing problems... Applying the statement directly by hand, while logged in to the database server as James, this is what is happening - MariaDB [mail]> SELECT t0.DOMAIN_NAME, t0.USER_NAME, t0.TARGET_ADDRESS FROM JAMES_RECIPIENT_REWRITE t0 WHERE (t0.USER_NAME LIKE ? ESCAPE '\\' AND t0.DOMAIN_NAME LIKE ? ESCAPE '\\') ORDER BY t0.DOMAIN_NAME DESC; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? ESCAPE '\\' AND t0.DOMAIN_NAME LIKE ? ESCAPE '\\') ORDER BY t0.DOMAIN_NAME DES' at line 1 Maybe an expert pair of SQL eyes can see what is wrong faster than I can do a search through the documentation, in order to figure out what is exactly wrong with this MySQL query.. I am by no means an expert at SQL syntax!! ;-) Marc On 1/25/19 9:11 AM, Garry Hurley wrote: okay, well, that aside, the problem is in the domain name being passed. Pull the query out of the error message and try to run it against your database (logged in using the same user credentials that james connects with). My thoughts are that either your domain name that is passed contains an invalid character or is null, or that the table is either not readable by james or does not contain any values that match. - To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org For additional commands, e-mail: server-user-h...@james.apache.org
Re: Could not rewrite recipient?
okay, well, that aside, the problem is in the domain name being passed. Pull the query out of the error message and try to run it against your database (logged in using the same user credentials that james connects with). My thoughts are that either your domain name that is passed contains an invalid character or is null, or that the table is either not readable by james or does not contain any values that match. Sent from my iPhone > On Jan 25, 2019, at 11:09 AM, Marc Chamberlin wrote: > > Garry - the mydomain.com isn't my actual domain name, I obfuscated it in > the walkback messages as I do not want it to be probed until I am > satisfied things are secure.. ;-) Marc.. > >> On 01/25/2019 07:36 AM, Garry Hurley wrote: >> This is going to sound patronizing, but inthe ‘caused by’ section it says it >> could not set your domain and the value was ‘mydomain.com’. If you actually >> registered that domain, you need to smack your registrar a few times with a >> rather large trout. My suggestion is to replace that domain with your ACTUAL >> domain in the config files. >> >> Sent from my iPhone >> >>> On Jan 24, 2019, at 11:27 PM, Marc Chamberlin >>> wrote: >>> >>> I am trying to configure and set up a new Apache James 3.2.0 email >>> server and running into troubles getting it to work, though I think I am >>> close. I am not sure what all info I need to provide so feel free to ask >>> for more... The server is coming up and running but when I try to send >>> an email through it, the client seems to think all goes well but the >>> james.server.log file is showing bad things... And nothing is being >>> received through the IMAP side... So can a kind guru decipher this stack >>> walkback and give me a clue on how to fix and make James a happy camper? >>> I won't show the entire stack walkback just what I think are the >>> highlights, but if anyone wants the whole thing I certainly can provide >>> it. Thanks in advance... Marc >>> >>> >>> INFO 20:02:43,990 | >>> org.apache.james.metrics.logger.DefaultMetricFactory | Time spent in >>> IMAP-NOOP: 0 ms. >>> INFO 20:02:44,008 | >>> org.apache.james.metrics.logger.DefaultMetricFactory | Time spent in >>> IMAP-GETQUOTAROOT: 1 ms. >>> INFO 20:02:44,048 | >>> org.apache.james.metrics.logger.DefaultMetricFactory | Time spent in >>> IMAP-IDLE: 1 ms. >>> INFO 20:03:39,582 | >>> org.apache.james.protocols.netty.BasicChannelUpstreamHandler | >>> Connection established from 10.10.10.1 >>> INFO 20:03:39,963 | org.apache.james.smtpserver.SendMailHandler | >>> Successfully spooled mail >>> Mail1548389019876-bafd9328-095e-4b22-8a2e-d4c18fb74522 from >>> MaybeSender{mailAddress=Optional[myn...@mydomain.com]} on >>> 10.10.10.1/10.10.10.1 for [myn...@mydomain.com] >>> INFO 20:03:39,978 | >>> org.apache.james.protocols.netty.BasicChannelUpstreamHandler | >>> Connection closed for 10.10.10.1 >>> WARN 20:03:39,996 | >>> org.apache.james.transport.mailets.RecipientRewriteTableProcessor | >>> Could not rewrite recipient myn...@mydomain.com >>> org.apache.james.rrt.api.RecipientRewriteTableException: Error while >>> retrieve mappings >>>at >>> org.apache.james.rrt.jpa.JPARecipientRewriteTable.getMapping(JPARecipientRewriteTable.java:107) >>>at >>> org.apache.james.rrt.jpa.JPARecipientRewriteTable.mapAddress(JPARecipientRewriteTable.java:79) >>>at >>> org.apache.james.rrt.lib.AbstractRecipientRewriteTable.getMappings(AbstractRecipientRewriteTable.java:110) >>>at >>> org.apache.james.rrt.lib.AbstractRecipientRewriteTable.getMappings(AbstractRecipientRewriteTable.java:99) >>>at >>> org.apache.james.transport.mailets.RecipientRewriteTableProcessor.executeRrtForRecipient(RecipientRewriteTableProcessor.java:164) >>>at >>> org.apache.james.transport.mailets.RecipientRewriteTableProcessor.lambda$executeRrtFor$1(RecipientRewriteTableProcessor.java:153) >>>at >>> java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) >>>at java.util.Collections$2.tryAdvance(Collections.java:4717) >>>at java.util.Collections$2.forEachRemaining(Collections.java:4725) >>>at >>> java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) >>>at >>> java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) >>>at >>> java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) >>>at >>> java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) >>>at >>> java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:474) >>>at >>> org.apache.james.transport.mailets.RecipientRewriteTableProcessor.executeRrtFor(RecipientRewriteTableProcessor.java:159) >>>at >>> org.apache.james.transport.mailets.RecipientRewriteTableProcessor.processMail(RecipientRewriteTableProcessor.java:129) >>>at >>> org.apache.james.transport.mailets.RecipientRewriteTable.service(RecipientRewriteTable.java:88) >>>
Re: Could not rewrite recipient?
Garry - the mydomain.com isn't my actual domain name, I obfuscated it in the walkback messages as I do not want it to be probed until I am satisfied things are secure.. ;-) Marc.. On 01/25/2019 07:36 AM, Garry Hurley wrote: > This is going to sound patronizing, but inthe ‘caused by’ section it says it > could not set your domain and the value was ‘mydomain.com’. If you actually > registered that domain, you need to smack your registrar a few times with a > rather large trout. My suggestion is to replace that domain with your ACTUAL > domain in the config files. > > Sent from my iPhone > >> On Jan 24, 2019, at 11:27 PM, Marc Chamberlin >> wrote: >> >> I am trying to configure and set up a new Apache James 3.2.0 email >> server and running into troubles getting it to work, though I think I am >> close. I am not sure what all info I need to provide so feel free to ask >> for more... The server is coming up and running but when I try to send >> an email through it, the client seems to think all goes well but the >> james.server.log file is showing bad things... And nothing is being >> received through the IMAP side... So can a kind guru decipher this stack >> walkback and give me a clue on how to fix and make James a happy camper? >> I won't show the entire stack walkback just what I think are the >> highlights, but if anyone wants the whole thing I certainly can provide >> it. Thanks in advance... Marc >> >> >> INFO 20:02:43,990 | >> org.apache.james.metrics.logger.DefaultMetricFactory | Time spent in >> IMAP-NOOP: 0 ms. >> INFO 20:02:44,008 | >> org.apache.james.metrics.logger.DefaultMetricFactory | Time spent in >> IMAP-GETQUOTAROOT: 1 ms. >> INFO 20:02:44,048 | >> org.apache.james.metrics.logger.DefaultMetricFactory | Time spent in >> IMAP-IDLE: 1 ms. >> INFO 20:03:39,582 | >> org.apache.james.protocols.netty.BasicChannelUpstreamHandler | >> Connection established from 10.10.10.1 >> INFO 20:03:39,963 | org.apache.james.smtpserver.SendMailHandler | >> Successfully spooled mail >> Mail1548389019876-bafd9328-095e-4b22-8a2e-d4c18fb74522 from >> MaybeSender{mailAddress=Optional[myn...@mydomain.com]} on >> 10.10.10.1/10.10.10.1 for [myn...@mydomain.com] >> INFO 20:03:39,978 | >> org.apache.james.protocols.netty.BasicChannelUpstreamHandler | >> Connection closed for 10.10.10.1 >> WARN 20:03:39,996 | >> org.apache.james.transport.mailets.RecipientRewriteTableProcessor | >> Could not rewrite recipient myn...@mydomain.com >> org.apache.james.rrt.api.RecipientRewriteTableException: Error while >> retrieve mappings >> at >> org.apache.james.rrt.jpa.JPARecipientRewriteTable.getMapping(JPARecipientRewriteTable.java:107) >> at >> org.apache.james.rrt.jpa.JPARecipientRewriteTable.mapAddress(JPARecipientRewriteTable.java:79) >> at >> org.apache.james.rrt.lib.AbstractRecipientRewriteTable.getMappings(AbstractRecipientRewriteTable.java:110) >> at >> org.apache.james.rrt.lib.AbstractRecipientRewriteTable.getMappings(AbstractRecipientRewriteTable.java:99) >> at >> org.apache.james.transport.mailets.RecipientRewriteTableProcessor.executeRrtForRecipient(RecipientRewriteTableProcessor.java:164) >> at >> org.apache.james.transport.mailets.RecipientRewriteTableProcessor.lambda$executeRrtFor$1(RecipientRewriteTableProcessor.java:153) >> at >> java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) >> at java.util.Collections$2.tryAdvance(Collections.java:4717) >> at java.util.Collections$2.forEachRemaining(Collections.java:4725) >> at >> java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) >> at >> java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) >> at >> java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) >> at >> java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) >> at >> java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:474) >> at >> org.apache.james.transport.mailets.RecipientRewriteTableProcessor.executeRrtFor(RecipientRewriteTableProcessor.java:159) >> at >> org.apache.james.transport.mailets.RecipientRewriteTableProcessor.processMail(RecipientRewriteTableProcessor.java:129) >> at >> org.apache.james.transport.mailets.RecipientRewriteTable.service(RecipientRewriteTable.java:88) >> at >> org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:81) >> at >> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.handleMailet(CamelMailetProcessor.java:178) >> at >> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.lambda$configure$0(CamelMailetProcessor.java:155) >> >> yada yada yada - some walkback messages deleted here >> >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) >>
Re: Could not rewrite recipient?
This is going to sound patronizing, but inthe ‘caused by’ section it says it could not set your domain and the value was ‘mydomain.com’. If you actually registered that domain, you need to smack your registrar a few times with a rather large trout. My suggestion is to replace that domain with your ACTUAL domain in the config files. Sent from my iPhone > On Jan 24, 2019, at 11:27 PM, Marc Chamberlin wrote: > > I am trying to configure and set up a new Apache James 3.2.0 email > server and running into troubles getting it to work, though I think I am > close. I am not sure what all info I need to provide so feel free to ask > for more... The server is coming up and running but when I try to send > an email through it, the client seems to think all goes well but the > james.server.log file is showing bad things... And nothing is being > received through the IMAP side... So can a kind guru decipher this stack > walkback and give me a clue on how to fix and make James a happy camper? > I won't show the entire stack walkback just what I think are the > highlights, but if anyone wants the whole thing I certainly can provide > it. Thanks in advance... Marc > > > INFO 20:02:43,990 | > org.apache.james.metrics.logger.DefaultMetricFactory | Time spent in > IMAP-NOOP: 0 ms. > INFO 20:02:44,008 | > org.apache.james.metrics.logger.DefaultMetricFactory | Time spent in > IMAP-GETQUOTAROOT: 1 ms. > INFO 20:02:44,048 | > org.apache.james.metrics.logger.DefaultMetricFactory | Time spent in > IMAP-IDLE: 1 ms. > INFO 20:03:39,582 | > org.apache.james.protocols.netty.BasicChannelUpstreamHandler | > Connection established from 10.10.10.1 > INFO 20:03:39,963 | org.apache.james.smtpserver.SendMailHandler | > Successfully spooled mail > Mail1548389019876-bafd9328-095e-4b22-8a2e-d4c18fb74522 from > MaybeSender{mailAddress=Optional[myn...@mydomain.com]} on > 10.10.10.1/10.10.10.1 for [myn...@mydomain.com] > INFO 20:03:39,978 | > org.apache.james.protocols.netty.BasicChannelUpstreamHandler | > Connection closed for 10.10.10.1 > WARN 20:03:39,996 | > org.apache.james.transport.mailets.RecipientRewriteTableProcessor | > Could not rewrite recipient myn...@mydomain.com > org.apache.james.rrt.api.RecipientRewriteTableException: Error while > retrieve mappings > at > org.apache.james.rrt.jpa.JPARecipientRewriteTable.getMapping(JPARecipientRewriteTable.java:107) > at > org.apache.james.rrt.jpa.JPARecipientRewriteTable.mapAddress(JPARecipientRewriteTable.java:79) > at > org.apache.james.rrt.lib.AbstractRecipientRewriteTable.getMappings(AbstractRecipientRewriteTable.java:110) > at > org.apache.james.rrt.lib.AbstractRecipientRewriteTable.getMappings(AbstractRecipientRewriteTable.java:99) > at > org.apache.james.transport.mailets.RecipientRewriteTableProcessor.executeRrtForRecipient(RecipientRewriteTableProcessor.java:164) > at > org.apache.james.transport.mailets.RecipientRewriteTableProcessor.lambda$executeRrtFor$1(RecipientRewriteTableProcessor.java:153) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at java.util.Collections$2.tryAdvance(Collections.java:4717) > at java.util.Collections$2.forEachRemaining(Collections.java:4725) > at > java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at > java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) > at > java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) > at > java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:474) > at > org.apache.james.transport.mailets.RecipientRewriteTableProcessor.executeRrtFor(RecipientRewriteTableProcessor.java:159) > at > org.apache.james.transport.mailets.RecipientRewriteTableProcessor.processMail(RecipientRewriteTableProcessor.java:129) > at > org.apache.james.transport.mailets.RecipientRewriteTable.service(RecipientRewriteTable.java:88) > at > org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:81) > at > org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.handleMailet(CamelMailetProcessor.java:178) > at > org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.lambda$configure$0(CamelMailetProcessor.java:155) > > yada yada yada - some walkback messages deleted here > > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at java.lang.Thread.run(Thread.java:748) > Caused by: > org.apache.openjpa.persistence.PersistenceException: Could not set > parameter at position 2 (values was 'mydomain.com') > Query - conn:47(M) - "SELECT t0.DOMAIN_NAME, t0.USER_NAME, > t0.TARGET_ADDRESS FROM JAMES_RECIPIENT_REWRITE t0 WHERE (t0.USER_NAME >