Thanks for reverting back.
The line 16 of the NotifyMailet is the closing brace of function
service. No matter what I write in the service function or the class
NotifyMailet, James throws NullPointerException and the StackTrace
says the exception to be at line 16.
Here is the code of NotifyMailet.java
package mt;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import javax.mail.MessagingException;
import org.apache.mailet.GenericMailet;
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
public class NotifyMailet extends GenericMailet {
public void service(Mail mail) throws MessagingException {
}
/**
* Gets the exception stack trace as a string.
* @param exception
* @return
*/
public String getStackTraceAsString(Exception exception)
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.print(" [ ");
pw.print(exception.getClass().getName());
pw.print(" ] ");
pw.print(exception.getMessage());
exception.printStackTrace(pw);
return sw.toString();
}
}
On Dec 31, 2007 6:55 AM, Stefano Bagnara <[EMAIL PROTECTED]> wrote:
> What is the code at line 16 of NotifyMailet.java ?
>
> The NullPointerException is in your code, so you probably made some
> mistake there.
>
> Stefano
>
>
> Atul Moglewar ha scritto:
> > Hi,
> > Thanks for reverting back.
> >
> > As suggested by you, I altered the environment.xml to enable DEBUG
> > loggin for spoolmanager and found that, my mailet gets instantiated
> > when I start James. The log entry says,
> >
> > 30/12/07 02:00:10 INFO spoolmanager: Mailet NotifyMailet instantiated.
> >
> > But when I send mail, my mailet throws NullPointerException. This
> > exception is thrown even if I dont write anything in the service
> > method. The stack trace in the log file is
> >
> >
> > 30/12/07 02:02:28 ERROR spoolmanager: Exception in processor <root>
> > java.lang.NullPointerException
> > at NotifyMailet.service(NotifyMailet.java:16)
> > at
> > org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:424)
> > at
> > org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:405)
> > at
> > org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:309)
> > at java.lang.Thread.run(Thread.java:595)
> > 30/12/07 02:02:28 ERROR spoolmanager: An error occurred processing
> > replyTo-Mail1198960343718-0 through root
> >
> >
> > I have configured this mailet in the config.xml as
> >
> > <mailet match="All" class="NotifyMailet"/>
> >
> > This element is first child of <processor name="root"> element.
> > Along with the above entry, the mailet also has entry in the mailetpackages.
> > I haven't written the init method for this mailet. This mailet is
> > subclass of GenericMailet.
> >
> > Thanks,
> > -atul
> >
> > On Dec 29, 2007 12:16 AM, Stefano Bagnara <[EMAIL PROTECTED]> wrote:
> >> Atul Moglewar ha scritto:
> >>
> >>> Hi,
> >>> I wrote a small mailet, created a jar file and placed it in the lib
> >>> directory of the SAR-INF directory. I created the entry of this mailet
> >>> in the config.xml also. The xml entry looks like this
> >>>
> >>> <mailetpackages>
> >>> <mailetpackage>org.apache.james.transport.mailets</mailetpackage>
> >>>
> >>> <mailetpackage>org.apache.james.transport.mailets.smime</mailetpackage>
> >>> <mailetpackage>mt.NotifyMailet</mailetpackage>
> >>> </mailetpackages>
> >> Alter your environment.xml to enable DEBUG logging for the spoolmanager.
> >> In the spoolmanager log you will see exactly what matchers/mailets are
> >> called for each mail.
> >>
> >> How did you configured your matcher/mailet in the processor? What does
> >> JAMES logs when you run it and it initializes mailets? Does your init()
> >> get called?
> >>
> >> Stefano
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]