[jboss-user] [JBoss Messaging] - Mbean Scheduler using perform method
shakylegz
do-not-reply at jboss.com
Wed Aug 23 07:05:31 EDT 2006
hi :)
I'm working on using a MBean service to perform a trivial task on a Schedulable basis.
The task includes moving txt files from a remote computer to the server where jboss is running, after the transfer, data from the txt file should be validated, this validation could lead to a databaseupdate.
So the task includes using a FTP API(enterprisedt) and a driver for MSSQL. when making a normal java main program this task works without problems.
Scheduler MBean offers two types of SchedulableMBean, SchedulableClass and SchedulableMBean. I decided to use SchedulableClass, and see if this could work. using SchedulableClass the perform() method will be called when the Schedulabled task is trigged. So I figured that this may work fine for my purpose. Then I ran into problems, since when I try to build the sar file I get the errormessage that there is unhandled exceptions and I could add throw declaration, or surround with try/catch.
if I then add throw declaration...like this:
public void perform(Date inDate, long repetitionCountdown ) throws FtpLoginException, IOException
I get the error that these exceptions clause not are compatible with throws clause in Schedulable.perform
If I on the other hand surround with try/catch, like this :
try {
this.SetList();
} catch (FtpLoginException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
my method:
public void SetList() throws IOException, FTPException
{
FTPClient FClient = null;
FClient = new FTPClient();
FClient.setRemoteHost(""xxx.xxx.xxx.xx"");
FClient.connect();
FClient.login("xxxx","xxxx");
FClient.chdir("xxxxxxx");
FileList = FClient.dir();
}
Then I can create the sar file but when I try to deploy the sar file I get this errormessage:
11:41:11,626 ERROR [MainDeployer] Could not create deployment: file:/C:/jboss-4.0.4.GA/server/default/deploy/Integrator2.sar
org.jboss.deployment.DeploymentException: - nested throwable: (java.lang.reflect.UndeclaredThrowableException)
at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:196)
at org.jboss.system.ServiceController.install(ServiceController.java:226)
any suggestions how to get this working is more than welcome :o)
regards
Mads Nielsen
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966925#3966925
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966925
More information about the jboss-user
mailing list