![]() |
![]() |
BEA WebLogic Enterprise 4.2 Developer Center |
![]() HOME | SITE MAP | SEARCH | CONTACT | GLOSSARY | PDF FILES | WHAT'S NEW |
||
![]() GETTING STARTED | TABLE OF CONTENTS | PREVIOUS TOPIC | NEXT TOPIC | INDEX |
The chapter discusses the following topics:
Refer to 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:
Readme.txt
in the \WLEdir\samples\corba\simpapp_java
directory for troubleshooting information and the latest information about using the Java Simpapp sample application.
How the Java Simpapp Sample Application Works
upper
method accepts a string from the Java client application and converts the string to uppercase letters.
Figure 2-1 illustrates how the Java Simpapp sample application works.
Figure 2-1 The Java Simpapp Sample Application
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:
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 lower case (return a new string)
string to_lower(in string val);
//Convert a string to upper case (in place)
void to_upper(inout string val);
};
interface SimpleFactory
{
Simple find_simple();
};
Perform the following steps to build and run 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.
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.
TUXDIR
and JAVA_HOME
.
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:
tmboot
command
tmshutdown
command
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:
TMSYSEVT
The BEA TUXEDO system event broker.
TMFFNAME
The following three TMFFNAME
server processes are started:
TMFFNAME
server process started with the -N
and -M
options is the master NameManager service. The NameManager service maintains a mapping of the application-supplied names to object references.
TMFFNAME
server process started with only the -N
option is the slave NameManager service.
TMFFNAME
server process started with the -F
option contains the FactoryFinder object.
JavaServer
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.
ISL
Table 2-4 lists the files in the work directory generated by the
Table 2-5 lists files in the
This section describes how to use the Java Simpapp sample application after the Run the Java server application in the Java Simpapp sample application, as follows:
Windows NT
UNIX
Run the Java client application in the Java Simpapp sample application, as follows:
Windows NT
UNIX
Note:
The Java Simpapp sample client application uses the client-only JAR file 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:
runme
command.
results
directory generated by the runme
command.
Using the Java Simpapp Sample Application
runme
command is executed.
prompt>tmboot
ksh prompt>tmboot
prompt>java -classpath .;%TUXDIR%\udataobj\java\jdk\m3envobj.jar
-DTOBJADDR=%TOBJADDR% SimpleClient
String?
Hello World
HELLO WORLD
hello worldksh prompt>java -classpath .:$TUXDIR/udataobj/java/jdk\
/m3envobj.jar -DTOBJADDR=$TOBJADDR SimpleClient
String?
Hello World
HELLO WORLD
hello worldm3envobj.jar
. However, you could also use the m3.jar
file to run the client application.
Using the C++ Client Application with the Java Simpapp Sample Application
Windows NT
UNIX
Note:
The work directory for the Java Simpapp sample application cannot be the same as the work directory for the C++ Simpapp sample application.
\WLEdir\samples\CORBA\simpapp_java
/usr/local/WLEdir/samples/corba/simapp_java
Windows NT
UNIX
prompt>attrib -r
drive:
\workdirectory
\*.*
prompt>/bin/ksh
ksh prompt>chmod u+w /
workdirectory
/*.*
make
command or the Windows NT nmake
command is in
the path of your machine.
M3SIMPDIR
environment variable to your work directory.
Windows NT
UNIX
prompt>cd %M3SIMPDIR
prompt>nmake -f makefile.nt simple_client.exe
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