[jboss-user] [JNDI/Naming/Network] - Re: Help with Quartz MBean Service under JBoss using JNDI?

imargelatu do-not-reply at jboss.com
Wed Mar 7 07:54:17 EST 2007


I have the exact same problem. In a Jboss instance, the QuartzService is successfully created. Even more, existing Quartz jobs are being executed as expected.

I want to be able to access the Quartz Scheduler from a console application. However the following code prints out 'null' :


  | 
  |     public static void main(String[] args) throws Exception {
  |         InitialContext iniCtx = getInitialContext();
  |         Scheduler scheduler = (Scheduler)iniCtx.lookup("Quartz");
  |         
  |         System.out.println(String.format("Scheduler : %s", scheduler));
  |     }
  |     
  |     public static InitialContext getInitialContext() throws Exception {
  |         Hashtable<String, String> props = getInitialContextProperties();
  |         return new InitialContext(props);
  |     }
  | 
  |     private static Hashtable<String, String> getInitialContextProperties() {
  |         Hashtable<String, String> props = new Hashtable<String, String>();
  |         props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
  |         props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  |         props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
  |         return props;
  |     }
  | 
  | 

There are no exceptions thrown, however the Scheduler object is null.

Am I doing something wrong ? 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025771#4025771

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025771



More information about the jboss-user mailing list