I have six Java Scheduler classes, each with a different purpose but all coded in the same way. Only three of these are triggering on my WebSphere Application Server installation.
Interface:
import javax.ejb.Local;
@Local
public interface IScheduledProcessorBean
{
public void doProcessing();
}
Implementations (an example of one that isn't working, but all six are identical except for naming):
@Stateless
@HousekeepingProcessor
public class HousekeepingTimer implements IScheduledProcessorBean
{
public static final String className = "HousekeepingTimer";
@PersistenceContext(unitName = "WOTISEJB")
private EntityManager em;
/**
* Default constructor.
*/
public HousekeepingTimer()
{
// Default Constructor
}
// Try not to clash with the other schedule timer flows.
@Schedule(minute="20", hour="8-20", dayOfWeek="Mon-Fri",
dayOfMonth="*", month="*", year="*", info="HousekeepingTimer", persistent=true)
public void doProcessing()
{
Logger.getGlobal().fine(()->className + " called at: " + new java.util.Date());
try
{
// Specific logic goes here
}
catch (Exception e)
{
Logger.getGlobal().log(Level.SEVERE, "Scheduler failed for Housekeeping", e);
}
}
}
Processor Annotation:
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.inject.Qualifier;
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
public @interface HousekeepingProcessor {
}
Each of the six timers follow the exact pattern above, however only three of them trigger.
In the WebSphere Application Server 9 Console, under Enterprise Applications -> Application -> EJB JNDI names
, In only see three of the Beans (the three that run successfully), and not all six.
Likewise under Enterprise Applications -> Application -> Binding enterprise Bean with business interface to JNDI names
I only see the three working schedulers.
And, likewise, when installing the application, the "Provide JNDI names for beans" and "Bind EJB Business" steps of the detailed installation path only show those same three beans.
When I look in ejb-jar_merged.xml
in the deployed files, again, only the three working timers are there.
I have tried creating ejb-jar.xml
and deploying it explicitly, and that works - so there's something in Websphere's automatic bean processing that isn't picking it up without a prompt.
Can anyone suggest what might be going on here?