BEA Home | Events | Solutions | Partners | Products | Services | Download | Developer Center | WebSUPPORT
| WebLogic Server Doc Home | Developing Applications | Previous Topic | Next Topic | Contents | Index | View as PDF

Developing WebLogic Server J2EE Applications

The following sections describe how to create different types of WebLogic Server J2EE applications (such as enterprise applications, Web applications, and Enterprise JavaBeans) and set up a development environment:

- Creating Web Applications: Main Steps

- Creating Enterprise JavaBeans: Main Steps

- Creating WebLogic Server Enterprise Applications: Main Steps

- Creating Resource Adapters: Main Steps

- Establishing a Development Environment

- Preparing to Compile

- Editing Deployment Descriptors

WebLogic Server applications are created by Java programmers, Web designers, and application assemblers. Programmers and designers create components that implement the business logic and presentation logic for the application. Application assemblers assemble the components into applications ready to deploy on WebLogic Server.

Creating Web Applications: Main Steps

Creating a Web application requires creating HTML pages, JSPs, servlets, JSP taglibs, and two deployment descriptors, and then packaging everything into a *.war file. The *.war file is deployed on WebLogic Server as a Web application.

Here are the main steps for creating a Web application:

1. Create the HTML pages and JSPs that make up the Web interface of the Web application. Typically, Web designers create these parts of a Web application.

   For detailed information about creating JSPs, refer to Programming WebLogic JSP.

2. Write the Java code for the servlets and the JSP taglibs referenced in JavaServer Pages (JSPs). Typically, Java programmers create these parts of a Web application.

   For detailed information about creating servlets, refer to Programming WebLogic HTTP Servlets.

3. Compile the servlets into class files.

   For detailed information about compiling, refer to Preparing to Compile.

4. Create the web.xml and weblogic.xml deployment descriptors.

   The web.xml file defines each servlet and JSP page and enumerates enterprise beans referenced in the Web application. The weblogic.xml file adds additional deployment information for WebLogic Server.

   You can create the web.xml and weblogic.xml deployment descriptors by hand, or you can use a Java-based utility included in WebLogic Server to automatically generate them. For more information on automatically generating these files, see Automatically Generating Deployment Descriptors.

   See Assembling and Configuring Web Applications for detailed information on the elements in these deployment descriptors and instructions for creating them by hand.

5. Package the HTML pages, servlet class files, JSP files, web.xml, and weblogic.xml files into a Web archive (*.war) file.

   The first step in creating a *.war file is to create a Web application staging directory. JSP pages, HTML pages, and multimedia files referenced by the pages are saved in the top level of the staging directory. Compiled servlet classes, taglibs, and, if desired, servlets compiled from JSP pages are stored under a WEB-INF directory in the staging directory. When the Web application components are all in place in the staging directory, you create the *.war file with the JAR command.

   For detailed information about creating a *.war file, refer to Packaging Web Applications.

6. Auto-deploy the *.war file on WebLogic server for testing purposes.

   While you are testing the Web application you might need to edit the web.xml and weblogic.xml deployment descriptors; you can do this manually, or you can use the deployment descriptor editor in the Administration Console. For detailed information on using the deployment descriptor editor, see Editing Deployment Descriptors.

   Refer to BEA WebLogic Server Administration Guide for detailed information about auto-deploying components and applications.

7. Deploy the *.war file on the WebLogic Server for production use or include it in an enterprise archive (*.ear) file to be deployed as part of an enterprise application. You use the Administration Console to deploy applications and components.

   Refer to BEA WebLogic Server Administration Guide for detailed information about deploying components and applications.

Creating Enterprise JavaBeans: Main Steps

Creating an Enterprise JavaBean requires creating the classes for the particular EJB (session, entity, or message-driven) and the EJB-specific deployment descriptors, and then packaging everything up into an *.ear file to be deployed on WebLogic Server.

Here are the main steps for creating an Enterprise JavaBean:

1. Write the Java code for the various classes required by each type of EJB (session, entity, or message-driven) in accordance with the EJB specification. For example, session and entity EJBs require the following three classes:

   - An EJB home interface

   - A remote interface for the EJB

   - An implementation class for the EJB

     Message-driven beans, however, require only an implementation class.

2. Compile the Java code for the interfaces and implementation into class files.

   For detailed information about compiling, refer to Preparing to Compile.

