![]() |
![]() |
|
Developing WebLogic Server Components
The following sections describe how to create WebLogic Server components and set up a development envioronment:
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 WebLogic Server Applications: Main Steps
Creating a WebLogic Server application requires creating Web and EJB components, deployment descriptors, and archive files. The result is an enterprise application archive (
Programmers create servlets and enterprise beans using the J2EE APIs for these components. Web designers create Web pages using HTML/XML, and JavaServer Pages.
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
Component archives are JAR files containing all of the files that make up the component, including deployment descriptors.
The application deployement descriptor,
Component archives are packaged with the application deployment descriptor in an application JAR file. This is the file that is deployed on WebLogic Server. WebLogic Server uses the
Figure 2-1 illustrates the process for developing and assembling WebLogic Server applications.
Figure 2-1 Creating Enterprise Applications
Creating Web Applications: Overview
Web designers create HTML pages and JavaServer Pages to create the Web interface for an application. Java programmers create Servlets and the JSP taglibs referenced in JavaServer Pages (JSPs).
JSP pages, HTML pages, and multimedia files referenced by the pages are saved in the top level of the Web application staging directory. Compiled Servlet classes, taglibs, and, if desired, Servlets compiled from JSP pages are stored under a
Two deployment descriptors are created in the
When the Web application components are all in place in the staging directory, you create the Web archive with a command such as the following, executed in the staging directory:
jar cvf myWebApp.war *
The
Creating Enterprise Beans: Overview
A Java programmer creates an enterprise bean by writing three classes, in accordance with the EJB specification:
Message-driven beans require only an implementation class. The interfaces and implementation classes are compiled into a staging directory for the bean.
Deployment descriptors are created in a
See "Programming WebLogic Enterprise JavaBeans" for help creating EJB deployment descriptors.
After the EJB classes are compiled, you run the
The EJB
Creating Enterprise Applications: Overview
When you have assembled all of the Web archives and EJB archives for your application, you can bundle them together in an Enterprise Archive (
Copy the .
Create the Enterprise Archive by executing a
Use the Administration Console or the
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.
This section reviews the software required to develop WebLogic Server applications and describes optional tools for development and debugging.
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.
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,
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
Occasionally, a compiler generates optimized code that does not behave well in all Java Virtual Machines (JVMs). When debugging problems try disabling optimizations, choosing a different set of optimizations, or compiling with
Never deploy untested code on a WebLogic Server that is serving production applications, so 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
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. On a WebLogic cluster, be sure to set up a multipool, which provides load balancing over JDBC connection pools on multiple servers in the cluster.
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.
This section describes several third-party software products that can enhance your WebLogic Server development environment.
Note: Check with the software vendor to verify software compatibility with your platform and WebLogic Server version.
WebGain VisualCafé Enterprise Edition
VisualCafé Enterprise Edition builds on proven Java development technology and delivers a complete Java Integrated Development Environment (IDE) for the heterogeneous enterprise. Enterprise Edition inherits powerful productivity features and database functionality from the VisualCafé family while introducing unique new server-side development and distributed debugging capabilities to minimize the challenges of enterprise Java application development. VisualCafé Enterprise Edition is the most mature and open Java development environment backed by extensive industry wide support.
Cloudscape is the first 100% pure Java SQL database management system. Cloudscape is designed to be embedded in client or server applications as a local data manager. It implements SQL-92 with extensions for Java that enable the developer to create a column of type Java class, and to write stored procedures in Java for execution inside the DBMS.
PowerJ provides a true end-to-end solution for building sophisticated Internet applications, exploiting the benefits of HTML, Java clients, and Java server-side components.
TOPLink for BEA WebLogic is a powerful tool for building EJB applications. TOPLink is seamlessly integrated with BEA WebLogic Server. With TOPLink for BEA WebLogic Server, you can build components for application servers that run on Java, while significantly cutting application development time and expense.
JProbe is a performance-tuning toolkit. With other performance-tuning toolkits, developers working on specific application servers must use command line prompts. Under these circumstances, setting up the session typically involves time-consuming manual configuration, and usually more than a fair share of trial and error. The JProbe 2.5 Server Launch Pad eliminates much of this effort, making server-side tuning fast and easy. JProbe supports many popular Web and application servers, including WebLogic Server.
VERSANT Enterprise Container (VEC) is the integration between a VERSANT ODBMS and an EJB-compliant application server. VEC supports WebLogic Server. VERSANT Enterprise Container is an EJB-compliant container that plugs directly into the application server, allowing transparent persistence for your entity beans. VERSANT Enterprise Container is targeted at applications that have complex object models and require high-performance access to persistent data.
EJB is the standard for building scalable eBusiness applications, from eCommerce, supply-chain, and customer-relationship management, to enterprise information and application portals, and others.
EJB-compliant application servers facilitate the creation, distribution, and integration of eBusiness Java components in the middle tier-but they do not do the same for data. In order to meet or exceed time to market and performance goals, you need a middle-tier data manager like Javlin to complement your EJB server.
ObjectStore is an ideal data management solution for developers creating dynamic, reliable, high-performance applications for telecommunications, packaged software, the Internet and other distributed computing environments.
ObjectStore combines best-of-breed, object data management with Java and C++, and ActiveX to enable the development and delivery of high-speed, complex Web transactions, dynamic content, and network management applications.
Compiling Java programs for WebLogic Server is the same as compiling any other Java program. To compile successfully, you must:
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
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
For example, if the JDK is installed in
PATH=/usr/local/java/java130/bin:$PATH; export PATH
To add the WebGain
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 via standard J2EE packages. The Sun, WebLogic, and other Java classes required to compile programs that use WebLogic services are packaged in the
This
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
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
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.
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|