2012年7月9日月曜日

Oracle TuxedoのATMIサンプルをローカル環境で動かす

インストール後の作業の手順通りです。
まずはtuxedo11gR1/tux.envの内容を実行して環境変数を設定する。
[tuxedo@centos ~]$ TUXDIR=/home/tuxedo/tuxedo11gR1; export TUXDIR
[tuxedo@centos ~]$ JAVA_HOME=$TUXDIR/jre; export JAVA_HOME
[tuxedo@centos ~]$ JVMLIBS=$JAVA_HOME/lib/i386/server:$JAVA_HOME/jre/bin
[tuxedo@centos ~]$ PATH=$TUXDIR/bin:$JAVA_HOME/bin:$PATH; export PATH
[tuxedo@centos ~]$ COBCPY=:$TUXDIR/cobinclude; export COBCPY
[tuxedo@centos ~]$ COBOPT="-C ANS85 -C ALIGN=8 -C NOIBMCOMP -C TRUNC=ANSI -C OSEXT=cbl"; export COBOPT
[tuxedo@centos ~]$ SHLIB_PATH=$TUXDIR/lib:$JVMLIBS:$SHLIB_PATH; export SHLIB_PATH
[tuxedo@centos ~]$ LIBPATH=$TUXDIR/lib:$JVMLIBS:$LIBPATH; export LIBPATH
[tuxedo@centos ~]$ LD_LIBRARY_PATH=$TUXDIR/lib:$JVMLIBS:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
[tuxedo@centos ~]$ WEBJAVADIR=$TUXDIR/udataobj/webgui/java; export WEBJAVADIR
サンプルアプリをコピーしてアプリ用の環境変数を設定する。
[tuxedo@centos ~]$ mkdir atmi
[tuxedo@centos ~]$ cd atmi
[tuxedo@centos atmi]$ cp $TUXDIR/samples/atmi/simpapp/* .
[tuxedo@centos atmi]$ APPDIR=/home/tuxedo/atmi
[tuxedo@centos atmi]$ TUXCONFIG=$APPDIR/tuxconfig
[tuxedo@centos atmi]$ export APPDIR TUXCONFIG
サーバーアプリとクライアントアプリを作成する。警告が出るけどスルーします。たぶんstdlibのインクルードがなさげ。
[tuxedo@centos atmi]$ buildclient -o simpcl -f simpcl.c 
simpcl.c: In function ‘main’:
simpcl.c:34: 警告: incompatible implicit declaration of built-in function ‘exit’
simpcl.c:40: 警告: incompatible implicit declaration of built-in function ‘exit’
simpcl.c:43: 警告: incompatible implicit declaration of built-in function ‘strlen’
simpcl.c:50: 警告: incompatible implicit declaration of built-in function ‘exit’
simpcl.c:57: 警告: incompatible implicit declaration of built-in function ‘exit’
simpcl.c:60: 警告: incompatible implicit declaration of built-in function ‘strcpy’
simpcl.c:71: 警告: incompatible implicit declaration of built-in function ‘exit’
[tuxedo@centos atmi]$ buildserver -o simpserv -f simpserv.c -s TOUPPER
$APPDIR/ubbsimpleを編集する。マシン名のところ(centosの部分)は'uname -n'の実行結果を設定すること。
[tuxedo@centos atmi]$ vi ubbsimple 
#       (c) 2003 BEA Systems, Inc. All Rights Reserved.
#ident  "@(#) samples/atmi/simpapp/ubbsimple    $Revision: 1.7 $"

#Skeleton UBBCONFIG file for the TUXEDO Simple Application.
#Replace the  items with the appropriate values.

*RESOURCES
IPCKEY          123456

#Example:
#IPCKEY         123456

DOMAINID        simpapp
MASTER          simple
MAXACCESSERS    10
MAXSERVERS      5
MAXSERVICES     10
MODEL           SHM
LDBAL           N

*MACHINES
DEFAULT:
                APPDIR="/home/tuxedo/atmi"
                TUXCONFIG="/home/tuxedo/atmi/tuxconfig"
                TUXDIR="/home/tuxedo/tuxedo11gR1"
#Example:
#               APPDIR="/home/me/simpapp"
#               TUXCONFIG="/home/me/simpapp/tuxconfig"
#               TUXDIR="/usr/tuxedo"

centos          LMID=simple

#Example:
#beatux         LMID=simple

*GROUPS
GROUP1
        LMID=simple     GRPNO=1 OPENINFO=NONE

*SERVERS
DEFAULT:
                CLOPT="-A"

simpserv        SRVGRP=GROUP1 SRVID=1

*SERVICES
TOUPPER

設定ファイルをバイナリ変換してサーバーを起動する。
[tuxedo@centos atmi]$ tmloadcf -y ubbsimple 
[tuxedo@centos atmi]$ tmboot -y
Booting all admin and server processes in /home/tuxedo/atmi/tuxconfig
INFO: Oracle Tuxedo, Version 11.1.1.2.0, 32-bit, Patch Level (none)

Booting admin processes ...

exec BBL -A :
        process id=13381 ... Started.

Booting server processes ...

exec simpserv -A :
        process id=13384 ... Started.
2 processes started.
クライアントアプリを起動して動作確認する。
[tuxedo@centos atmi]$ ./simpcl "hello world"
Returned string is: HELLO WORLD
[tuxedo@centos atmi]$ 
サーバーを停止する。
[tuxedo@centos atmi]$ tmshutdown -y
Shutting down all admin and server processes in /home/tuxedo/atmi/tuxconfig

Shutting down server processes ...

        Server Id = 1 Group Id = GROUP1 Machine = simple:       shutdown succeeded

Shutting down admin processes ...

        Server Id = 0 Group Id = simple Machine = simple:       shutdown succeeded
2 processes stopped.
[tuxedo@centos atmi]$ 

0 件のコメント: