I resolved the problem. The problem was not with the code but the
entries in the config.xml. I missed the package name while entering
the mailet class name in the processor class. There was correct entry
of the class with package name in the mailetpackage, but i somehow
missed it in the processor block. When I wrote the class name with its
complete package, no exception was thrown.
I retested it by removing the package name and the exception
reappeared. Though i found it was strange because, a wrong entry in
the xml caused my mailet to throw exception.
Anyways, thanks a lot for helping me out.

-atul

On Dec 31, 2007 8:48 PM, Stefano Bagnara <[EMAIL PROTECTED]> wrote:
> Hi Atul,
>
> You probably are missing some point. The NullPointerException is from
> your mailet and not from James. NPE are really easy to debug in java.
> If you get an NPE in NotifyMailet.java line 16 then the code that you're
> running is not the one that you pasted here ;-).
>
> Please just delete your class file, recompile your mailet, make sure
> that the mailet JAMES load is the right one (e.g: put a custom log in
> the init).
>
>
> Stefano
>
> Atul Moglewar ha scritto:
> > 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
>
>
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to