3 Automatically launch servlets
We want to submit tasks when applying or launched by the deployment or container. We must initialize the QuartzinitializerServlet and howtzservlet when the web module is restarted .quartes .quartzServlet. In order to achieve this, we need to add the following in the deployment descriptor (web.xml) of the web application:
servlet>
servlet>
Servlet needs to access Testejb, so we need to create EJB-REF in Web.xml, as shown below:
EJB-REF>
4 assembly / packaging application
The web module needs to access the Quartz API, so we must package the Quartz class library into the WAR module. We need to put Quartz.jar, Commons-Logging.jar, Commons-pool-1.1.jar, etc. in the web-inf / lib directory of the WAR module. The Quartz configuration required in your environment must be declared in the Quartz.Properties file, which must be placed in the WAR module's web-inf / class directory Ä.
EJB-JAR including TESTEJB and WAR including the Quartz class library and QuartzServlet need to pack as EAR and deploy it into the J2EE container, and use OC4J in our example.
5 Configure your server to open user thread function
Configure your J2EE container to open the user thread function, your application is as a thread created for the Quartz Scheduler Dispersion is considered to be a user thread. Take OC4J as an example, you need to start OC4J like this to allow user threads:
Java-Jar Oc4j.jar -Userthreads
6 Release your J2EE app and then publish your app in your J2EE container. Confident, your application has been set to start with the application server. Take OC4J as an example, you must confirm that the auto-start attribute of the application's web module and the load-on-startup property are TRUE. Confident, you have the following in the server profile:
Server.xml:
HTTP-Web-Site.xml:
7 Now you can start
Your EJB method is now configured to perform a planned task every 30 minutes.
8 reference material
Quartz Document: http://www.quartzscheduler.org/quartz
DEJAN BOSANAC writes Job Scheduling in Java
About author
DEBU PANDA (Debabrata.panda@oracle.com) blog: http://radio.weblogs.com/0135826debu Panda
Yes
Oracle OC4J
A architect of the application server.