An EJB provider allows you to define a set of client property settings that can be referenced by name when running clients. For example, you might wish all clients to run with data compression enabled. You can define EJB providers with the Management Console or using an XML configuration file. To set up an EJB provider for use by clients, you must:
Deploy the client using an export configuration that includes the EJB provider definition, as described in Chapter 7, “Exporting Server Modules,”in the System Administration Guide.
Add the EAServer lib subdirectory to the operating system library search path. On Windows, add it to the PATH environment variable. On UNIX or Linux, add it to the environment variable that spefies the directory search order to load shared libraries, for example LD_LIBRARY_PATH for Solaris and Linux.
To run clients with the EJB provider settings, specify the name in the value of the java.naming.provider. url property using the format described in “URLs to specify an EJB Provider name”.
Properties set in the EJB provider definition take precedence over those set in the EJB client code or in Java system properties.
EJB providers cannot be used in applets, because this feature requires access to configuration files in the EAServer installation directory.
Creating EJB providers in the Management Console
Start the Management Console and connect to EAServer as described in Chapter 1, “Getting Started,”in the System Administration Guide.
Expand the Naming Providers folder and EJB Providers folder beneath it.
Right-click the EJB Providers folder and choose Add. Run the Add wizard to create the EJB provider with a unique name.
Configure the properties listed in Table 3-2.
Configuring EJB providers in the Management Console
Start the Management Console and connect to EAServer as described in Chapter 1, “Getting Started,”in the System Administration Guide.
Expand the Naming Providers folder and EJB Providers folder beneath it.
Highlight the name of your EJB provider to display its properties in the right frame. Configure the properties listed in Table 3-2. Each property configures the indicated initial context property. See Table 3-1 for descriptions of the initial context properties.
Display name |
Initial context property |
---|---|
JNDI Initial Context Factory |
java.naming.factory.initial |
JNDI Provider URL |
java.naming.provider.url |
JNDI Security Principal (User name) |
java.naming.security.principal |
JNDI Security Credentials (Password) |
java.naming.security.credentials |
Idle Connection Timeout |
com.sybase.ejb. idleConnectionTimeout |
Lookup Cache Timeout |
com.sybase.ejb. lookupCacheTimeout |
Socket Timeout |
com.sybase.ejb. socketTimeout |
Enable Automatic Failover |
com.sybase.ejb. disableAutomaticFailover |
Enable Data Compression |
com.sybase.ejb. enableAutomaticFailover |
Creating and configuring EJB providers in an Ant
configuration file
You can create and configure an EJB provider in Ant configuration files, such as that for the EJB package that contains the components that your application invokes.
Edit the XML configuration file. In a configuration target, add an invocation of the setProperties task with the following format:
<setProperties ejbProvider="provider"> <prop1=”value1”/> <prop2=”value2”/> ... </setProperties>
Where:
provider is the EBJ provider name.
prop1, value1, prop2, value2 are the names and values, respectively, of the properties to be set. Use the initial context property names listed in Table 3-2.
Configure or recompile the entity that uses the configuration file. EAServer creates the EJB provider if it does not exist then sets the properties to match the values given in the configuration file.