Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
I can understand why we need to use javamail since I have found the saveChanges at almost all mailets in James. org/apache/james/transport/mailets/AddHabeasWarrantMark.java: message.saveChanges(); org/apache/james/transport/mailets/LocalDelivery.java: localMessage.saveChanges(); org/apache/james/t

how to add user programatically ?

2005-12-30 Thread Paweł Jabłoński
Hello, How can I add user programatically ? Thanks for any advices :) Pawel

Setting different matcher based on domain

2005-12-30 Thread amossbarger
How do I set different matcher rules based upon the servername? In otherwords our James box has different names listed in the servernames tag and I need to be able to specify different matchers depending on which servername the mail came in on which won't neccessarily match the from address? Is

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
Sorry, I make amendments. I did the test using the mime4j java app using Swing GUI. But just now I used my mailet: public void mime4jService(Mail mail) throws MessagingException { MimeMessageWrapper mimeMessageWrapper = (MimeMessageWrapper) mail.getMessage(); try {

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Stefano Bagnara
Edward Tan wrote: > I have tried mime4j just now and I compared it with James that uses Javax > mail. Thank you for your tests! > So it seems a bit dangerous to use javax.mail since we will never know when > some emails will go to error folder because of OutOfMemory. Mime4j let us only to read m

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
I have tried mime4j just now and I compared it with James that uses Javax mail. For the same 30+ MB message: Timing: mime4j: around 1 minute 20 seconds javax.mail: 10 seconds Memory: mime4j -> without extra memory (default java -without any argument) javax.mail -> -Xms512M -Xmx768M (without thi

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Stefano Bagnara
> getFlags is not really important. But it also crashes when I try to get the > filename of the attachment, i.e. message.getFilename (of the Part). I am not > sure if there is other way to get the filename of the attachments. The email > header certainly does not contain the filename of the attachm

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
Hi, getFlags is not really important. But it also crashes when I try to get the filename of the attachment, i.e. message.getFilename (of the Part). I am not sure if there is other way to get the filename of the attachments. The email header certainly does not contain the filename of the attachment

Re: Weird behaviour with remote db repository

2005-12-30 Thread Stefano Bagnara
Carl Vorster wrote: > Thanks Stefano for the reply, but in my debugging process I created a new > empty db and still got the same results - any other thoughts ? Maybe the problem is in your network or in name resolution between the 2 machines. How much does it take to run a mysql client from the s

RE: Weird behaviour with remote db repository

2005-12-30 Thread Carl Vorster
Thanks Stefano for the reply, but in my debugging process I created a new empty db and still got the same results - any other thoughts ? Thanks Carl -Original Message- From: Stefano Bagnara [mailto:[EMAIL PROTECTED] Sent: Friday, December 30, 2005 5:51 PM To: James Users List Subject: R

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Stefano Bagnara
> Is it possible to store it into temporary file? Using more memory does not > guarantee the stability, unless the email size is limited. But this is not > practical since it reduces James scalability. In a very busy server where > there many (~ 100 users at any time at peak), it can make the heap

Re: Weird behaviour with remote db repository

2005-12-30 Thread Stefano Bagnara
Carl Vorster wrote: > Have any of you ran into a similar situation, or can point me into the right > direction of why this is happening? > mysql repair table spool; repair table inbox; exit; Let me know if this solve your problem. Mysql tables must be manually optimized (repair run the optimiza

Books and tutorials

2005-12-30 Thread Kevin
Does anyone know of a JAMES book or online resource with good tutorials or examples? Thanks, Kevin

Re: How to remove expired emails?

2005-12-30 Thread Serge Knystautas
Mailets are designed to help filter a message while it's processed, not check things afterward. This is a pretty straight-forward JavaMail, at least for the inboxes part. For the outgoing folder check, you could modify RemoteDelivery mailet and add your own check for that header before attempted

Weird behaviour with remote db repository

2005-12-30 Thread Carl Vorster
Hi, Mail server: James 2.2.0 JDK 1.5 Windows 2000 server Repository: MySql 4.1 on dedicated db server Windows 2000 server I've been running James 2.2.0 in a production environment without problems for a couple of months now. Yesterday James's response times suddenly dropped to almost standstill

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
Flags flags = message.getFlags(); And I tried java mail 1.4ea and it is the same as 1.3.2, it runs out of heap. I think sun Java implementation to put everything into memory is not scalable. We are talking about email attachment and not java POJO. And for very busy server like one

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
Hi Stefano, I have tried ByteArrayInputStream headersIn = new SharedByteArrayInputStream(headers.toByteArray()); but it still runs out of heap. I used -Xms512M -Xmx768M but it made my system sluggish with swapping memory-file. Is it possible to store it into temporary f

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Stefano Bagnara
> Is it possible to store it into temporary file? Using more memory does not > guarantee the stability, unless the email size is limited. But this is not > practical since it reduces James scalability. There's no way we can control how sun javamail handle our messages. We should write our own jav

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Stefano Bagnara
Edward Tan wrote: > Yes! > > } catch(Throwable t) { > System.out.println(t.getMessage()); > t.printStackTrace(); > > > > > Java heap space > java.lang.OutOfMemoryError: Java heap space The only solution is to increase the memory available to java (-Xmx500M fo

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
Hi Stefano, I have tried ByteArrayInputStream headersIn = new SharedByteArrayInputStream(headers.toByteArray()); but it still runs out of heap. Is it possible to store it into temporary file? Using more memory does not guarantee the stability, unless the email size is limi

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
Yes! } catch(Throwable t) { System.out.println(t.getMessage()); t.printStackTrace(); > Java heap space java.lang.OutOfMemoryError: Java heap space On 12/30/05, Stefano Bagnara <[EMAIL PROTECTED]> wrote: > > Edward Tan wrote: > > The exception is caught somew

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Stefano Bagnara
Edward Tan wrote: > The exception is caught somewhere, so I set at earlier calling function > stack. > But > > message is null > > and it goes to finally. If it execute the finally, the message is null and the 2 System.out.printlm are not called then it could be a throwable (probably an error, a

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
The exception is caught somewhere, so I set at earlier calling function stack. But message is null and it goes to finally. Somewhere the exception is caught and never thrown back. -- private synchronized void loadMessage() throws MessagingException { if (message != n

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
I haven't pasted the exception message since I am confused why my Eclipse couldn't stop at the generic Exception and goes directly to finally. Or maybe my eyes are too tired. The exception is caught here, inside org.apache.james.core.MimeMessageWrapper -- private synchroniz

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Stefano Bagnara
Edward Tan wrote: > I just found out the culprit, it is not James code. It is > javax.mail.MimeMessage > [...] > if (is instanceof SharedInputStream) { > SharedInputStream sis = (SharedInputStream)is; > contentStream = sis.newStream(sis.getPosition(), -1); > } else { >

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
I wrapped it with MimeMessageWrapper and it still crashed. The culprit is inside javax.mail public static byte[] getBytes(InputStream is) throws IOException { int len; int size = 1024; byte [] buf; if (is instanceof ByteArrayInputStream) { size = is.available();

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
I just found out the culprit, it is not James code. It is javax.mail.MimeMessage Exactly: /** * Byte array that holds the bytes of this Message's content. */ protected byte[] content; ... content = ASCIIUtility.getBytes(is); in: protected void parse(InputStream

Re: Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Stefano Bagnara
Where is the stack trace? We need at least to know the Exception type and the error message. The logfile would also help. Maybe the problem is that message.getFlags() was not wrapped in the MimeMessageWrapper for 2.2.0. I committed yesterday a patch to MimeMessageWrapper adding a few missing wrapp

Fatal Exception when receiving email > 30 MB

2005-12-30 Thread Edward Tan
Hi, James suddenly crash when I receive > 30MB attachment. I didn't check the threshold of message size that causes this. I just happened to send 34 MB attachment through Thunderbird to James. The problem is caused by my mailet which tries to get the flag: in my my mailet: messa