Create a scheduler resource reference
When you define schedulers in the server configuration, the object instance is bound into the global name space under the configured Java Naming Directory Interface (JNDI) name. Use a resource reference to avoid manually coding this JNDI name into the application. Using a resource reference allows administrators to map applications to the appropriate schedulers.
We can alternatively create a scheduler resource reference by editing the XML directly. A Scheduler resource reference is a JEE compliant resource that uses the class com.ibm.websphere.scheduler.Scheduler as the object type. For information regarding the XML file format, see the Java EE Specification.
- Start an assembly tool, such as Rational Application Developer.
- Open the Java EE perspective.
- Open the EJB or Web module with the Deployment Descriptor Editor.
- Click the Reference tab at the bottom of the window.
- Click Add.
- Select the Resource reference option.
- Click Next.
- Complete the Reference fields as shown in the following properties:
- Name
- The reference name, for example, sched/MyScheduler. According to this example, the name you choose has a local reference name of java:comp/env/sched/MyScheduler.
- Type
- Select com.ibm.websphere.scheduler.Scheduler, and click OK.
- Authentication
- Select container.
- Description
- Any relevant description.
- Click finish.
- (Optional) Enter a global JNDI name of a configured scheduler in the JNDI name field in the Bindings section of the Reference window. We can specify or override this value when you install the application.
- Save the changes to the deployment descriptor.
Results
A scheduler resource reference is now available to use within our application
Related
Schedulers collection