Oracle GlassFish Server 3.0.1 Embedded Server Guide

ProcedureTo Use the EJB 3.1 Embeddable API with Embedded GlassFish Server

  1. To specify GlassFish Server as the Container Provider, include glassfish-embedded-static-shell.jar in the class path of your embeddable EJB application.

    See Setting the Class Path and Section 22.3.3 of the EJB 3.1 Specification, Embeddable Container Bootstrapping.

  2. Configure any required resources.

    For more information about configuring resources, see the Administration Console Online Help or Part III, Resources and Services Administration, in Oracle GlassFish Server 3.0.1 Administration Guide. The jdbc/__default Java DB database is preconfigured with all distributions of GlassFish Server.

  3. Invoke one of the createEJBContainer methods.

    Note –

    Do not deploy your embeddable EJB application or any of its dependent Java EE modules before invoking one of the createEJBContainer methods. These methods perform deployment in the background and do not load previously deployed applications or modules.

  4. To change the Instance Root Directory, set the org.glassfish.ejb.embedded.glassfish.instance.root system property value by using the createEJBContainer(Map<?, ?> properties) method.

    The default Instance Root Directory location is as-install/domains/domain1. This system property applies only to embeddable EJB applications used with nonembedded GlassFish Server.

  5. Close the EJB container properly to release all acquired resources and threads.