[ 
https://issues.apache.org/jira/browse/JAMES-1317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119938#comment-13119938
 ] 

Michael Herrmann edited comment on JAMES-1317 at 10/4/11 7:49 AM:
------------------------------------------------------------------

Hi Norman, 

thank you very much for your quick reply. I followed your suggestion and added 
saveChanges() in the appropriate places:

    public void service(Mail mail) throws MessagingException {
        MailAddress from = new MailAddress((InternetAddress) 
mail.getMessage().getFrom()[0]);
        MailAddress to = new MailAddress((InternetAddress) 
mail.getMessage().getRecipients(Message.RecipientType.TO)[0]);
        if (to.getDomain().equals(mailserverConfiguration.getDefaultDomain())) {
            Conversation conversation = 
conversationService.getConversation(mail);

            InternetAddress[] recipients = 
conversation.getAliasB().getRecipients();
            logger.info("Rewriting recipients of mail " + 
mail.getMessage().getSubject() + " to " + Arrays.asList(recipients));
            mail.getMessage().setRecipients(Message.RecipientType.TO, 
recipients);

            String newFrom = conversation.getAliasA() + "@" + 
mailserverConfiguration.getDefaultDomain();
            logger.info("Rewriting sender of mail " + 
mail.getMessage().getSubject() + " from " + from + " to " + newFrom + ".");
            mail.getMessage().setFrom(new InternetAddress(newFrom));

            mail.getMessage().saveChanges();

            getMailetContext().sendMail(mail.getMessage());
            mail.setState(Mail.GHOST);
        } else if 
(!from.getDomain().equals(mailserverConfiguration.getDefaultDomain())) {
            String newFrom = 
conversationService.getConversation(mail).getAliasA().toString() + "@" + 
mailserverConfiguration.getDefaultDomain();
            logger.info("Rewriting sender of mail " + 
mail.getMessage().getSubject() + " from " + from + " to " + newFrom + ".");
            mail.getMessage().setFrom(new InternetAddress(newFrom));
            mail.getMessage().saveChanges();
        }
    }

Unfortunately, I still get the same symptoms. 

One thing I noticed from repeated runs is that it always seem to be exactly 8 
threads that hang in the service()-method of our AliasingMailet. Is that any 
hint?

Thanks again!
Michael
                
      was (Author: mherrmann):
    Hi Norman, 

thank you very much for your quick reply. I followed your suggestion and added 
saveChanges() in the appropriate places:

    public void service(Mail mail) throws MessagingException {
            MailAddress from = new MailAddress((InternetAddress) 
mail.getMessage().getFrom()[0]);
            MailAddress to = new MailAddress((InternetAddress) 
mail.getMessage().getRecipients(Message.RecipientType.TO)[0]);
            if 
(to.getDomain().equals(mailserverConfiguration.getDefaultDomain())) {
                Conversation conversation = 
conversationService.getConversation(mail);

                InternetAddress[] recipients = 
conversation.getAliasB().getRecipients();
                logger.info("Rewriting recipients of mail " + 
mail.getMessage().getSubject() + " to " + Arrays.asList(recipients));
                mail.getMessage().setRecipients(Message.RecipientType.TO, 
recipients);

                String newFrom = conversation.getAliasA() + "@" + 
mailserverConfiguration.getDefaultDomain();
                logger.info("Rewriting sender of mail " + 
mail.getMessage().getSubject() + " from " + from + " to " + newFrom + ".");
                mail.getMessage().setFrom(new InternetAddress(newFrom));

                mail.getMessage().saveChanges();

                getMailetContext().sendMail(mail.getMessage());
                mail.setState(Mail.GHOST);
            } else if 
(!from.getDomain().equals(mailserverConfiguration.getDefaultDomain())) {
                String newFrom = 
conversationService.getConversation(mail).getAliasA().toString() + "@" + 
mailserverConfiguration.getDefaultDomain();
                logger.info("Rewriting sender of mail " + 
mail.getMessage().getSubject() + " from " + from + " to " + newFrom + ".");
                mail.getMessage().setFrom(new InternetAddress(newFrom));
                mail.getMessage().saveChanges();
            }
    }

Unfortunately, I still get the same symptoms. 

One thing I noticed from repeated runs is that it always seem to be exactly 8 
threads that hang in the service()-method of our AliasingMailet. Is that any 
hint?

Thanks again!
Michael
                  
> Mail spooled but not processed
> ------------------------------
>
>                 Key: JAMES-1317
>                 URL: https://issues.apache.org/jira/browse/JAMES-1317
>             Project: JAMES Server
>          Issue Type: Bug
>          Components: SpoolManager & Processors
>    Affects Versions: 3.0-M1, 3.0-M2, 3.0-beta3
>            Reporter: Raju Buchi
>            Priority: Critical
>             Fix For: 3.0-beta4
>
>         Attachments: Dump.txt, jstack.zip, logs.zip
>
>
> Mails sent to James server are spooled but they are not processed and sent 
> out.
> The issue is similar to the one faced by Zach.
> The server seems to be working fine for a few hours or few days, but some 
> time all the mails are spooled but they will not be processed and sent out. 
> Restarted the server several times and some time a few of the mails will be 
> processed and all the others are lost.
> As Norman suggested I have took a jstack trace. 
> Please let me how we can resolve this issue
> Thanks
> - Raju

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to