The smart factory is configured through two properties.
The first property is the InitialContextFactory name. The smart
factory is named
org.ow2.easybeans.component.smartclient.spi.SmartContextFactory.
This property can be set as a System property in one of the following ways:
-
by using -Djava.naming.factory.initial=org.ow2.easybeans.component.smartclient.spi.SmartContextFactory
-
by using System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
org.ow2.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.ow2.easybeans.component.smartclient.spi.SmartContextFactory); return new InitialContext(env);
This property is used to provide the remote address and the remote port.
By default, this property is set (if not defined) to
smart://localhost:2503
The port number must match the port defined in the EasyBeans configuration file.
This property can be set using:
Hashtable<String, Object> env = new Hashtable<String, Object>(); env.put(Context.INITIAL_CONTEXT_FACTORY, org.ow2.easybeans.component.smartclient.spi.SmartContextFactory); env.put(Context.PROVIDER_URL, "smart://localhost:2503"); return new InitialContext(env);