[JBoss Seam] - Re: Starting up Asynchronous Method at startup
by ASavitsky
Here's what works for me (no EJB3 - plain POJO, Quartz and Tomcat, all deployed as WAR):
@Name ("scheduler")
| @Scope (ScopeType.APPLICATION)
| @Startup
| public class Scheduler {
| @In
| private IService service;
| @Logger
| private Log log;
| // set in seam.properties via scheduler.reminderCron
| private String reminderCron;
|
| public void setReminderCron(String reminderCron) {
| this.reminderCron = reminderCron;
| }
| @Create
| public void startJobs() {
| log.info("Reminder task started on #0, cron schedule is #1",
| new Date(), reminderCron);
| service.sendReminders(reminderCron);
| }
| }
public interface IService extends Serializable {
| void sendReminders(String cron); // other methods are omitted
| }
@Name ("service")
| @Scope (ScopeType.CONVERSATION)
| @AutoCreate
| @Transactional
| public class Service implements IService {
| @Asynchronous
| public void sendReminders(@IntervalCron String cron) {
| log.info("Reminder task activated on #0", new Date());
| // plus whatever other functionality you need here...
| }
| }
|
The scheduler starts with the app, and runs every morning (as per cron expression, which you can change as needed)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095784#4095784
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095784
18Â years, 9Â months
[JNDI/Naming/Network] - Re: using Tomcat to serve EJB requests
by rupshall
I hate to reanimate this post but it is exactly what I want to do. I'm running Tomcat 5.5.23 and attempting to access EJB on a 4.0.5.GA JBoss server.
I have copied my jndi.properties into WEB-INF/classes and I have jbossall-client.jar in WEB-INF/lib. I have 2 cases:
1. When I have jbossall-client.jar in WEB-INF/lib in get java.lang.NoClassDefFoundError: javax/ejb/CreateException
2. When I move jbossclient-all.jar to shared/lib I get javax.naming.NameNotFoundException: Name UtilitiesFacadeEJB is not bound in this Context
In case 1 its clear it doesn't find the jbossall-client.jar, why would that be? In case 2 it does find the required JBoss classes but is unable to locate the EJB. It doesn't appear to be finding jndi.properties.
I tried to pass the -nonaming into the tomcat startup.sh script but my Tomcat instance doesn't appear to start when I do.
I have spend all day searching forums and google, trying everything I find with no luck. Can somebody point me in the proper direction?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095780#4095780
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095780
18Â years, 9Â months