Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/UserGuide/Packaging an Application"

m (Packaging a POJO Application for Weaving)
m (How to Package an EJB 3.0 Session Bean Application)
Line 67: Line 67:
  
 
===How to Package an EJB 3.0 Session Bean Application===
 
===How to Package an EJB 3.0 Session Bean Application===
For information on how to package an EJB 3.0 session bean application, see [[Packaging%20and%20Deploying%20EclipseLink%20JPA%20(ELUG)|Packaging a EclipseLink JPA Application]].
+
For information on how to package an EJB 3.0 session bean application, see [[Packaging and Deploying EclipseLink JPA Applications (ELUG)|Packaging a EclipseLink JPA Application]].
 
+
 
+
  
 
===How to Create the EclipseLink Domain JAR===
 
===How to Create the EclipseLink Domain JAR===

Revision as of 23:24, 29 November 2007

How you package the components of your application depends on the type of application and how you plan to deploy it.

This section describes EclipseLink-specific details applicable to the common packaging strategies used for various types of applications.


Note: If you are using EJB 3.0, you may be using annotations instead of some deployment files. Include deployment descriptors to override annotations or specify options not supported by annotations.


For more information, see the following:


Packaging Java Applications

For non-Java EE Java applications, it is common to package the application in a single JAR file, as this figure shows.


Packaging a non-Java EE Java Application

Packaging a non-Java EE Java Application

This JAR contains the EclipseLink files and domain objects required by the application, including the following:

  • sessions.xml (see sessions.xml File);
  • project.xml (see project.xml File) (or the compiled Project class file if you are not using XML files for deployment);
  • The mapped classes required by the application, in a fully-resolved directory structure.

When you create the JAR file, the JAR building utility automatically creates a directory structure within the JAR. Ensure that the sessions.xml file and the project.xml file (or project class file) appear at the root of the JAR file. Ensure that the class directory structure starts at the root of the JAR.

If you do not store the project.xml or sessions.xml files at the root of the JAR file, see #Packaging with EclipseLink Metadata File Resource Paths.

Packaging JavaServer Pages and Servlet Applications

For simple Java EE applications without EJB, it is common to package the application in an Enterprise Archive (EAR) file made up of various Java EE application component archives, as this figure shows.


Packaging a Java EE JSP or Servlet Application Without EJB

Packaging a Java EE JSP or Servlet Application Without EJB

The component archives with EclipseLink dependencies include EclipseLink domain JAR (see How to Create the EclipseLink Domain JAR).


How to Create the EclipseLink Domain JAR

The domain JAR contains the EclipseLink files and domain objects required by the application, including the following:

  • sessions.xml (see sessions.xml File);
  • project.xml (see project.xml File) (or the compiled Project class file, if you are not using XML files for deployment);
  • The mapped classes required by the application, in a fully resolved directory structure.

When you create the JAR file, the JAR building utility automatically creates a directory structure within the JAR. Ensure that the sessions.xml file and the project.xml file (or project.class file) appear at the root of the JAR file. Also ensure that the class directory structure starts at the root of the JAR.

If you do not store the project.xml or sessions.xml files at the root of the JAR file, see Packaging with EclipseLink Metadata File Resource Paths.

Packaging Session Bean Applications

This section contains information on How to Package an EJB 3.0 Session Bean Application.


How to Package an EJB 3.0 Session Bean Application

For information on how to package an EJB 3.0 session bean application, see Packaging a EclipseLink JPA Application.

How to Create the EclipseLink Domain JAR

The domain JAR contains the EclipseLink files and domain objects required by the application, including the following:

  • sessions.xml (see sessions.xml File);
  • project.xml (see project.xml File) (or the compiled Project.class file if you are not using XML files for deployment);
  • The mapped classes required by the application, in a fully-resolved directory structure.

When you create the JAR file, the JAR building utility automatically creates a directory structure within the JAR. Ensure that the sessions.xml file and the project.xml file (or project.class file) appear at the root of the JAR file. Also ensure that the class directory structure starts at the root of the JAR.

If you do not store the project.xml or sessions.xml files at the root of the JAR file, see [#Packaging with EclipseLink Metadata File Resource Paths|Packaging with EclipseLink Metadata File Resource Paths].

Packaging JPA Applications

See Packaging a EclipseLink JPA Application for information on how to package your JPA application.


Packaging a POJO Application for Weaving

To package a POJO application for weaving, you create a JAR that contains a sessions.xml file and a persistence.xml file.

For more information on weaving, see To Package a POJO Application for Weaving.

Packaging a EclipseLink Database Web Service

This section describes the following:


How to Package a EclipseLink Database Web Service

To package a EclipseLink database Web service, you can use any development tool that supports Java EE packaging.


To Package a EclipseLink Database Web Service

  1. Generate the EclipseLink database Web service provider WAR file.For more information, see Creating Deployment Files for EclipseLink Database Web Services.
  2. Choose how to package the EclipseLink database Web service depending on how you plan to deploy it:
    1. If you plan to deploy the WAR as a standalone Web module, proceed to step 3.
    2. If you plan to deploy the WAR as part of an existing application, package the EclipseLink database Web service WAR in your application EAR file.
  3. Proceed to Deploying a EclipseLink Database Web Service.

What You May Need to Know About Packaging a EclipseLink Database Web Service

OC4J supports the deployment of a stand-alone Web module.

Typically, you will deploy your EclipseLink database Web service as part of an existing application EAR.

For complete details on packaging a Java EE application, see the Oracle Fusion Middleware Enterprise Architecture and Deployment Guide.

Packaging with EclipseLink Metadata File Resource Paths

If you do not store the project.xml or sessions.xml files at the root of the JAR file, then you must provide the full resource path to the files when accessing them. Ensure that you use "/" in resources paths, not "\". Using "\" will not work in Java.

For example, in the jar element, reference the project.xml and sessions.xml files as follows:

<jar>/myapp/ordersys/persist/sessions.xml
<jar>/myapp/ordersys/persist/project.xml

In the sessions.xml file, reference the project.xml as follows:

myapp/ordersys/persist/project.xml

To acquire the session, use the following:

SessionManager.getManager().getSession(
    new XMLSessionConfigLoader("myapp/ordersys/persist/sessions.xml"),
    "OrdersysSession",
    getClass().getClassLoader()
);

For more information about acquiring sessions at run time, see Acquiring a Session from the Session Manager.




Copyright Statement

Back to the top