2012年7月9日月曜日

Oracle TuxedoのATMIサンプルをネットワーク環境で動かす

Oracle Tuxedo ダウンロードからtuxedo111120_32_win_xp_x86_VS2010_client.exeをダウンロードして、クライアントマシンにインストールしておく。サーバー側のインストールと同じくOracleホームを聞かれるので、適当に。OracleホームをC:\oracle\productにすると、C:\oracle\product\tuxedo11gR1_VS2010にインストールされる。

サーバー側の設定を変更する。
  • サーバーのIPアドレスは192.168.30.128
  • サーバーのポート番号は5000を開けておく
  • NETWORKセクションはまだ使わないけどtmloadcfがエラーになるのでとりあえず設定する
[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      50
MAXSERVICES     100
MODEL           MP
LDBAL           N
OPTIONS         LAN

*MACHINES
DEFAULT:
                APPDIR="/home/tuxedo/atmi"
                TUXCONFIG="/home/tuxedo/atmi/tuxconfig"
                TUXDIR="/home/tuxedo/tuxedo11gR1"
                MAXACCESSERS=100
                MAXWSCLIENTS=50
#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

*NETWORK
simple          NADDR="//192.168.30.128:5001"
                NLSADDR="//192.168.30.128:5002"

*SERVERS
DEFAULT:
                CLOPT="-A"

simpserv        SRVGRP=GROUP1 SRVID=1
"WSL"           SRVGRP=GROUP1 SRVID=2
                CLOPT="-A -- -n //192.168.30.128:5000"

*SERVICES
TOUPPER

設定ファイルをバイナリ変換しなおして起動する。tlistenを起動してないので警告が出るけど今は無視。
[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)
CMDTUX_CAT:1483: WARN: can't contact local tlisten process

Booting admin processes ...

exec DBBL -A :
        on simple -> process id=19752 ... Started.
exec BBL -A :
        on simple -> process id=19755 ... Started.

Booting server processes ...

exec simpserv -A :
        on simple -> process id=19758 ... Started.
exec WSL -A -- -n //192.168.30.128:5000 :
        on simple -> process id=19759 ... Started.
4 processes started.
[tuxedo@centos atmi]$ 
ここからクライアント側(Windows)
環境変数を設定する。
set TUXDIR=C:\oracle\product\tuxedo11gR1_VS2010
set PATH=%PATH%;%TUXDIR%\bin
set LIB=%LIB%;%TUXDIR%\lib
set INCLUDE=%INCLUDE%;%TUXDIR%\include
set WSNADDR=//192.168.30.128:5000
コードを組む。参照設定に%TUXDIR%\bin\libwscdnet.dllを追加しておくこと。(Visual Basic Expressの場合)
Imports Bea.Tuxedo.ATMI

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim sndstr, rcvstr As TypedString
        Dim ac As AppContext = Nothing
        Dim info As New TypedTPINIT()

        info.flags = TypedTPINIT.TPMULTICONTEXTS
        'info.cltname = "vb client"

        Try
            ac = AppContext.tpinit(info)
            sndstr = New TypedString("hello world")
            rcvstr = New TypedString(1000)

            ac.tpcall("TOUPPER", sndstr, rcvstr, 0)

            Console.WriteLine("rcvstr = {0}", rcvstr.GetString(0, 1000))
        Catch ex As ApplicationException
            Console.WriteLine("Got Exception = {0}", ex)
        Finally
            If Not ac Is Nothing Then
                ac.tpterm()
            End If
        End Try
    End Sub
End Class
起動してButton1を押すとコンソールに以下が出力される
rcvstr = HELLO WORLD
おまけ
MAXSERVERS、MAXSERVICESの値が小さいと、サーバー起動時にエラーが出ます。
[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)
CMDTUX_CAT:1483: WARN: can't contact local tlisten process

Booting admin processes ...

exec DBBL -A :
        on simple -> process id=20199 ... Started.
exec BBL -A :
        on simple -> process id=20202 ... Started.

Booting server processes ...

exec simpserv -A :
        on simple -> Failed.
exec WSL -A -- -n //192.168.30.128:5000 :
        on simple -> process id=20207 ... Started.
3 processes started.
[tuxedo@centos atmi]$
$APPDIR/ULOG.mmddyyを見るとこんな感じのエラーが出る。
161413.centos!tmboot.20198.3086485184.-2: 07-09-2012: Tuxedo Version 11.1.1.2.0, 32-bit
161413.centos!tmboot.20198.3086485184.-2: CMDTUX_CAT:1578: ERROR: Could not contact NLS on simple
161413.centos!tmboot.20198.3086485184.-2: CMDTUX_CAT:1576: ERROR: No NLS available for remote machine simple
161415.centos!DBBL.20199.3086223040.0: 07-09-2012: Tuxedo Version 11.1.1.2.0, 32-bit
161415.centos!DBBL.20199.3086223040.0: LIBTUX_CAT:262: INFO: Standard main starting
161417.centos!DBBL.20199.3086223040.0: CMDTUX_CAT:4350: INFO: BBL started on simple - Release 11112
161417.centos!BBL.20202.3086956224.0: 07-09-2012: Tuxedo Version 11.1.1.2.0, 32-bit, Patch Level (none)
161417.centos!BBL.20202.3086956224.0: LIBTUX_CAT:262: INFO: Standard main starting
161417.centos!BRIDGE.20205.3086526144.0: 07-09-2012: Tuxedo Version 11.1.1.2.0, 32-bit
161417.centos!BRIDGE.20205.3086526144.0: LIBTUX_CAT:262: INFO: Standard main starting
161417.centos!BRIDGE.20205.3086526144.0: LIBTMIB_CAT:74: ERROR: Failed to advertise dynamic /Admin service _TBR_0
161417.centos!BRIDGE.20205.3086526144.0: CMDTUX_CAT:1788: WARN: Could not advertise administrative service
161418.centos!DBBL.20199.3086223040.0: LIBTUX_CAT:328: ERROR: No space in Bulletin Board for Service Table
161418.centos!simpserv.20206.3086805200.0: 07-09-2012: Tuxedo Version 11.1.1.2.0, 32-bit
161418.centos!simpserv.20206.3086805200.0: LIBTUX_CAT:248: ERROR: System init function failed, Uunixerr = 
161418.centos!tmboot.20198.3086485184.-2: CMDTUX_CAT:825: ERROR: Process simpserv at simple failed with /T tperrno (TPENOENT - no entry found)
161418.centos!WSL.20207.3086792384.0: 07-09-2012: Tuxedo Version 11.1.1.2.0, 32-bit
161418.centos!WSL.20207.3086792384.0: LIBTUX_CAT:262: INFO: Standard main starting

0 件のコメント: