6.2. Running the client

The smart factory is configured through two properties.

6.2.1. Initial Context Factory

The first property is the InitialContextFactory name. The smart factory has the name org.objectweb.easybeans.component.smartclient.spi.SmartContextFactory.

This property can be set as a System property :

  • by using -Djava.naming.factory.initial=org.objectweb.easybeans.component.smartclient.spi.SmartContextFactory

  • Or by using System.setProperty(Context.INITIAL_CONTEXT_FACTORY, org.objectweb.easybeans.component.smartclient.spi.SmartContextFactory)

It can also be used as a parameter when creating an InitialContext :

        Hashtable<String, Object> env = new Hashtable<String, Object>();
        env.put(Context.INITIAL_CONTEXT_FACTORY, org.objectweb.easybeans.component.smartclient.spi.SmartContextFactory);
        return new InitialContext(env);

6.2.2. Provider URL

This property is used in order to know the remote address and the remote port.

By default, this property is set (if not defined) to smart://localhost:2503

The port number needs to match the port defined in the EasyBeans configuration file.

This property can be set by using :

        Hashtable<String, Object> env = new Hashtable<String, Object>();
        env.put(Context.INITIAL_CONTEXT_FACTORY, org.objectweb.easybeans.component.smartclient.spi.SmartContextFactory);
        env.put(Context.PROVIDER_URL, "smart://localhost:2503");
        return new InitialContext(env);