3. Create the EJB-specific deployment descriptors:

   - ejb-jar.xml describes the EJB type and its deployment properties using a standard DTD from Sun Microsystems.

   - weblogic-ejb-jar.xml adds additional WebLogic Server-specific deployment information.

   - weblogic-cmp-rdbms-jar.xml maps a container-managed entity EJB to tables in a database. This file can must have a different name for each CMP bean packaged in a JAR file. The name of the file is specified in the bean's entry in the weblogic-ejb.jar file.

     You can create the EJB deployment descriptors by hand, or you can use a Java-based utility included in WebLogic Server to automatically generate them. For more information on automatically generating these files, see Automatically Generating Deployment Descriptors.

     For detailed information about the elements in the EJB-specific deployment descriptors and how to create the files by hand, refer to Programming WebLogic Enterprise JavaBeans.

4. Package the class files and deployment descriptors into a *.jar Java archive file

   The first step in creating a *.jar file is to create an EJB staging directory. Place the compiled Java classes in the staging directory and the deployment descriptors in a subdirectory called META-INF. Then run the weblogic.ejbc EJB compiler to generate the stub and skeleton classes into the staging directory. Then you create the EJB archive by executing a jar command like the following in the staging directory:

   jar cvf myEJB.jar *

   For detailed information about creating the EJB *.jar archive file, refer to Packaging Enterprise JavaBeans.

5. Auto-deploy the *.jar EJB archive file on WebLogic server for testing purposes.

   While you are testing the EJB you might need to edit the EJB deployment descriptors; you can do this manually, or you can use the deployment descriptor editor in the Administration Console. For detailed information on using the deployment descriptor editor, see Editing Deployment Descriptors.

   Refer to BEA WebLogic Server Administration Guide for detailed information about auto-deploying components and applications.

6. Deploy the *.jar file on WebLogic Server for production use or include it in an enterprise archive (*.ear) file to be deployed as part of an enterprise application. You use the Administration Console to deploy applications and components.

   Refer to BEA WebLogic Server Administration Guide for detailed information about deploying components and applications.

Creating WebLogic Server Enterprise Applications: Main Steps

Creating a WebLogic Server enterprise application requires creating Web and EJB components, deployment descriptors, and archive files. The result is an enterprise application archive (.ear file), that can be deployed on WebLogic Server.

Here are the main steps for creating a WebLogic Server enterprise application:

1. Create Web and EJB components for your application.

   Programmers create servlets and EJBs using the J2EE APIs for these components. Web designers create Web pages using HTML/XML, and JavaServer Pages.

   For overview information about creating Web and EJB components, refer to Creating Web Applications: Main Steps and Creating Enterprise JavaBeans: Main Steps.

   For detailed information about creating the Java code that makes up the Web and EJB components, refer to Programming WebLogic Enterprise JavaBeans, Programming WebLogic HTTP Servlets, and Programming WebLogic JSP.

2. Create Web and EJB component deployment descriptors.

   Component deployment descriptors are XML documents that provide information needed to deploy the application in WebLogic Server. The J2EE specifications define the contents of some deployment descriptors, such as ejb-jar.xml and web.xml. Additional deployment descriptors supplement the J2EE-specified descriptors with information required to deploy components in WebLogic Server.

   You can create the these deployment descriptors by hand, or you can use a Java-based utility included in WebLogic Server to automatically generate them. For more information on automatically generating these files, see Automatically Generating Deployment Descriptors.

   Refer to Assembling and Configuring Web Applications for detailed information about writing Web component deployment descriptors by hand and to Programming WebLogic Enterprise JavaBeans for detailed information about writing EJB component deployment descriptors by hand.

3. Package the Web and EJB components into their component archive files.

   Component archives are JAR files containing all of the component files, including deployment descriptors. You package Web components into a *.war file and EJB components into an EJB *.jar file.

   Refer to Packaging Web Applications and Packaging Enterprise JavaBeans for detailed information for creating component archives.

4. Create the enterprise application deployment descriptor.

   The enterprise application deployment descriptor, application.xml, lists individual components that are assembled together in an application.

   You can create the application.xml deployment descriptor by hand, or you can use a Java-based utility included in WebLogic Server to automatically generate it. For more information on automatically generating this file, see Automatically Generating Deployment Descriptors.

   Refer to application.xml Deployment Descriptor Elements for detailed information about the elements of the application.xml file.

5. Package the enterprise application.

   Package the Web and EJB component archives along with the enterprise application deployment descriptor into an enterprise archive (*.ear) file. This is the file that is deployed on WebLogic Server. WebLogic Server uses the application.xml deployment descriptor to locate and deploy the individual components packaged in the EAR file.

   For detailed information about creating the Enterprise Application *.ear archive file, refer to Packaging Enterprise Applications.

