Package javax.naming

Examples of javax.naming.Context.lookup()


     */
    public static void main(final String[] args) throws Exception {

        Context initialContext = getInitialContext();

        StatelessRemote statelessBean = (StatelessRemote) initialContext
                .lookup("org.ow2.easybeans.examples.statelessbean.StatelessBean"
                        + "_" + StatelessRemote.class.getName() + "@Remote");

        System.out.println("Calling helloWorld method...");
        statelessBean.helloWorld();
View Full Code Here


     * @throws Exception if the bean cannot be retrieved.
     */
    private StatelessLocal getBean() throws Exception {
        // @EJB injection may work in some EasyBeans integration container like JOnAS 5 or Tomcat 6
        Context initialContext = new InitialContext();
        Object o = initialContext.lookup("org.ow2.easybeans.examples.ear.StatelessBean" + "_"
                + StatelessLocal.class.getName() + "@Local");

        if (o instanceof StatelessLocal) {
            StatelessLocal statelessBean = (StatelessLocal) o;
            return statelessBean;
View Full Code Here

     */
    public static void main(final String[] args) throws Exception {

        // Lookup the Remote Bean interface through JNDI
        Context initialContext = getInitialContext();
        SessionFacadeRemote facadeBean = (SessionFacadeRemote) initialContext.lookup(
                "org.ow2.easybeans.examples.entitybean.SessionFacade"
                + "_" + SessionFacadeRemote.class.getName() + "@Remote");

        // Adds some employees
        Employee florent = facadeBean.findEmployee(1);
View Full Code Here

     * @return the stateless bean business interface.
     * @throws Exception if the bean cannot be retrieved.
     */
    private StatelessRemote getBean() throws Exception {
        Context initialContext = new InitialContext();
        Object o = initialContext.lookup("org.ow2.easybeans.examples.statelessbean.StatelessBean" + "_"
                + StatelessRemote.class.getName() + "@Remote");

        if (o instanceof StatelessRemote) {
            StatelessRemote statelessBean = (StatelessRemote) o;
            return statelessBean;
View Full Code Here

    public static void main(final String[] args) {
        try {
            /* Solve withespaces problem for windows users */
            System.setProperty("java.rmi.server.useCodebaseOnly", "true");
            Context initialContext = getInitialContext();
            DirectoryRemote dir = (DirectoryRemote) initialContext.lookup(JNDI_NAME);

            dir.create("tete", "tata");
            dir.add("blais", "julien", "", "0673863814");
            try {
                System.out.println(dir.getPhoneNumber("blais", "julien"));
View Full Code Here

        DirectoryRemote directory = null;

        try {
            System.setProperty("java.rmi.server.useCodebaseOnly", "true");
            Context initialContext = getInitialContext();
            directory = (DirectoryRemote) initialContext.lookup(JNDI_NAME);

        } catch (NamingException ex) {
            Logger.getLogger(DirectoryRemote.class.getName()).log(Level.SEVERE, "Unable to found DirectoryRemote EJB.", ex);
        }
        return directory;
View Full Code Here

        // As of 3.2.2 version of JBoss "jmx/invoker/RMIAdaptor" is the new JNDI entry for RMIAdaptor.
        ///  But there is a naming alias setup from jmx/rmi/RMIAdaptor to jmx/invoker/RMIAdaptor,
        ///   so connectivity continues to work fine (last tested with 4.0.4GA).
        Context ctx = new InitialContext(props);
        RMIAdaptor rmiAdaptor = (RMIAdaptor)ctx.lookup("jmx/rmi/RMIAdaptor");
        ctx.close();
        return rmiAdaptor;
    }

}
View Full Code Here

            System.err.println("Cannot get InitialContext: " + e);
            System.exit(2);
        }
        StatefulRemote statefulBean = null;
        try {
            statefulBean = (StatefulRemote) initialContext
                    .lookup("org.ow2.easybeans.examples.statefulbean.StatefulBean" + "_"
                            + StatefulRemote.class.getName() + "@Remote");
        } catch (NamingException e) {
            System.err.println("Cannot get statefulBean: " + e);
            System.exit(2);
View Full Code Here

        }

        // We want to start transactions from client: get UserTransaction
        UserTransaction utx = null;
        try {
            utx = (UserTransaction) initialContext.lookup("javax.transaction.UserTransaction");
        } catch (NamingException e) {
            System.err.println("Cannot lookup UserTransaction: " + e);
            System.exit(2);
        }
View Full Code Here

        DirectoryRemote directory = null;

        try {
            System.setProperty("java.rmi.server.useCodebaseOnly", "true");
            Context initialContext = getInitialContext();
            directory = (DirectoryRemote) initialContext.lookup(JNDI_NAME);

        } catch (NamingException ex) {
            Logger.getLogger(DirectoryRemote.class.getName()).log(Level.SEVERE, "Unable to found DirectoryRemote EJB.", ex);
        }
        return directory;
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.