This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Other Application Frameworks and the fly likes Spring Quartz migration to WAS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring Quartz migration to WAS" Watch "Spring Quartz migration to WAS" New topic
Author

Spring Quartz migration to WAS

Hitesh Gupta
Greenhorn

Joined: Jul 03, 2008
Posts: 15
Hi,

I had executed a spring Quartz project as a stand alone java application. Now, I am trying to deploy it on a Server, where it will deployed in to ear file and will be called automatically.

Please find the files created:

sqTest.java

package com.hitesh.java;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class sqTest {
public static void main(String[] args) {
System.out.println("Before Scheduler starts....");
ApplicationContext ctx = new ClassPathXmlApplicationContext("ApplicationContext.xml");
System.out.println("After Scheduler starts....");
}}

MyJob.java

package com.hitesh.java;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
public class MyJob extends QuartzJobBean {
protected void executeInternal(JobExecutionContext ctx) throws JobExecutionException {
System.out.println("EXECUTING QUARTZ JOB");
}}

ApplicationContext.xml

<?xml version="1.0" encoding="UTF-8" ?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

<bean name="myJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.hitesh.java.MyJob"/>
</bean>


<bean id="simpleTrigger"
class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="myJob"/>
<property name="startDelay" value="2000"/>
<property name="repeatInterval" value="1000"/>
</bean>

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="simpleTrigger"/>
</list>
</property>
</bean>
</beans>

This xml is placed at project level. Jar files needed are Spring.jar, Quartz-1.5.0.jar

Please let me know how to migrate this thing EAR which can be executed on a Server and process is executed automatically.

Regards,
Hitesh
Hitesh Gupta
Greenhorn

Joined: Jul 03, 2008
Posts: 15
Hi,
I am able to do it.
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring Quartz migration to WAS