Hi,
Recently I received a message and had it forwarded to Postmaster with
the following error:
> Error message below:
> Embedded configuration exception was: No attribute named
> "onMatchException" is associated with the configuration element
> "mailet" at
> file:/usr/local/james2/phoenix/apps/james/SAR-INF/config.xml:99:22
What's the problem? The mailet doesn't need onMatchException or
onMailetException attribute in the config file, does it?
Thanks in advance,
Oki
ps: I attached the message, because I'm still wondering what might have
caused the error.
--- Begin Message ---
----- Forwarded message from [EMAIL PROTECTED] -----
Date: Wed, 2 Jul 2003 05:13:30 +0700 (WIT)
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re:RE: Running a class on startup - java newbie....
Mail error; unhandled mail.
Error message below:
Embedded configuration exception was: No attribute named "onMatchException" is
associated with the configuration element "mailet" at
file:/usr/local/james2/phoenix/apps/james/SAR-INF/config.xml:99:22
Message details:
Subject: RE: Running a class on startup - java newbie....
Sent date: Wed Jul 02 05:12:25 WIT 2003
MAIL FROM: [EMAIL PROTECTED]
RCPT TO: [EMAIL PROTECTED]
From: Raiden <[EMAIL PROTECTED]>
To: Tomcat Users List <[EMAIL PROTECTED]>
Size (in bytes): 3309
Date: Tue, 1 Jul 2003 15:12:25 -0700 (PDT)
From: Raiden <[EMAIL PROTECTED]>
To: Tomcat Users List <[EMAIL PROTECTED]>
Subject: RE: Running a class on startup - java newbie....
Hello,
Try adding your class to your web.xml file:
<servlet>
<servlet-name>
automaticProcess
</servlet-name>
<servlet-class>
AutomaticProcess
</servlet-class>
<load-on-startup>
1000
</load-on-startup>
</servlet>
Then in your AutomaticProcess class you'd have something like:
public class AutomaticProcess extends HttpServlet implements Runnable {
public void init() {
if (!initialized) {
initialized = initialize();
}
}
protected boolean initialize () {
Thread thread = new Thread(this);
thread.setDaemon(true); // i think this is so the thread will die
when you shutdown the app
thread.start();
return true;
}
public void run() {
boolean stop = false;
while (!stop) {
// make call to whatever you want to run here
try {
Thread.sleep(300000);
}
catch (InterruptedException ie) {
cat.error("AutomaticProcess - " + ie.toString());
}
}
}
}
-Raiden
On Tue, 1 Jul 2003, Ciramella, EJ wrote:
> Yeah, but the more and more I ask the more I hear that generating threads is
> a no-no.
>
> But that's exactly what I was thinking. I want the class to launch when
> this particular webapp is started and die when the webapp (or tomcat) is
> shut down. And it should run every five minutes or so.
>
> I have the functionality of the thread, sleep, loop, jdbc work all hammered
> out in a java application, the question is how do I get this to launch
> during the startup of my webapp.
>
> What I meant earlier about the methodology is if it would be better to use
> some sort of listener (grey area to me) to await access to a resource and
> then run versus creating a separate thread.
>
> Thanks for the ideas guys, keep 'em commin'!!!
>
> -----Original Message-----
> From: Andre D Bonner [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 01, 2003 5:55 PM
> To: Tomcat Users List
> Subject: Re: Running a class on startup - java newbie....
>
>
> >What I'd like to do is
> > have <something> running that sleeps for 5 minutes at a time and then
> checks
> > to see if 24 hours have passed since the row was inserted (and if so,
> delete
> > it). Is there a way to start up a class with my web app?
> >
>
>
> Looks like good old Thread based timer
>
> It is a thread that sits and calls a method every 5 minutes?
>
> while(true){
> Thread.sleep(5 * 60 * 1000) // 5 minutes exactly
>
> // lookup my jdbc Datasource
> // do my jdbc checking?
> // releaseConnection
> // loop
> }
>
>
> --
> Andre D Bonner
> Sun Certified Programmer for the Java? 2 Platform 1.4
>
>
>
> ---------------------------------------------------------------------
> 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]
----- End forwarded message -----
--- End Message ---
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]