WebLogic for IBM AS/400e Technical FAQ
AS/400-specific differences in WebLogic
In general, how does WebLogic on the AS/400 differ from WebLogic on Windows or UNIX?
The WebLogic Java code is the same on all platforms. IBM has created a Java environment for the AS/400 that is highly compatible with the Java standard and at the same time able to exploit the strengths of the AS/400. WebLogic is packaged for the AS/400 by creating direct executables for all class files, adding AS/400 installation commands, and creating a save file that you restore on your AS/400.
If you use WebLogic on Windows NT or UNIX, you will notice some differences when you run WebLogic on the AS/400. The differences are environmental, resulting from the Java virtual machine on the AS/400, the powerful security system on the AS/400, or the design of the OS/400 operating system. Also, since the AS/400 is designed as a business server, you cannot run the graphical interfaces provided with the WebLogic Server on the AS/400 -- you must run them from a client computer.
One of the primary features of the AS/400 Java environment is the direct executable. The AS/400 JVM transforms Java class files into AS/400 direct executables, resulting in faster execution than a standard Java byte code interpreter. Although this conversion happens automatically, it can be time-consuming and produce noticeable pauses in execution. Also, the AS/400 CRTJVAPGM command that creates direct executables is capable of various levels of optimization. The WebLogic classes are transformed to direct executables with maximum optimization. We recommend that you also transform your own Java classes before you place your application into production on an AS/400.
WebLogic for IBM AS/400 installs in the AS/400 IFS in the /weblogic/version directory, where version is the three-digit WebLogic release number. For example, WebLogic release 4.5.0 installs into the /weblogic/450 IFS directory. On UNIX and Windows, the installation location can be selected at installation time. The WebLogic documentation often refers to the weblogic/ directory as the WebLogic installation directory. For AS/400, you can map this to /weblogic/version.
The WebLogic Server runs on the AS/400. Other WebLogic utility programs and example programs can also run on the AS/400 if they do not require a windowing system. However, some WebLogic programs, such as the WebLogic Console and the ZAC must be run on a Windows NT client workstation. The programs can be loaded from the AS/400 and executed in a JVM on the workstation.
The example files in the /weblogic/version/examples directory cannot be altered without special permissions. To try the examples out, first copy them to another directory. You can use the build scripts for Windows NT to build the examples on a workstation.
The V4R3 JVM restricts .jar files to 2MB. Therefore, in the V4R3 version, the weblogicaux.jar file is provided as four .jar files named weblogicaux0.jar, weblogicaux1.jar, and weblogicaux2.jar. You must place each of these files in the AS/400's CLASSPATH and in any client CLASSPATH that executes WebLogic programs from the AS/400 file system.
The limit on .jar file size does not exist on V4R4, so the weblogicaux.jar file is a single .jar file in the WebLogic release for V4R4.
General questions about Java on AS/400
Java source code (.java files) and other files such as the WebLogic properties file (/weblogic/version/weblogic.properties) are ASCII stream files in the AS/400 IFS. You can't use the source entry utility (SEU) to edit these files directly. Here are four alternatives for editing these files:
How do I set the WebLogic classpath on the AS/400?
Before you start the WebLogic Server, or run any of the WebLogic utility programs on the AS/400, you must add the WebLogic classes to your classpath. The classpath must contain these directories and .jar files:
The version directory is the WebLogic release number. For example, WebLogic version 4.5.0 installs into the /weblogic/450 directory.
There are a number of ways to set your classpath on the AS/400:
Here is the command to set the classpath on a V4R3 AS/400 using the ADDENVVAR command. (The command is displayed on several lines here for clarity, but you should type it without line breaks when you enter it.)
===> ADDENVVAR ENVVAR(CLASSPATH) VALUE( '.:/weblogic/version/classes: /weblogic/version/license: /weblogic/version/lib/weblogicaux0.jar: /weblogic/version/lib/weblogicaux1.jar: /weblogic/version/lib/weblogicaux2.jar')
How do I set the WebLogic classpath on a client workstation?
To run WebLogic utility programs on a client workstation, you first add the WebLogic classes to the workstation's CLASSPATH environment variable. The workstation must have Client Access installed, or a similar utility that allows the client to have network access to the AS/400 file system.
Your classpath also needs to include the Java runtime classes.
In the following example, drive F: is mapped to the AS/400 file system, and the JDK is installed in the c:\jdk directory. The command, for a V4R3 system, is shown on multiple lines for readability, but you should type it as a single command with no breaks:
C:\>SET CLASSPATH=c:\jdk\lib\classes.zip; f:\weblogic\version\classes; f:\weblogic\version\license; f:\weblogic\version\lib\weblogicaux0.jar; f:\weblogic\version\lib\weblogicaux1.jar; f:\weblogic\version\lib\weblogicaux2.jar
Why does the WebLogic Server still not find classes when I've set the classpath?
If you are having trouble with CLASSPATH on the AS/400, here are a couple of things to look for:
For more help on setting your classpath, check our Administrators Guide, Setting classpath.
You can use Qshell to run Java programs and WebLogic utilities, such as utils.t3dbping and utils.licenses.
Warning. Never start the WebLogic Server on the AS/400 with java commands described in the WebLogic documents. Always use the WEBLOGIC/STRWEBL command to start the WebLogic Server because it runs the server as the WEBLOGIC user. If you run the WebLogic Server using a java command, the server runs under your current user profile. Depending on your profile, the WebLogic Server will have security problems when you run this way, or in subsequent sessions that start with the WEBLOGIC/STRWEBL command.
Your classpath must include the WebLogic classes. With Qshell, you must also set the QIBM_MULTI_THREADED environment variable to 'Y' before you run the JAVA or RUNJAVA commands.
If you set environment variables in your AS/400 command session before you start Qshell, the variables remain set in Qshell, unless a .profile file in your home directory or the /etc/profile file resets environment variables.
You can set environment variables for every interactive Qshell shell you start with STRQSH or QSH by setting the CLASSPATH in the .profile file in your home directory.
An administrator can set environment variables globally by adding them to the /etc/profile file, which is executed whenever any user starts a Qshell shell with the STRQSH or QSH commands.
To set the environment variables in Qshell, use the following commands at the prompt, or add them to one of the profile files mentioned above:
$ export -s CLASSPATH=.:/weblogic/version/classes: /weblogic/version/license: /weblogic/version/lib/weblogicaux0.jar: /weblogic/version/lib/weblogicaux1.jar: /weblogic/version/lib/weblogicaux2.jar $ export -s QIBM_MULTI_THREADED=Y
How can I improve Java performance on my AS/400?
The most important factor contributing to the performance of AS/400 Java applications is the use of the CRTJVAPGM command. This command transforms Java class and jar files to program objects that contain fully compiled 64-bit RISC machine instructions. The resulting object is called a DE (Direct Executable). If a DE exists before the JVM executes a class, there is a dramatic increase in performance. On the other hand, if the DE does not exist, the JVM creates a DE on the fly, and performance suffers. The next question has information about creating a DE.
There are many other ways to improve and analyze performance of AS/400 Java applications. A good starting place is AS/400e series Java Information on the Web, particularly Building AS/400 Applications with Java. This is the IBM Redbook titled "AS/400 Appls with Java-Version 2". It covers many topics including performance analysis and enhancement.
If you install or modify Java class files called by the WebLogic Server, you can boost performance by creating an AS/400 direct executable for the class with the CRTJVAPGM command. Running this command once prevents the AS/400 JVM from compiling the class every time it is loaded.
In particular, when you Install a WebLogic license, you modify the WebLogicLicense.java file and run the JAVA command to create a new class file. On the AS/400, you should then run the CRTJVAPGM command on the WebLogicLicense.class file so that the class is not recompiled whenever it is loaded.
Here is the command to create a direct executable for the WebLogic license class:
===> CRTJVAPGM CLSF('/weblogic/version/classes/WebLogicLicense.class') OPTIMIZE(40)
You can choose an optimization level of 0, 10, 20, 30, or 40. A higher level spends more time, but produces a faster direct executable. The WebLogic direct executables are produced at optimization level 40.
The AS/400 Toolbox for Java includes Access classes that provide access to various AS/400 services, including the ability to run AS/400 programs and CL commands, and access AS400 files and objects. In Java, you create an AS400 object for a specified AS/400 Server and then use methods on that object to access AS/400 facilities. See the AS/400 Toolbox for Java web page for examples and more information.
The WEBLOGIC/STRWEBL command's default value for the "Garbage collection initial size" parameter is 65536 (64MB). The default for the "Garbage collection maximum size" is *NOMAX.
If you change these parameters, you should allocate at least 65536 kilobytes for the garbage collection initial size parameter. If you choose to change *NOMAX to a specific value for the maximum garbage collection size, make sure that you use a size greater than the initial size, because the AS/400 JVM's garbage collection mechanism performance degrades when the initial and maximum garbage collection memory sizes are equal. The STRWEBL command will not permit a maximum smaller than the initial size.
Questions about installation
How do I give WLADMIN privileges to a user?
WebLogic administrative users have *ALL authority for the commands in the WEBLOGIC library and *RWX authority on certain files in the /weblogic directory. To allow a user to start and stop the server or to modify any of these files, you can add GRPPRF(WLADMIN) to their profiles.
To create a new user with authority to administer the WebLogic Server, use this command:
===> CRTUSRPRF USRPRF(USERNAME) GRPPRF(WLADMIN)
To add authority to administer the WebLogic Server to an existing user, use this command:
===> CHGUSRPRF USRPRF(USERNAME) GRPPRF(WLADMIN)
Installation failed. How can I find the problem?
If the WEBLOGIC/INSWEBL command fails, follow this procedure to retry the installation and identify the failure:
How do I uninstall WebLogic?
Follow these steps to uninstall WebLogic:
Questions about using DB2 with WebLogic
How do I set up DB2 for use with WebLogic?
You can use the WebLogic Server in a multitier JDBC connection to DB2 -- the client application connects to the WebLogic Server using WebLogic JDBC, and the WebLogic Server connects to DB2 using one of IBM's JDBC drivers for DB2.
You can define a connection pool in the weblogic.properties file. The connection pool specifies a number of database connections that the WebLogic Server opens and allocates to clients that request them. Opening a database connection is a fairly expensive operation, and setting up a pool of shared connections minimize the number of open operations. A pool is especially beneficial when a large number of clients execute short-duration transactions.
Before the WebLogic Server can connect to DB2, there must be an entry in the AS/400 Relational Database Directory. You can use the DSPRDBDIRE command to see if the entry has been made. If there is no entry, use the ADDRDBDIRE entry to add the entry.
the WebLogic Server also requires a JDBC driver for DB2. The next question describes the JDBC drivers available from IBM.
To define a connection pool, you add a weblogic.jdbc.connectionPool property to the weblogic.properties file. Here is the syntax for the property:
weblogic.jdbc.connectionPool.virtualName=\ url=jdbc:db2:rdbdire/defCollection,\ driver=jdbcDriver,\ initialCapacity=initialN,\ maxCapacity=maxN,\ capacityIncrement=incrementInterval,\ props=jdbcConnectionProps
If you have problems with a DB2 JDBC connection, this AS/400 JDBC FAQ is a good place to look for help.
Here is an example connection pool, with the virtual name "finance", that uses the Type 2 JDBC driver. The database name (displayed by the DSPRDBDIRE command) is "FIN400E". The pool is defined so that the WebLogic Server does not open any connections until one is requested, and then opens 3 connections at a time until a maximum of 12 connections are in the pool. The connections are opened by user "nick" with the password "HedGe!HoG89".
weblogic.jdbc.connectionPool.finance=\ url=jdbc:db2://FIN400E,\ driver=com.ibm.db2.jdbc.app.DB2Driver,\ initialCapacity=0,\ maxCapacity=12,\ capcityIncrement=3,\ props=user=nick;password=HedGe!HoG89;server=LOCALHOST
A connection pool also requires an ACL to allow clients to obtain a connection from the pool, and an ACL that allows someone to reset the connection pool if needed:
For example, the following ACLs allow anyone (group "everyone") to use a connection from the "finance" pool, but only users "nick" and "tracey" can reset the connection pool:
weblogic.allow.reserve.weblogic.jdbc.connectionPool.finance=everyone weblogic.allow.reset.weblogic.jdbc.connectionPool.finance=nick tracey
IBM provides type 2 and type 4 JDBC drivers for AS/400 DB2. The type 2 driver is native AS/400 code, appropriate when a Java application (such as the WebLogic Server) and DB2 are executing on AS/400 machines. The type 4 driver is pure Java and can execute on the AS/400 or on another platform running Java. If you run WebLogic on a non-AS/400 computer, you must use the type 4 driver on that computer. Also, if you write applets that are served by WebLogic on the AS/400 computer, you must install the type 4 driver so that browsers on any platform can access DB2 on the AS/400.
The type 2 driver is packaged with the AS/400 Developer Kit for Java (5769-JV1). The type 4 driver is packaged with AS/400 Toolbox for Java (5769-JC1).
When you use a JDBC driver, whether in a two-tier or three-tier configuration, you need to know the full pathname to the driver class file and the connect URL for the driver. Here is the information you need for the AS/400 type 2 and type 4 drivers:
Copyright © 2000 BEA Systems, Inc. All rights reserved.