This discussion is archived
0 Replies Latest reply: Nov 15, 2012 4:45 PM by 974539 RSS

Java thread within the AddOn opar unable to submit EM Job

974539 Newbie
Currently Being Moderated
Hello,
We have an add-on opar which incorporates our war file. We are using EM version 12.1.0.2.0. There are a few Java classes within this war that spawn threads, and the threads attempt to execute OEM jobs using the emSDK JobManager service (as shown below). But the threads are unable to submit the job, they fail with a null exception in the getConnection() below. But the same code executes fine and the job gets submitted when we do not spawn a thread, and instead execute the code in the main (parent) thread.

Is there some additional code/configuration required to enable the spawned Java threads to get the EMExecutionContext and submit the job?

//// Code sample that runs in the thread to submit the job
JobManager instance_2 = JobManager.instance();

instance_2.submitJob(EMExecutionContext.getExecutionContext().getConnection(), job);
EMExecutionContext.getExecutionContext().getConnection().commit();


Thanks
Sanjeev

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points