[jboss-user] [EJB 3.0 Users] - Client calls Timer only once
Fuchs
do-not-reply at jboss.com
Mon Oct 19 09:18:16 EDT 2009
Hello.
I am using JBoss 5.0.1.GA.
I need to build a TimerService with EJB3.
Therefor, I am using the Tutorial, which can be found under the documentation of EJB3.
After some changes the Timer-Tutorial is running.
Now, the Server-Methode should be called every fifth sec.
In my Application it is only once called.
Here my code for the Client:
| package ejb.timer.createbill;
|
| import java.util.Properties;
| import javax.naming.Context;
| import javax.naming.InitialContext;
| import javax.naming.NamingException;
| import javax.rmi.PortableRemoteObject;
|
|
| public class Client
| {
| public static void main(String[] args) throws Exception
| {
| System.out.println("HELLO FROM CLIENT !");
|
| try {
| Properties p = new Properties();
| p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
| p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
| Context ctx = new InitialContext(p);
|
| Object ref = ctx.lookup("TimerBean/remote");
| ExampleTimer cbr =(ExampleTimer) PortableRemoteObject.narrow(ref, ExampleTimer.class);
| cbr.scheduleTimer(1000);
|
| } catch (NamingException e){
| e.printStackTrace();
| }
| }
| }
|
I also add the following Argument to the Client Application:
Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
Can someone help me?
Thx!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4261053#4261053
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4261053
More information about the jboss-user
mailing list