-
1. Re: Scheduled Event and Session Beans
bdecoste Feb 16, 2006 4:02 PM (in response to ejb3workshop)To create a deploy dependency of an MBean on an .ear file, add a depends tag to the -service.xml file using one of the service names (e.g. EJB Container or EJB Module) created when the .ear is deployed.
For example:
<mbean ...>
jboss.j2ee:module=session2.jar,service=EJB3 -
2. Re: Scheduled Event and Session Beans
bdecoste Feb 16, 2006 4:04 PM (in response to ejb3workshop)"bdecoste" wrote:
To create a deploy dependency of an MBean on an .ear file, add a depends tag to the -service.xml file using one of the service names (e.g. EJB Container or EJB Module) created when the .ear is deployed. The MBean deployment will block until the .ear is deployed.
For example:
<mbean ...>
...
<depends>jboss.j2ee:module=session2.jar,service=EJB3<depends>
</mbean> -
3. Re: Scheduled Event and Session Beans
ejb3workshop Feb 17, 2006 6:11 AM (in response to ejb3workshop)Thanks. That worked rather well. I am now trying to "inject" a reference to my stateless bean via annotation. When I try to run this I get a NullPointerException.
I think it would be nice if it was possible to inject a reference to a bean via @EJB3. I suppose I'll have to perform a "manual" lookup. Another 2 lines of code :-(/* * JBossSchedulable.java */ package com.helveta.cis.cie.scheduler; import java.util.Date; import javax.annotation.EJB; import org.apache.log4j.Logger; import org.jboss.varia.scheduler.Schedulable; /** * * @author Alex */ public class JBossSchedulable implements Schedulable { private static final Logger log = Logger.getLogger(JBossSchedulable.class); private String name; private long value; @EJB3 private Scheduler scheduler; public JBossSchedulable(String name, long value) { this.name = name; this.value = value; log.info("ctor, name: " + name + ", value: " + value); } public void perform(Date now, long remainingRepetitions) { log.info("perform, now: " + now +", remainingRepetitions: " + remainingRepetitions +", name: " + name + ", value: " + value); try { scheduler.check(); } catch (Exception e) { log.info("Unable to CHECK scheduler",e); } } }
-
4. Re: Scheduled Event and Session Beans
martinganserer Feb 28, 2006 9:54 AM (in response to ejb3workshop)Hi,
did you solve your problem? I was able to get the Scheduler up and running. But when I try to inject a stateless session bean I get a null pointer exception too!
You wrote that you have to do a manual lookup. Did it work. If yes how did you do that?
Thanks! -
5. Re: Scheduled Event and Session Beans
ejb3workshop Feb 28, 2006 1:13 PM (in response to ejb3workshop)By manual lookup I mean :
InitialContext ctx = new InitialContext(); System.out.println("Got Naming Service"); CalculatorServices calculator = (CalculatorServices) ctx.lookup("CalculatorBean/remote"); System.out.println("Got Calculator"); System.out.println("ADD : "+calculator.add(5,4));
As long as you don't redeploy the bean. After redeploying I am getting a Classcast exception after the deployment as the new bean is not the same class as the previously deployed bean. This means I have to restart the application server, but other then that it is working.
Alex