Package javax.naming

Examples of javax.naming.InitialContext.bind()


      for (BindReferencePlugin plugin : bindReferencesPlugins)
      {
         try
         {
            InitialContext ic = new InitialContext();
            ic.bind(plugin.getBindName(), plugin.getReference());
            log.info("Reference bound (by recall()): " + plugin.getBindName());
         }
         catch (NameAlreadyBoundException e)
         {
            log.debug("Name already bound: " + plugin.getBindName());
View Full Code Here


    public static void main(String[] args)
        throws NamingException {
        InitialContext ic;
        ic = new InitialContext();
        ic.bind("dummy", new Object());
    }
}
View Full Code Here

      ctx.rebind(DEFAULT_CACHE_POLICY_PATH, ref);
      log.debug("cachePolicyCtxPath="+cacheJndiName);

      // Bind the default SecurityProxyFactory instance under java:/SecurityProxyFactory
      SecurityProxyFactory proxyFactory = (SecurityProxyFactory) securityProxyFactoryClass.newInstance();
      ctx.bind("java:/SecurityProxyFactory", proxyFactory);
      log.debug("SecurityProxyFactory="+proxyFactory);

      // Register the Principal property editor
      PropertyEditorManager.registerEditor(Principal.class, PrincipalEditor.class);
      PropertyEditorManager.registerEditor(SecurityDomain.class, SecurityDomainEditor.class);
View Full Code Here

         instance = new DummyTransactionManager();
         utx = new DummyUserTransaction(instance);
         try {
            Properties p = new Properties();
            Context ctx = new InitialContext(p);
            ctx.bind("java:/TransactionManager", instance);
            ctx.bind("UserTransaction", utx);
         } catch (NoInitialContextException nie) {
            log.debug(nie.getMessage());

         } catch (NamingException e) {
View Full Code Here

         utx = new DummyUserTransaction(instance);
         try {
            Properties p = new Properties();
            Context ctx = new InitialContext(p);
            ctx.bind("java:/TransactionManager", instance);
            ctx.bind("UserTransaction", utx);
         } catch (NoInitialContextException nie) {
            log.debug(nie.getMessage());

         } catch (NamingException e) {
            log.debug("binding of DummyTransactionManager failed", e);
View Full Code Here

      for (BindReferencePlugin plugin : bindReferencesPlugins)
      {
         try
         {
            InitialContext ic = new InitialContext();
            ic.bind(plugin.getBindName(), plugin.getReference());
            LOG.info("Reference bound (by recall()): " + plugin.getBindName());
         }
         catch (NameAlreadyBoundException e)
         {
            LOG.debug("Name already bound: " + plugin.getBindName());
View Full Code Here

        p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");

        InitialContext initialContext = new InitialContext(p);

        // Here's the fun part
        initialContext.bind("inject", this);
    }

    public void test() throws Exception {

        userTransaction.begin();
View Full Code Here

    public void test() throws Exception {

        Properties properties = new Properties();
        properties.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
        InitialContext context = new InitialContext(properties);
        context.bind("inject", this);

        assertRefs();
    }

    protected void assertRefs() throws JMSException {
View Full Code Here

    public void test() throws Exception {

        Properties properties = new Properties();
        properties.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
        InitialContext context = new InitialContext(properties);
        context.bind("inject", this);

        assertRefs();

    }
}
View Full Code Here

          dataSource.setDriverClassName("com.mysql.jdbc.Driver");
          dataSource.setUrl("jdbc:mysql://localhost:3306/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false");
          dataSource.setUsername("root");
          dataSource.setPassword("password");
          dataSource.setMaxActive(50);
          jndiContext.bind("java:comp/env/jdbc/LiferayPool", dataSource);
        }
        catch(NameAlreadyBoundException ex)
        {
          ex.printStackTrace();
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.