Configuring environment properties

Environment properties allow you to specify read-only data for use by an EJB. For example, you might use environment properties to tune the size of a data cache used in your implementation, or to specify the name of a log file. Use environment properties for any constant value that might change when the EJB is deployed to another server.

When coding your EJB, use JNDI to retrieve environment properties, using the prefix java:comp/env in JNDI lookups.

When you export your EJB, the deployment descriptor catalogs the environment properties used by your servlets and JSPs, as well as each property’s Java datatype and default value. When the EJB is imported to another server, the deployer can override the default value for each environment property.

NoteEnvironment properties for EJB 1.0 components An EJB 1.0 component can only have environment properties with datatype String, and these properties must be configured in the Advanced window. Any property name that does not begin with com.sybase.jaguar.component is considered an environment property. In source code, use the EJBContext.getEnvironment method to retrieve property values. You cannot use the JNDI InitialContext.lookup method to retrieve these values.

StepsAdding or editing an EJB environment property

  1. Open the Component Properties dialog box.

  2. Follow the instructions in “Adding an environment property”, or “Editing an environment property”.