Also , if all else fails make sure you can do what the
thread is doing from the JSP to make sure you're
emails are actually getting sent. I have had some
funny issues sometimes with code in a servlet/JSP vs.
standalone. Break it down to the least common
denominator first....simplify then you will know if
it's really the thread or not.
Wade
--- Wade Chandler <[EMAIL PROTECTED]>
wrote:
> You may be getting an error in your thread. You
> should not throw exceptions out of the run method.
> You should always log and update some table or
> static
> collection so you can do something later if needed,
> but throwing errors from threads is never a good
> idea
> as you can hang up some stuff at times depending on
> your JVM and you'll not know what is happening in
> any
> case. Use the standard java logging API, servlet
> loggers, or log4j.
>
> Wade
>
> --- IndianAtTech <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
> >
> > Can I call thread classes in my JSP or Java Bean
> > classes??
> >
> > The reason why I am asking is, I have a situation
> in
> > which if a person
> > registers as a consumer, then a mail shud be sent
> to
> > providers that
> > who matches the consumers requirements
> >
> > There is a possinbilty of sending more than 100
> > mails at an instance.
> > So after successful registration by consumer, I
> > don't want to put the
> > consumer in wait mode, So I have created a thread
> > class and I am
> > trying to send the mail in the thread class
> >
> > But the problem is although I called thread.start
> > method, my run
> > method is not invoking.
> >
> > I thought there could be a problem with my code
> and
> > tested with
> > standalone java class. In standalone class I am
> able
> > to send the mail.
> >
> > So, I don't know why tomcat is rejecting the My
> > thread execution.
> >
> > Any Ideas??
> >
> >
> > here is my code
> > // calling the thread
> > jiya.general.results.MailThread mailThread =new
> > jiya.general.results.MailThread();
> >
> > mailThread.start();
> >
> >
> > //sending the mail
> > private void sendMail() throws JiyaException {
> >
> > JiyaMailComponent jmc=new
> > JiyaMailComponent();
> >
> > jmc.setServer("192.12.0.91");
> >
> > jmc.setUser("[EMAIL PROTECTED]");
> >
> > jmc.setPassword("a");
> >
> > jmc.setFromAddress("[EMAIL PROTECTED]");
> >
> > jmc.setContentType("text/plain");
> >
> > jmc.setTo("[EMAIL PROTECTED]");
> >
> > jmc.setSubject("Some Subject");
> > jmc.setBody("test body");
> >
> > jmc.send();
> >
> > }
> >
> > //this is inner class of My main class
> > class MailThread extends Thread implements
> Runnable
> > {
> > public MailThread()
> > {
> > log("Entered here at mail thread
> > execution"); // here I am to
> > see the log info in log file
> > }
> > public void run() {
> > try{
> >
> > sendMail(); //not coming to this stage
> >
> > }
> > catch(Exception ex) {
> > throw new RuntimeException(ex);
> > }
> > }
> > }
> >
> >
>
---------------------------------------------------------------------
> > 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]