1. 程式人生 > >在 jboss-5.1.0.GA中編寫 會話Bean和MDB

在 jboss-5.1.0.GA中編寫 會話Bean和MDB

   private static Context getJBossInitialContext() {
        final String INIT_FACTORY = "org.jnp.interfaces.NamingContextFactory";
        final String SERVER_URL = "localhost:1099";
        Context ctx = null;
        Properties props = new Properties();
        props.put(Context.INITIAL_CONTEXT_FACTORY, INIT_FACTORY);
        props.put(Context.PROVIDER_URL, SERVER_URL);
        try {
            ctx = new InitialContext(props);
        } catch (NamingException e) {
            e.printStackTrace();
        }
        return ctx;
    }