JRun 4.0: Configuring a blank Enterprise Archive (EAR) in JRun 4
Developing J2EE applications in JRun 4 requires the use of an Enterprise Archive (EAR) framework. This TechNote explains how to configure a blank EAR in JRun 4, and provides a link to download a sample EAR file.
J2EE uses an Enterprise Archive (.ear) file to package a complete J2EE application. EAR files may contain both EJB archive files (.jar) and web application archive files (.war).
To develop deployable J2EE applications using JRun 4, an EAR framework is required. The steps to construct an EAR framework are listed as follows:
- Create a directory called jrun-ear in a JRun server root directory:
-
- Create the following directories in the jrun-ear directory:
-
- jrun-war
- jrun-jar
- META-INF (note the capitalization of META-INF)
- Create an application.xml file in the META-INF directory. The application.xml file is the deployment descriptor for Enterprise Archives. This is the file that specifies the application archives (WAR and JAR) that will be loaded as part of this enterprise application.
To enable a simple application.xml (that only includes the simple war and jar created as a part of this application) use the XML below:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN""http://java.sun.com/dtd/application_1_3.dtd"><application><display-name>default-ear</display-name><module><web><web-uri>default-war</web-uri><context-root>/</context-root></web></module><module><ejb>default-ejb</ejb></module></application>
- Create a directory named WEB-INF (note the capitalization of WEB-INF) in the jrun-war directory:
-
- Create a directory called classes in the WEB-INF directory:
-
- Next, create the web.xml file in the {jrun.server.rootdir}/jrun-ear/jrun-war/WEB-INF directory.
-
To enable a simple web application, populate the web.xml file with the XML below as follows:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN""http://java.sun.com/dtd/web-app_2_3.dtd"><web-app><display-name>JRun Default Web Application</display-name><description>The default web application for JRun</description><error-page><error-code>404</error-code><location>/errorPages/404.jsp</location></error-page><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>
- Now, create a directory named META-INF (note the capitalization of META-INF) in the jrun-jar directory:
-
- Create a file named ejb-jar.xml in the {jrun.server.rootdir}/jrun-ear/jrun-jar/META-INF directory. The ejb-jar.xml file is an EJB configuration and deployment descriptor file.
-
If your application does not use EJB, simply use the empty ejb-jar.xml supplied below.<?xml version="1.0"?><!DOCTYPE ejb-jar PUBLIC"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN""http://java.sun.com/dtd/ejb-jar_2_0.dtd"><ejb-jar><enterprise-beans></enterprise-beans></ejb-jar>
After completing these steps, a complete J2EE 1.3 framework for a blank enterprise application will be created in JRun. A zip file containing example XML configuration files is available for download from the Macromedia web site: jrun-ear.zip (3K).
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
