-
1. Re: How to create the scheduler in Jboss?
stephanenicoll Nov 23, 2003 4:00 AM (in response to mohan_cbe)It has nothing to do in the Messaging forum. Anyway, to define a scheduler, just declare a file named
myschedulers-service.xml with the following content:
true
org.company.YourClass
Schedulabe Test,12345
java.lang.String,int
0
10000
-1
Then create the org.company.YourClass that extends some interface (Schedulable from org.varia) and define what you want to do there when the scheduler is invoked.
See org.jboss.varia.scheduler.Scheduler for more details about method arguments.
I have a document somewhere that summarizes those steps. If you can wait till tomorrow, I can give that to you.
Regards,
Stephane
PS : check the free doco as well -
2. Re: How to create the scheduler in Jboss?
mohan_cbe Nov 24, 2003 12:58 AM (in response to mohan_cbe)Hi Stephane
Thanks for your information. Can u pls clarify what I have to do in the following scenario?
As per the format, I am creating the second scheduler (I am updating scheduler-service.xml file) when the first scheduler is currently running in the server. When I deploy (save) the scheduler-service.xml file with second scheduler, the first scheduler starts from beginning. It means the repetitions process is re-initializing for first scheduler.
For example, the first scheduler has to run 5 times, after completion of 3 times, I am creating the second scheduler. In this case, the first scheduler starts from the beginning. Again it is running 5 times. I want, the first scheuler to run only 2 times after creating the second scheduler.
How to maintain the previous scheduler state ..?
Can u send the document ?
Thanks in advance.
Regards
CMohan.M -
3. Re: How to create the scheduler in Jboss?
stephanenicoll Nov 24, 2003 1:04 AM (in response to mohan_cbe)Hello again,
Changing the same file has the side effect that JBoss hot-redploy this file (and the whole content).
You can bypass this situation easily by creating your own schedulers.
Quickly, you can simply copy the file schedulers-service.xml into mysechdulers-service.xml (The -service.xml is important, that's how the JBoss deployer figures out it's a service configuration file).
Remove everything you don't want (that is the MBean defintion whille keeping the element)
Then add the Schedulers you need.
Remember. Everytime you change a file in the deploy directory, JBoss will redeploy it and restart from scratch.
Regards,
Stephane -
4. Re: How to create the scheduler in Jboss?
mohan_cbe Nov 24, 2003 5:06 AM (in response to mohan_cbe)Dear Stephane
Thanks lot man.
It is working perfectly as per my requirement.
Regards
CMohan.M -
5. Re: How to create the scheduler in Jboss?
mohan_cbe Nov 27, 2003 12:06 AM (in response to mohan_cbe)Again Hello Stephane,
The following steps are used while creating the two or more scheduler in jboss.
1. First i am creating the scheduler in scheduler-service.xml file.
2. When I am started to creating second scheduler, I copied content of scheduler-service.xml file to 161scheduler-service.xml
when I deploy the 161scheduler-service.xml , the following exception throws in the console.
Can u explain where I am doing the mistake ?
11:29:16,752 INFO [MainDeployer] Starting deployment of package: file:/D:/BW-IV/jboss-3.0.7/server/basewep/deploy/161scheduler-service.xml 11:29:16,822 ERROR [URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@991a8414{ url=file:/D:/BW-IV/jboss-3.0.7/server/basewep/deploy/161scheduler-service.xml, deployedLastModified=1069912746000 } org.jboss.deployment.DeploymentException: Exception getting document; - nested throwable: (org.xml.sax.SAXParseException: XML declaration may only begin entities.) at org.jboss.deployment.SARDeployer.parseDocument(SARDeployer.java:622)
at org.jboss.deployment.SARDeployer.init(SARDeployer.java:130)
at org.jboss.deployment.MainDeployer.init(MainDeployer.java:679)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:615)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:591)
at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
at $Proxy3.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:435)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:561)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:217) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:230) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:207)Caused by: org.xml.sax.SAXParseException: XML declaration may only begin entities.
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3170)
at org.apache.crimson.parser.Parser2.maybePI(Parser2.java:966)
at org.apache.crimson.parser.Parser2.maybeMisc(Parser2.java:1092)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:487)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
at org.jboss.deployment.SARDeployer.parseDocument(SARDeployer.java:618)
... 16 more
PS:
U mention "Remove everything you don't want (that is the MBean defintion whille keeping the element)" in ur msg.
Whether i have to remove Mbean tag from the scheduler-service.xml file...? Can u pls explain it ?
Thax in advance.
Regards
CMohan.M -
6. Re: How to create the scheduler in Jboss?
stephanenicoll Nov 27, 2003 3:29 AM (in response to mohan_cbe)Your XML is simply wrong.
Your 161scheduler-service.xml file should look like:
<?xml version="1.0" encoding="UTF-8"?>
true
org.jboss.varia.scheduler.example.SchedulableExample
Schedulabe Test,12345
java.lang.String,int
0
10000
-1
Just change the value and the parameter.
Regards,
Stephane -
7. Re: How to create the scheduler in Jboss?
mohan_cbe Nov 27, 2003 5:08 AM (in response to mohan_cbe)Hi
Still I am getting the same problem.
I am explaining what I did so far. Do u find any mistake pls let me know.
Step 1: Creation of first scheduler.
I am updating the scheduler-service.xml file (it is working fine). The content of scheduler-service.xml file is given below.
<?xml version="1.0" encoding="UTF-8"?>
true
basewep.services.crawler.ScheduleCrawler
oracle ,Intranet,157
java.lang.String,java.lang.String,java.lang.String
NOW
86400000
7
Step 2: Creation of second scheduler.
Creation of second scheduler was happening when first scheduler was completed his process 2 times (2 repetitions was over).
I copied whole content that is available in the step 1, (scheduler-service.xml) in to 161IntranetoracleScheduler.xml file and deploy (save) in the following path.
../jboss-3.0.7/server/basewep/deploy/.
And I am trying to create the second scheduler in scheduler-service.xml. It means I delete all the content, which is available between the server tags and creating the second scheduler. The content of second scheduler (scheduler-service.xml) is given below.
<?xml version="1.0" encoding="UTF-8"?>
true
basewep.services.crawler.ScheduleCrawler
oracle ,Intranet,162
java.lang.String,java.lang.String,java.lang.String
NOW
43200000
15
but I am getting exception when I try to save the 161IntranetoracleScheduler.xml in deploy folder.
6:04:12,061 ERROR [URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$Deplo
edURL@991a8414{ url=file:/D:/BW-IV/jboss-3.0.7/server/basewep/deploy/161scheduler-service.xml, deployedLastModifie=0 }
rg.jboss.deployment.DeploymentException: Exception getting document; - nested throwable: (org.xml.sax.SAXParseExcetion: XML declaration may only begin entities.)
at org.jboss.deployment.SARDeployer.parseDocument(SARDeployer.java:622)
at org.jboss.deployment.SARDeployer.init(SARDeployer.java:130)
at org.jboss.deployment.MainDeployer.init(MainDeployer.java:679)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:615)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:591)
at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
... 17 more
I hope u can understand where i did the mistake. Pls give the solution for my problem.
Thanks and Regards
CMohan.M -
8. Re: How to create the scheduler in Jboss?
stephanenicoll Nov 27, 2003 5:18 AM (in response to mohan_cbe)So you are doing all this by hand or what? Man, you're crazy.
You don't have to copy files over and over (don't get sticked to words!!!!)
Let's restart from scratch.
DO NOT TOUCH THE SCHEDULERS-SERVICE.XML !!!
Create your schedulers service with your two mbeans. Here the file: (myschedulers-service.xml for instance)
<?xml version="1.0" encoding="UTF-8"?>
true
basewep.services.crawler.ScheduleCrawler
oracle ,Intranet,157
java.lang.String,java.lang.String,java.lang.String
NOW
86400000
7
false
basewep.services.crawler.ScheduleCrawler
oracle ,Intranet,162
java.lang.String,java.lang.String,java.lang.String
NOW
43200000
15
You will see that the second scheduler has property startAtStartup to false. When you are in the second execution of the first scheduling class, just retrieve the second scheduler through JMX and invoke the startSCheduling method
I can't imagine you are doing this by hand and moving files over and over.
DO NOT TOUCH THE schedulers-service.xml
Regards,
Stephane