6. Auto-deploy the *.ear enterprise application on WebLogic server for testing purposes.

   While you are testing the enterprise application you might need to edit the application.xml deployment descriptor; you can do this manually, or you can use the deployment descriptor editor in the Administration Console. For detailed information on using the deployment descriptor editor, see Editing Deployment Descriptors.

   Refer to BEA WebLogic Server Administration Guide for detailed information about auto-deploying components and applications.

7. Deploy the *.ear file on WebLogic Server for production use. You use the Administration Console to deploy applications and components.

   Refer to BEA WebLogic Server Administration Guide for detailed information about deploying components and applications.

Figure 2-1 illustrates the process for developing and packaging WebLogic Server enterprise applications.

Figure 2-1 Creating Enterprise Applications

Creating Resource Adapters: Main Steps

Creating a resource adapter requires creating the classes for a resource adapter and the connector-specific deployment descriptors, and then packaging everything up into an .rar file to be deployed on WebLogic Server.

Creating a New Resource Adapter (.rar)

The following are the main steps for creating a resource adapter (.rar):

1. Write the Java code for the various classes required by resource adapter (ConnectionFactory, Connection, and so on) in accordance with the J2EE Connector Specification, Version 1.0, Proposed Final Draft 2 (http://java.sun.com/j2ee/download.html#connectorspec).

   When implementing a resource adapter, you must specify classes in the ra.xml file. For example:

   - <managedconnectionfactory-class>com.sun.connector.blackbox.LocalTxManagedConnectionFactory</managedconnectionfactory-class>

   - <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>

   - <connectionfactory-impl-class>com.sun.connector.blackbox.JdbcDataSource</connectionfactory-impl-class>

   - <connection-interface>java.sql.Connection</connection-interface>

   - <connection-impl-class>com.sun.connector.blackbox.JdbcConnection</connection-impl-class>

2. Compile the Java code for the interfaces and implementation into class files.

3. Package the Java classes into a Java archive (.jar) file.

   The first step in creating a .jar file is to create a connector staging directory. Place the .jar file in the staging directory and the deployment descriptors in a subdirectory called META-INF.

   Then you create the resource adapter archive by executing a jar command like the following in the staging directory:

   >     jar cvf myRAR.rar *

   For detailed information about creating the resource adapter .jar archive file, refer to Packaging Resource Adapters.

4. Create the resource connector-specific deployment descriptors:

   - ra.xml describes the resource adapter-related attributes type and its deployment properties using a standard DTD from Sun Microsystems.

   - weblogic-ra.xml adds additional WebLogic Server-specific deployment information.

     For detailed information about creating connector-specific deployment descriptors, refer to Programming the WebLogic J2EE Connector Architecture.

5. Create a resource adapter archive file (.rar file).

   1. The first step is to create an empty staging directory.

   2. Place the .rar file containing the resource adapter Java classes in the staging directory.

   3. Then, place the deployment descriptors in a subdirectory called META-INF.

   4. Next, create the resource adapter archive by executing a jar command like the following in the staging directory:

      jar cvf myRAR.rar *

      For detailed information about creating the resource adapter archive file, refer to Packaging Resource Adapters.

6. Auto-deploy the .rar resource adapter archive file on WebLogic server for testing purposes.

   While you are testing the resource adapter you might need to edit the deployment descriptors; you can do this manually, or you can use the deployment descriptor editor in the Administration Console. For detailed information on using the deployment descriptor editor, see Editing Deployment Descriptors.

   Refer to BEA WebLogic Server Administration Guide for detailed information about auto-deploying components and applications.

7. Deploy the .rar resource adapter archive file on WebLogic Server or include it in an enterprise archive (.ear) file to be deployed as part of an enterprise application.

   Refer to BEA WebLogic Server Administration Guide for detailed information about deploying components and applications.

Modifying an Existing Resource Adapter (.rar)

The following is an example of how to take an existing resource adapter (.rar) and modify it for deployment to WebLogic Server. This involves adding the weblogic-ra.xml deployment descriptor and repacking.

1. Create a temporary directory to stage the resource adapter:

   >     	mkdir c:/stagedir

2. Copy the resource adapter that you will deploy into the temporary directory:

   >     	cp blackbox-notx.rar c:/stagedir

3. Extract the contents of the resource adapter archive:

   >     	cd c:/stagedir

   >     	jar xf blackbox-notx.rar

   The staging directory should now contain the following:

   - A jar file containing Java classes that implement the resource adapter

   - A META-INF directory containing the files: Manifest.mf and ra.xml

     Execute these commands to see these files:

     >     	c:/stagedir> ls

     >     		blackbox-notx.jar

     >     		META-INF

     >     	c:/stagedir> ls META-INF

     >     		Manifest.mf

     >     		ra.xml

4. Create the weblogic-ra.xml file. This file is the WebLogic-specific deployment descriptor for resource adapters. In this file, you specify parameters for connection factories, connection pools, and security mappings.

   Refer to Programming the WebLogic J2EE Connector Architecture for more information on the weblogic-ra.xml DTD.

5. Copy the weblogic-ra.xml file into the temporary directory's META-INF subdirectory. The META-INF directory is located in the temporary directory where you extracted the .rar file or in the directory containing a resource adapter in exploded directory format. Use the following command:

   >     	cp weblogic-ra.xml c:/stagedir/META-INF

   >     	c:/stagedir> ls META-INF

   >     		Manifest.mf

   >     		ra.xml

   >     		weblogic-ra.xml

6. Create the resource adapter archive:

   >     	jar cvf blackbox-notx.jar -C c:/stagedir

7. Deploy the resource adapter in WebLogic Server. For more information on deploying a resource adapter in WebLogic Server, see Programming the WebLogic J2EE Connector Architecture.

Establishing a Development Environment

To develop WebLogic Server applications, you need to assemble your software tools and set up an environment for creating, compiling, deploying, testing, and debugging your code. This section helps you start building your toolkit and setting up the compiler-related environment on your development computer.

Software Tools

This section reviews the software required to develop WebLogic Server applications and describes optional tools for development and debugging.

Source Code Editor or IDE

You need a text editor to edit Java source files, configuration files, HTML/XML pages, and JavaServer Pages. An editor that gracefully handles Windows and UNIX line-ending differences is preferred, but there are no other special requirements for your editor.

Java Interactive Development Environments (IDEs) such as WebGain VisualCafé usually include a programmer's editor with custom support for Java. An IDE may also have support for creating and deploying servlets and Enterprise JavaBeans on WebLogic Server, which makes it much easier to develop, test, and debug applications.

You can edit HTML/XML pages and JavaServer Pages with a plain text editor, or use a Web page editor such as DreamWeaver.

XML Editor

You use an XML editor to edit the XML files used by WebLogic Server, such as the EJB and Web application deployment descriptors, the config.xml file, and so on. WebLogic Server includes the following two XML editors:

- Deployment Descriptor Editor, part of the Administration Console

- BEA XML Editor, a stand-alone Java-based editor

For detailed information about using these XML editors, see Editing Deployment Descriptors.

Java Compiler

A Java compiler produces Java class files, containing portable byte code, from Java source. The compiler compiles the Java code you write for your applications, as well as the code generated by the WebLogic RMI, EJB, and JSP compilers.

Sun Microsystems Java 2, Standard Edition includes a Java compiler, javac. If you install the bundled JRE when you install WebLogic Server, the javac compiler is installed on your computer.

Other Java compilers are available for various platforms. You can use a different Java compiler for WebLogic Server application development as long as it produces standard Java .class files. Most Java compilers are many times faster than javac, and some are integrated nicely with an IDE.

Occasionally, a compiler generates optimized code that does not behave well in all Java Virtual Machines (JVMs). When you debug problems, try disabling optimizations, choosing a different set of optimizations, or compiling with javac to rule out your Java compiler as the cause. Always test your code in each target JVM before deploying.

Development WebLogic Server

Never deploy untested code on a WebLogic Server that is serving production applications. This means that you will need a development WebLogic Server in your environment. You can run a development WebLogic Server on the same computer you edit and compile on, or you can use one deployed somewhere on the network.

Java is platform independent, so you can edit and compile code on any platform, and test your applications on development WebLogic Servers running on other platforms. For example, it is common to develop WebLogic Server applications on a PC running Windows or Linux, regardless of the platform where the application is ultimately deployed.

Even if you do not run a development WebLogic Server on your development computer, you must have access to a WebLogic Server distribution to compile your programs. To compile any code using WebLogic or J2EE APIs, the Java compiler needs access to the weblogic.jar file and other JAR files in the distribution directory. Installing WebLogic Server on your development computer makes these files available locally.

Database System and JDBC Driver

Nearly all WebLogic Server applications require a database system. You can use any DBMS that you can access with a standard JDBC driver, but services such as WebLogic JMS require a supported JDBC driver for Oracle, Sybase, Informix, Microsoft SQL Server, IBM DB2, or Cloudscape. Refer to the Platform Support Web pageto find out about supported database systems and JDBC drivers.

JDBC connection pools offer such significant performance advantages that you should only rarely consider writing an application that uses a two-tier JDBC driver directly. Connection pools are a collection of ready-to-use database connections. When a connection pool starts up, it creates a specified number of identical physical database connections. By establishing connections at start-up, the connection pool eliminates the overhead of creating a database connection for each application. BEA recommends that both client and server-side applications obtain connections from a connection pool through a Data Source on the JNDI tree. When finished with a connection, applications return the connection to the connection pool.

Multipools are multiplexers for basic connection pools. To the application they appear exactly as basic pools, but multipools allow you to establish a pool of connection pools, in which the connection attributes vary from connection pool to connection pool. All of the connections in a given connection pool are identical, but the connections in each connection pool in a multipool should vary in some significant way such that an expected failure of one pool will not invalidate another pool in the multipool. Usually these pools will be to different instances of the same database.

Multipools are only useful if there are multiple distinct database instances that can equally handle an application connection, and the application system takes care of synchronizing the databases when application work is distributed among the databases. In rare cases it may be valuable to have the pools to the same database instance, but as different users. This would be useful if the DBA disabled one user, leaving the other user viable.

By default, a clustered multipool provides high availability (DBMS failover). A multipool can be optionally configured to also provide load balancing.

Web Browser

Most J2EE applications are designed to be executed by Web browser clients. WebLogic Server supports the HTTP 1.1 specification and is tested with current versions of the Netscape Communicator and Microsoft Internet Explorer browsers.

When you write requirements for your application, note which Web browser versions you will support. In your test plans, include testing plans for each supported version. Be explicit about version numbers and browser configurations. Will your application support SSL? Test alternative security settings in the browser so that you can tell your users what choices you support.

If your application uses applets, it is especially important to test browser configurations you want to support because of differences in the JVMs embedded in various browsers. One solution is to require users to install the Java plug-in from Sun so that everyone has the same Java run-time version.

Third-Party Software

You can use third-party software products, such as WebGain Studio, WebGain StructureBuilder, and BEA WebLogic Integration Kit for VisualAge for Java, to enhance your WebLogic Server development environment.

For more information, see the BEA WebLogic Developer Tools Resources Web page which provides developer tools information for products that support the BEA application servers.

To download some of these tools, see the BEA WebLogic Server Downloads Web page.

Note: Check with the software vendor to verify software compatibility with your platform and WebLogic Server version.

Preparing to Compile

Compiling Java programs for WebLogic Server is the same as compiling any other Java program. To compile successfully, you must:

- Have the Java compiler in your search path

- Set your classpath so that the Java compiler can find all of the dependent classes

- Specify the output directories for the compiled classes

One way to set up your environment is to create a command file or shell script to set variables in your environment, which you can then pass to the compiler. The setExamplesEnv.cmd (Windows) and setExamplesEnv.sh (UNIX) files in the config/examples directory are examples of this technique.

Putting the Java Tools in Your Search Path

Make sure the operating system can find the compiler and other JDK tools by adding it to the PATH environment variable in your command shell. If you are using the JDK, the tools are in the bin subdirectory of the JDK directory. To use an alternative compiler, such as the sj compiler from WebGain VisualCafé, add the directory containing that compiler to your search path.

For example, if the JDK is installed in /usr/local/java/java130 on your UNIX file system, use a command such as the following to add javac to your path in a Bourne shell or shell script:

>     PATH=/usr/local/java/java130/bin:$PATH; export PATH

To add the WebGain sj compiler to your path on Windows NT or Windows 2000, use a command such as the following in a command shell or in a command file:

>     PATH=c:\VisualCafe\bin;%PATH%

If you are using an IDE, see the IDE documentation for help setting up an equivalent search path.

Setting the Classpath for Compiling

Most WebLogic services are based on J2EE standards and are accessed through standard J2EE packages. The Sun, WebLogic, and other Java classes required to compile programs that use WebLogic services are packaged in the weblogic.jar file in the lib directory of your WebLogic Server installation. In addition to weblogic.jar, include the following in your compiler's CLASSPATH:

- If you are using the version of WebLogic Server 6.1 that is limited to J2EE 1.2 features (rather than the one that also includes J2EE 1.3 features), you must include the j2ee12.jar file in your CLASSPATH before you specify the weblogic.jar file. BEA recommends that you include the j2ee12.jar file in the beginning of your CLASSPATH.

  For more information on the version of J2EE (1.2 or 1.3) that your WebLogic Server instance implements, see J2EE Platform.

- The lib/tools.jar file in the JDK directory, or other standard Java classes required by the Java Development Kit you use.

- Classes for third party Java tools or services your programs import.

- Other application classes referenced by the programs you are compiling.

  Include in your classpath the target directories where the compiler writes the classes you are compiling so that the compiler can locate all of the interdependent classes in your application. The next section has more information on target directories.

Setting Target Directories for Compiled Classes

The Java compiler writes class files in the same directory with the Java source unless you specify an output directory for the compiled classes. If you specify the output directory, the compiler stores the class file in a directory structure that matches the package name. This allows you to compile Java classes into the correct locations in the staging directory you use to package your application. If you do not specify an output directory, you have to move files around before you can create the jar file that contains your packaged component.

J2EE applications consist of modules assembled into an application and deployed on one or more WebLogic Servers or WebLogic clusters. Each module should have its own staging directory so that it can be compiled, packaged, and deployed independently from other modules. For example, you can package EJBs in a separate module, Web components in a separate module, and other server-side classes in another module.

See the setExamplesEnv scripts in the config/examples directory of the WebLogic Server distribution for an example of setting up target directories for the compiler. The scripts set the following variables:

  CLIENT_CLASSES

  The directory where compiled client classes are written. These classes are usually standalone Java programs that connect to WebLogic Server. They do not have to be in the WebLogic Server CLASSPATH.

  SERVER_CLASSES

  The directory where server-side classes are written. These classes include startup classes and other Java classes that must be in the WebLogic Server CLASSPATH when the server starts up. Application classes should usually not be compiled into this directory, because the classes in this directory cannot be redeployed without restarting WebLogic Server.

  EX_WEBAPP_CLASSES

  The directory where classes used by the Web Application are written.

  APPLICATIONS

  The applications directory for the examples domain. Unlike the others, this variable is not used to specify a target for the Java compiler. It is used as a convenient reference to the applications directory in copy commands that move files from source directories into the applications directory. For example, if you have .html, .jsp, and image files in your source tree, you can use the variable in a copy command to install them in your development server.

These environment variables are passed to the compiler in commands such as the following command for Windows:

>     javac -d %SERVER_CLASSES% *.java

If you do not use an IDE, consider writing a make file, shell script, or command file to compile and package your components and applications. Set the variables in the build script so that you can rebuild components by typing a single command.

Editing Deployment Descriptors

You can edit the deployment descriptors of WebLogic applications and components using one of the following tools:

- BEA XML Editor

- Deployment Descriptor Editor from within the Administration Console

Use either editor to update existing elements in, add new elements to, and delete existing elements from the following deployment descriptors:

- web.xml

- weblogic.xml

- ejb-jar.xml

- weblogic-ejb-jar.xml

- weblogic-cmp-rdbms-jar.xml

- ra.xml

- weblogic-ra.xml

- application.xml

Using the BEA XML Editor

To edit XML files, use the BEA XML Editor, an entirely Java-based XML stand-alone editor. It is a simple, user-friendly tool for creating and editing XML files. It displays XML file contents both as a hierarchical XML tree structure and as raw XML code. This dual presentation of the document provides you with the following two methods of editing the XML document:

- The hierarchical tree view allows structured, limited constrained editing, providing you with a set of allowable functions at each point in the hierarchical XML tree structure. The allowable functions are syntactically dictated and in accordance with the XML document's DTD or schema, if one is specified.

- The raw XML code view allows free-form editing of the data.

BEA XML Editor can validate XML code according to a specified DTD or XML schema.

For detailed information about using the BEA XML Editor, see its on-line help.

You can download BEA XML Editor from the BEA dev2dev.

Using the Administration Console Deployment Descriptor Editor

The Administration Console Deployment Descriptor Editor looks very much like the main Administration Console: the left pane lists the elements of the deployment descriptor files in tree form and the right pane contains the form for updating a particular element.

When you use the editor, you can either update the in-memory deployment descriptor only, or update both the in-memory and disk files. When you click the Apply button after updating a particular element, or the Create button to create a new element, only the deployment descriptor in WebLogic Server's memory is updated; the change has not yet been written to disk. To do this you must explicitly click the Persist button. If you do not explicitly persist the changes to disk, the changes will be lost when you stop and restart WebLogic Server.

Editing EJB Deployment Descriptors

This section describes the procedure for editing the following EJB deployment descriptors using the Administration Console Deployment Descriptor Editor:

- ejb-jar.xml

- weblogic-ejb-jar.xml

- weblogic-cmp-rdbms-jar.xml

For detailed information about the elements in the EJB-specific deployment descriptors, refer to Programming WebLogic Enterprise JavaBeans.

To edit the EJB deployment descriptors, follow these steps:

1. Invoke the Administration Console in your browser using the following URL:

   >     http://host:port/console

   where host refers to the name of the computer upon which WebLogic Server is running and port refers to the port number to which it is listening.

2. Click to expand the Deployments node in the left pane.

3. Click to expand the EJB node under the Deployments node.

4. Right-click the name of the EJB whose deployment descriptors you want to edit and choose Edit EJB Descriptor from the drop-down menu. The Administration Console window appears in a new browser.

   The left pane contains a tree structure that lists all the elements in the three EJB deployment descriptors and the right pane contains a form for the descriptive elements of the ejb-jar.xml file.

5. To edit, delete, or add elements in the EJB deployment descriptors, click to expand the node in the left pane that corresponds to the deployment descriptor file you want to edit, as described in the following list:

   - the EJB Jar node contains the elements of the ejb-jar.xml deployment descriptor.

   - the WebLogic EJB Jar node contains the elements of the weblogic-ejb-jar.xml deployment descriptor.

   - the CMP node contains the elements of the weblogic-cmp-rdbms-jar.xml deployment descriptor.

6. To edit an existing element in one of the EJB deployment descriptors, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the element you want to edit.

   2. Click the element. A form appears in the right pane that lists either its attributes or sub-elements.

   3. Edit the text in the form in the right pane.

   4. Click Apply.

7. To add a new element to one of the EJB deployment descriptors, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the name of the element you want to create.

   2. Right-click the element and chose Configure a New Element from the drop-down menu.

   3. Enter the element information in the form that appears in the right pane.

   4. Click Create.

8. To delete an existing element from one of the EJB deployment descriptors, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the name of the element you want to delete.

   2. Right-click the element and chose Delete Element from the drop-down menu.

   3. Click Yes to confirm that you want to delete the element.

9. Once you have made all your changes to the EJB deployment descriptors, click the root element of the tree in the left pane. The root element is the either the name of the EJB *.jar archive file or the display name of the EJB.

10. Click Validate if you want to ensure that the entries in the EJB deployment descriptors are valid.

11. Click Persist to write your edits of the deployment descriptor files to disk in addition to WebLogic Server's memory.

Editing Web Application Deployment Descriptors

This section describes the procedure for editing the following Web application deployment descriptors using the Administration Console Deployment Descriptor Editor:

- web.xml

- weblogic.xml

See Assembling and Configuring Web Applications for detailed information on the elements in the Web application deployment descriptors.

To edit the Web application deployment descriptors, follow these steps:

1. Invoke the Administration Console in your browser using the following URL:

   >     http://host:port/console

   where host refers to the name of the computer upon which WebLogic Server is running and port refers to the port number to which it is listening.

2. Click to expand the Deployments node in the left pane.

3. Click to expand the Web Applications node under the Deployments node.

4. Right-click the name of the Web application whose deployment descriptors you want to edit and choose Edit Web Application Descriptor from the drop-down menu. The Administration Console window appears in a new browser.

   The left pane contains a tree structure that lists all the elements in the two Web application deployment descriptors and the right pane contains a form for the descriptive elements of the web.xml file.

5. To edit, delete, or add elements in the Web application deployment descriptors, click to expand the node in the left pane that corresponds to the deployment descriptor file you want to edit, as described in the following list:

   - the Web App Descriptor node contains the elements of the web.xml deployment descriptor.

   - the WebApp Ext node contains the elements of the weblogic.xml deployment descriptor.

6. To edit an existing element in one of the Web application deployment descriptors, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the element you want to edit.

   2. Click the element. A form appears in the right pane that lists either its attributes or sub-elements.

   3. Edit the text in the form in the right pane.

   4. Click Apply.

7. To add a new element to one of the Web application deployment descriptors, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the name of the element you want to create.

   2. Right-click the element and chose Configure a New Element from the drop-down menu.

   3. Enter the element information in the form that appears in the right pane.

   4. Click Create.

8. To delete an existing element from one of the Web application deployment descriptors, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the name of the element you want to delete.

   2. Right-click the element and chose Delete Element from the drop-down menu.

   3. Click Yes to confirm that you want to delete the element.

9. Once you have made all your changes to the Web application deployment descriptors, click the root element of the tree in the left pane. The root element is the either the name of the Web application *.war archive file or the display name of the Web application.

10. Click Validate if you want to ensure that the entries in the Web application deployment descriptors are valid.

11. Click Persist to write your edits of the deployment descriptor files to disk in addition to WebLogic Server's memory.

Editing Resource Adapter Deployment Descriptors

This section describes the procedure for editing the following resource adapter deployment descriptors using the Administration Console Deployment Descriptor Editor:

- ra.xml

- weblogic-ra.xml

For detailed information about the elements in the resource adapter deployment descriptors, refer to Programming the WebLogic J2EE Connector Architecture.

To edit the resource adapter deployment descriptors, follow these steps:

1. Invoke the Administration Console in your browser using the following URL:

   >     http://host:port/console

   where host refers to the name of the computer upon which WebLogic Server is running and port refers to the port number to which it is listening.

2. Click to expand the Deployments node in the left pane.

3. Click to expand the Connectors node under the Deployments node.

4. Right-click the name of the resource adapter whose deployment descriptors you want to edit and choose Edit Connector Descriptor from the drop-down menu. The Administration Console window appears in a new browser.

   The left pane contains a tree structure that lists all the elements in the two resource adapter deployment descriptors and the right pane contains a form for the descriptive elements of the ra.xml file.

5. To edit, delete, or add elements in the resource adapter deployment descriptors, click to expand the node in the left pane that corresponds to the deployment descriptor file you want to edit, as described in the following list:

   - the RA node contains the elements of the ra.xml deployment descriptor.

   - the WebLogic RA node contains the elements of the weblogic-ra.xml deployment descriptor.

6. To edit an existing element in one of the resource adapter deployment descriptors, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the element you want to edit.

   2. Click the element. A form appears in the right pane that lists either its attributes or sub-elements.

   3. Edit the text in the form in the right pane.

   4. Click Apply.

7. To add a new element to one of the resource adapter deployment descriptors, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the name of the element you want to create.

   2. Right-click the element and chose Configure a New Element from the drop-down menu.

   3. Enter the element information in the form that appears in the right pane.

   4. Click Create.

8. To delete an existing element from one of the resource adapter deployment descriptors, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the name of the element you want to delete.

   2. Right-click the element and chose Delete Element from the drop-down menu.

   3. Click Yes to confirm that you want to delete the element.

9. Once you have made all your changes to the resource adapter deployment descriptors, click the root element of the tree in the left pane. The root element is the either the name of the resource adapter *.rar archive file or the display name of the resource adapter.

10. Click Validate if you want to ensure that the entries in the resource adapter deployment descriptors are valid.

11. Click Persist to write your edits of the deployment descriptor files to disk in addition to WebLogic Server's memory.

Editing Enterprise Application Deployment Descriptors

This section describes the procedure for editing the Enterprise Application deployment descriptor (application.xml) using the Administration Console Deployment Descriptor Editor.

Refer to application.xml Deployment Descriptor Elements for detailed information about the elements of the application.xml file.

Note: The following procedure describes only how to edit the application.xml file; to edit the deployment descriptors in the components that make up the Enterprise application, see Editing EJB Deployment Descriptors, Editing Web Application Deployment Descriptors, or Editing Resource Adapter Deployment Descriptors.

To edit the Enterprise Application deployment descriptor, follow these steps:

1. Invoke the Administration Console in your browser using the following URL:

   >     http://host:port/console

   where host refers to the name of the computer upon which WebLogic Server is running and port refers to the port number to which it is listening.

2. Click to expand the Deployments node in the left pane.

3. Click to expand the Applications node under the Deployments node.

4. Right-click the name of the Enterprise Application whose deployment descriptor you want to edit and choose Edit Application Descriptor from the drop-down menu. The Administration Console window appears in a new browser.

   The left pane contains a tree structure that lists all the elements in the application.xml file and the right pane contains a form for its descriptive elements, such as the display name and icon file names.

5. To edit an existing element in the application.xml deployment descriptor, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the element you want to edit.

   2. Click the element. A form appears in the right pane that lists either its attributes or sub-elements.

   3. Edit the text in the form in the right pane.

   4. Click Apply.

6. To add a new element to the application.xml deployment descriptors, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the name of the element you want to create.

   2. Right-click the element and chose Configure a New Element from the drop-down menu.

   3. Enter the element information in the form that appears in the right pane.

   4. Click Create.

7. To delete an existing element from the application.xml deployment descriptor, follow these steps:

   1. Navigate the tree in the left pane, clicking on parent elements until you find the name of the element you want to delete.

   2. Right-click the element and chose Delete Element from the drop-down menu.

   3. Click Yes to confirm that you want to delete the element.

8. Once you have made all your changes to the application.xml deployment descriptor, click the root element of the tree in the left pane. The root element is the either the name of the Enterprise application *.ear archive file or the display name of the Enterprise application.

9. Click Validate if you want to ensure that the entries in the application.xml deployment descriptor are valid.

10. Click Persist to write your edits of the deployment descriptor files to disk in addition to WebLogic Server's memory.

Copyright © 2001 BEA Systems, Inc. All rights reserved. Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.