![]() |
![]() |
|
|
The Java Simpapp Sample Application
This topic includes the following sections:
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.
How the Java Simpapp Sample Application Works
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:
Figure 2-1 illustrates how the Java Simpapp sample application works.
Figure 2-1 The Java Simpapp Sample Application
Software Prerequisites
To run the idltojava compiler used by the Java Simpapp sample application, you need to install Visual C++.
The OMG IDL Code for the Java Simpapp Sample Application
The Java Simpapp sample application implements the CORBA interfaces listed in Table 2-1:
Interface |
Description |
Operation |
---|---|---|
SimpleFactory |
Creates object references to the Simple object |
find_simple() |
Simple |
Converts the case of a string |
to_upper() to_lower() |
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 Simpapp sample application. 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();
};
Building and Running the Java Simpapp Sample Application
To build and run the Java Simpapp sample application, complete the following steps:
The following sections describe these steps.
Copying the Files for the Java Simpapp Sample Application into a Work Directory
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.
File |
Description |
---|---|
Simple.idl |
The OMG IDL code that declares the Simple and SimpleFactory interfaces.This file is copied from the WebLogic Enterprise simpapp_java directory by the runme command file. |
ServerImpl.java |
The Java source code that overrides the Server.initialize and Server.release methods. |
SimpleClient.java |
The Java source code for the client application in the Java Simpapp sample application. |
SimpleFactoryImpl.java |
The Java source code that implements the SimpleFactory methods. |
SimpleImpl.java |
The Java source code that implements the Simple methods. |
Simple.xml |
The Server Description File used to associate activation and transaction policy values with CORBA interfaces. For the Java Simpapp sample application, the Simple and SimpleFactory interfaces have an activation policy of method and a transaction policy of optional. |
Readme.txt |
Provides the latest information about building and running the Java Simpapp sample application. |
runme.cmd |
The Windows NT batch file that builds and runs the Java Simpapp sample application. |
runme.ksh |
The UNIX Korn shell script that builds and executes the Java Simpapp sample application. |
makefile.mk |
The make file for the Java Simpapp sample application on the UNIX operating system. This file is used to manually build the Java Simpapp sample application. Refer to the Readme.txt file for information about manually building the Java Simpapp sample application. The UNIX make command needs to be in the path of your machine. |
makefiles.nt |
The make file for the Java Simpapp sample application on the Windows NT operating system. This make file can be used directly by the Visual C++ nmake command. This file is used to manually build the Java Simpapp sample application. Refer to the Readme.txt file for information about manually building the Java Simpapp sample application. The Windows NT nmake command needs to be in the path of your machine. |
smakefile.nt |
The make file for the Java Simpapp sample application that is used with Visual Cafe smake command. Note: makefile.nt is included by smakefile.nt. |
Changing the Protection Attribute on the Files for the Java Simpapp Sample Application
During the installation of the WebLogic Enterprise 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
Verifying the Settings of the Environment Variables
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.
Environment Variable |
Description |
---|---|
TUXDIR |
The directory path where you installed the WebLogic Enterprise software. For example: Windows NT TUXDIR=c:\WLEdir UNIX TUXDIR=/usr/local/WLEdir |
JAVA_HOME |
The directory path where you installed the JDK software. For example: Windows NT JAVA_HOME=c:\JDK1.2 UNIX JAVA_HOME=/usr/local/JDK1.2 |
To verify that the information for the environment variables defined during installation is correct, complete 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
Executing the runme Command
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.
Note: The JavaServer will not start on Microsoft Windows NT if JDK bin is in the path after the network drive. Make sure the JDK bin directories (that is, jre/bin and jre/bin/classic) are set in the PATH before any network driver path elements via the Control Panel before booting the JavaServer.
Table 2-4 lists the files in the work directory generated by the runme command.
File |
Description |
---|---|
SimpleFactory.java |
Generated by the m3idltojava command for the SimpleFactory interface. The SimpleFactory interface contains the Java version of the OMG IDL interface. It extends org.omg.CORBA.Object. |
SimpleFactoryHolder.java |
Generated by the m3idltojava command for the SimpleFactory interface.This class holds a public instance member of type SimpleFactory. The class provides operations for out and inout arguments that are included in CORBA, but that do not map exactly to Java. |
SimpleFactoryHelper.java |
Generated by the m3idltojava command for the SimpleFactory interface. This class provides auxiliary functionality, notably the narrow method. |
_SimpleFactoryStub.java |
Generated by the m3idltojava command for the SimpleFactory interface. This class is the client stub that implements the SimpleFactory.java interface. |
_SimpleFactoryImplBase.java |
Generated by the m3idltojava command for the SimpleFactory interface. This abstract class is the server skeleton. It implements the SimpleFactory.java interface. The user-written server class SimpleFactoryImpl extends _SimpleFactoryImplBase. |
Simple.java |
Generated by the m3idltojava command for the Simple interface. The Simple interface contains the Java version of the OMG IDL interface. It extends org.omg.CORBA.Object. |
SimpleHolder.java |
Generated by the m3idltojava command for the Simple interface.This class holds a public instance member of type Simple. The class provides operations for out and inout arguments that CORBA has but that do not match exactly to Java. |
SimpleHelper.java |
Generated by the m3idltojava command for the Simple interface. This class provides auxiliary functionality, notably the narrow method. |
_SimpleStub.java |
Generated by the m3idltojava command for the Simple interface. This class is the client stub that implements the Simple.java interface. |
_SimpleImplBase.java |
Generated by the m3idltojava command for the Simple interface. This abstract class is the server skeleton. It implements the Simple.java interface. The user-written server class SimpleImpl extends _SimpleImplBase. |
Simple.ser |
The Server Descriptor File generated by the buildjobjserver command in the runme command. |
Simple.jar |
The server Java Archive file generated by the buildjavaserver command in the runme command. |
SimpleClient.jar |
The Java Archive file for the client application. It can be used to verify. This file is used during the installation of the WebLogic Enterprise software to insure the client application is installed properly. For information about verifying the installation of the WebLogic Enterprise software, see BEA WebLogic Enterprise Installation Guide. |
.adm/.keybd |
A file that contains the security encryption key database. The subdirectory is created by the tmloadcf command in the runme command. |
results |
A directory generated by the runme command. |
Table 2-5 lists files in the results directory generated by the runme command.
File |
Description |
---|---|
input |
Contains the input that the runme command provides to the Java client application. |
output |
Contains the output produced when the runme command executes the Java client application. |
expected_output |
Contains the output that is expected when the Java client application is executed by the runme command. The data in the output file is compared to the data in the expected_output file to determine whether or not the test passed or failed. |
log |
Contains the output generated by the runme command. If the runme command fails, check this file for errors. |
setenv.cmd |
Contains the commands to set the environment variables needed to build and run the Java Simpapp sample application on the Windows NT operating system platform. |
setenv.ksh |
Contains the commands to set the environment variables needed to build and run the Java Simpapp sample application on the UNIX operating system platform. |
stderr |
Generated by the tmboot command, which is executed by the runme command. If the -noredirect JavaServer option is specified in the UBBCONFIG file, the System.err.println method sends the output to the stderr file instead of to the ULOG file. |
stdout |
Generated by the tmboot command, which is executed by the runme command. If the -noredirect JavaServer option is specified in the UBBCONFIG file, the System.out.println method sends the output to the stdout file instead of to the ULOG file. |
tmsysevt.dat |
Contains filtering and notification rules used by the TMSYSEVT (system event reporting) process. This file is generated by the tmboot command in the runme command. |
tuxconfig |
A binary version of the UBBCONFIG file. |
ubb |
The UBBCONFIG file for the Java Simpapp sample application. |
ULOG.<date> |
A log file that contains messages generated by the tmboot command. |
Using the Java Simpapp Sample Application
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
-DTOBJADDR=%TOBJADDR% SimpleClient
String?
Hello World
HELLO WORLD
hello world
UNIX
ksh prompt>java -classpath .:$TUXDIR/udataobj/java/jdk\
/m3envobj.jar -DTOBJADDR=$TOBJADDR SimpleClient
String?
Hello World
HELLO WORLD
hello world
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.
Using the C++ Client Application with the Java Simpapp Sample 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:
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
Stopping the Java Simpapp Sample Application
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 © 2000 BEA Systems, Inc. All rights reserved.
|