- EAR project
- WEB project
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
InitialContext = new InitialContext(env);
Scheduler scheduler = (Scheduler)ic.lookup("scheuler_JNDI");
BeanTaskInfo taskInfo = (BeanTaskInfo) scheduler.createTaskInfo(BeanTaskInfo.class);
Object o = ic.lookup("scheduler_EJB_jndi");
TaskHandlerHome home = (TaskHandlerHome) PortableRemoteObject.narrow(o, com.ibm.websphere.scheduler.TaskHandlerHome.class);
taskInfo.setTaskHandler(home);
taskInfo.setStartTime(startDate);
taskInfo.setNumberOfRepeats(100);
taskInfo.setRepeatInterval("2seconds");
taskInfo.setName("SchedulerEJB");
TaskStatus ts = scheduler.create(taskInfo);
- EJB
POM - need to generate remote stub, add to the web module
3.1 standard v2.1 EJB extends TaskHandler Interface.
public class SchedulerEJB implements TaskHandler, SessionBean {}
3.2 ejb-jar.xml defines as follows
<session id="SchedulerEJB">
<ejb-name>SchedulerEJB</ejb-name>
<home>com.ibm.websphere.scheduler.TaskHandlerHome</home>
<remote>com.ibm.websphere.scheduler.TaskHandler</remote>
<ejb-class>au.gov.immi.SchedulerEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
- websphere admin console
- 1. setup scheduler and its database
http://pic.dhe.ibm.com/infocenter/wrklight/v5r0m5/index.jsp?topic=%2Fcom.ibm.worklight.help.doc%2Fadmin%2Ft_configuring_websphere_application_server_for_derby_manually.html
Local test urL
localhost:9080/scheduler_web/scheduler
http://publib.boulder.ibm.com/infocenter/dmndhelp/v6rxmx/index.jsp?topic=/com.ibm.wsps.602.javadoc.doc/doc/com/ibm/websphere/scheduler/TaskInfo.html
http://www.coderanch.com/t/75326/Websphere/WSAD-Schedular-UserCalender
http://www.coderanch.com/t/581616/EJB-JEE/java/Calling-EJB-Bean-WebSphere-application
https://github.com/aviramsegal/articles/blob/master/WebSphereScheduler/WebSphereScheduler.md