|
|
The chapter discusses the following topics:
Refer to Readme.txt
in the \WLEdir\samples\corba\simpapp_java
directory for troubleshooting information and the latest information about using the Java Simpapp sample application.
The Java Simpapp sample application consists of a Java client application that sends requests to a Java server application. The Java server application provides an implementation of a CORBA object that has the following two methods:
How the Java Simpapp Sample Application Works
Figure 2-1 illustrates how the Java Simpapp sample application works.
To run the idltojava compiler used by the Java Simpapp sample application, you need to install Visual C++ Version 5.0 with Service Pack 3 for Visual Studio.
The Java Simpapp sample application implements the CORBA interfaces listed in Table 2-1:
Interface |
Description |
Operation |
---|---|---|
Listing 2-1 shows the simple.idl
file that defines the CORBA interfaces in the Java Simpapp sample application. This is the same OMG IDL file used by the C++ Simpapp sample application shipped with version 4.2 of the WebLogic Enterprise (WLE) software. The runme
command automatically copies it from the \corba\simpapp_java
directory.
Listing 2-1
OMG IDL Code for the Java Simpapp Sample Application
#pragma prefix "beasys.com" interface Simple //Convert a string to upper case (in place) interface SimpleFactory Perform the following steps to build and run the Java Simpapp sample application:
{
//Convert a string to lower case (return a new string)
string to_lower(in string val);
void to_upper(inout string val);
};
{
Simple find_simple();
};Building and Running the Java Simpapp Sample Application
The following sections describe these steps.
You need to copy the files for the Java Simpapp sample application into a work directory on your local machine. The files for the Java Simpapp sample application are located in the following directories:
Windows NT
drive:\WLEdir \samples\corba\simpapp_java
UNIX
/usr/local/WLedir /samples/corba/simapp_java
You will use the files listed in Table 2-2 to build and run the Java Simpapp sample application.
During the installation of the WLE software, the sample application files are marked read-only. Before you can edit or build the files in the Java Simpapp sample application, you need to change the protection attribute of the files you copied into your work directory, as follows:
Windows NT
prompt>attrib -r
drive:
\workdirectory
\*.*
UNIX
prompt>/bin/ksh
ksh prompt>chmod u+w /
workdirectory
/*.*
On the UNIX operating system platform, you also need to change the permission of runme.ksh
to give execute permission to the file, as follows:
ksh prompt>chmod +x runme.ksh
Before building and running the Java Simpapp sample application, you need to ensure that certain environment variables are set on your system. In most cases, these environment variables are set as part of the installation procedure. However, you need to check the environment variables to ensure they reflect correct information.
Table 2-3 lists the environment variables required to run the Java Simpapp sample application.
Changing the Protection Attribute on the Files for the Java Simpapp Sample Application
Verifying the Settings of the Environment Variables
To verify that the information for the environment variables defined during installation is correct, perform the following steps:
Windows NT
The Control Panel appears.
The System Properties window appears.
The Environment page appears.
UNIX
ksh prompt>printenv TUXDIR
ksh prompt>printenv JAVA_HOME
To change the settings, perform the following steps:
Windows NT
UNIX
ksh prompt>export TUXDIR= directorypath
ksh prompt>export JAVA_HOME= directorypath
The runme command automates the following steps:
Note: You can also run the Java Simpapp sample application manually. The steps for manually running the Java Simpapp sample application are described in the Readme.txt file.
To build and run the Java Simpapp sample application, enter the runme command, as follows:
Windows NT
prompt>cd workdirectory
prompt>runme
UNIX
ksh prompt>cd workdirectory
ksh prompt>./runme.ksh
The Java Simpapp sample application runs and prints the following messages:
Testing simpapp
cleaned up
prepared
built
loaded ubb
booted
ran
shutdown
saved results
PASSED
Note: After executing the runme command, you may get a message indicating the Host, Port , and IPCKEY parameters in the UBBCONFIG file conflict with an existing UBBCONFIG file. If this occurs, you need to set these parameters to different values to get the Java Simpapp sample application running on your machine. See the Readme.txt file for information about how to set these parameters.
The runme command starts the following application processes:
The BEA TUXEDO system event broker.
The following three TMFFNAME server processes are started:
The Java Simpapp sample application server process. The JavaServer process has one option, simple , which is the Java Archive (JAR) file that was created for the application.
The IIOP Listener process.
Table 2-4 lists the files in the work directory generated by the runme
command.
Table 2-5 lists files in the results
directory generated by the runme
command.
This section describes how to use the Java Simpapp sample application after the runme
command is executed.
Run the Java server application in the Java Simpapp sample application, as follows:
Windows NT
prompt>tmboot
UNIX
ksh prompt>tmboot
Run the Java client application in the Java Simpapp sample application, as follows:
Windows NT
prompt>java -classpath .;%TUXDIR%\udataobj\java\jdk\m3envobj.jar UNIX
ksh prompt>java -classpath .:$TUXDIR/udataobj/java/jdk\
Note:
The Java Simpapp sample client application uses the client-only JAR file m3envobj.jar
. However, you could also use the m3.jar
file to run the client application.
A C++ client application is provided with the Java Simpapp sample application to demonstrate interoperabililty between a Java server application and a C++ client application. This section describes the process of building and running the C++ client application.
Build the C++ client application in the Java Simpapp sample application as follows:
Using the Java Simpapp Sample Application
-DTOBJADDR=%TOBJADDR% SimpleClient
String?
Hello World
HELLO WORLD
hello world
/m3envobj.jar -DTOBJADDR=$TOBJADDR SimpleClient
String?
Hello World
HELLO WORLD
hello worldUsing the C++ Client Application with the Java Simpapp Sample Application
Windows NT
\WLEdir\samples\CORBA\simpapp_java
UNIX
/usr/local/WLEdir/samples/corba/simapp_java
Note: The work directory for the Java Simpapp sample application cannot be the same as the work directory for the C++ Simpapp sample application.
Windows NT
prompt>attrib -r drive: \workdirectory \*.*
UNIX
prompt>/bin/ksh
ksh prompt>chmod u+w / workdirectory /*.*
Windows NT
prompt>cd %M3SIMPDIR
prompt>nmake -f makefile.nt simple_client.exe
UNIX
ksh prompt>cd %M3SIMPDIR
ksh prompt>make -f makefile.mk simple_client
Run the Java server application in the Java Simpapp sample application, as follows:
Windows NT
prompt>tmboot
UNIX
ksh prompt>tmboot
Run the C++ client application in the Java Simpapp sample application, as follows:
Windows NT
prompt>%M3SIMPDIR%\simple_client
String? Hello
HELLO
hello
UNIX
ksh prompt>$M3SIMPDIR/simple_client
String? Hello
HELLO
hello
Before using another sample application, enter the following commands to stop the Java Simpapp sample application and to remove unnecessary files from the work directory:
Windows NT
prompt>tmshutdown -y
prompt>nmake -f makefile.nt clean
UNIX
ksh prompt>tmshutdown -y
ksh prompt>make -f makefile.mk clean
|
Copyright © 1999 BEA Systems, Inc. All rights reserved.
|