I have written a class that runs on a schedule. I'm using the Schedulable interface. Here's a snippet:
public class PropertyAutoNotify implements Schedulable | { | private static final Logger log = Logger.getLogger(PropertyAutoNotify.class); | | private String mail_jndi = null; | private String ds_jndi = null; | private String mail_from = null; | | | public PropertyAutoNotify(String mail_jndi, String ds_jndi, String mail_from) | { | this.mail_jndi = mail_jndi; | this.ds_jndi = ds_jndi; | this.mail_from = mail_from; | log.info("mail jndi name = " + mail_jndi); | log.info("datasource jndi name = " + ds_jndi); | log.info("mail from addr = " + mail_from); | } | | public void perform(Date now, long remainingRepetitions) | { | log.info("perform, now: " + now + | ", remainingRepetitions: " + remainingRepetitions ); | | //processUserSearch(); | executeAgent(); | } | | | private void executeAgent() | { | try | { I'm trying to reference an EJB from this code. It does not make sense to use the ENC because I'm not in a J2EE container. So how do a get a home interface from a scheduled task? I tried this: try | { | Context initCtx = new InitialContext(); | Object ref = initCtx.lookup("java:/ejb/rwTenantSearch"); | TenantSearchHome home = (TenantSearchHome) | PortableRemoteObject.narrow(ref, TenantSearchHome.class); | | Collection searches = home.findByAutoNotify("Y"); | log.info("number of searches = " + searches.size()); | } | catch (Exception e) | { | log.error("Service Exception", e); | } Didn't work. Thanks for any help. Code examples would be good. I don't want to have to clone my business logic in 2 places. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840613#3840613 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840613 ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user