Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling C routine from JAVA using OpenVMS WSIT

 
ahmedm
Occasional Contributor

Calling C routine from JAVA using OpenVMS WSIT

I am using WSIT v3.0 for OpenVMS to call a legacy C program which is composed of other library routines. I am facing a problem when I call  a function form any of the library routines.

I link the wsit shareable image as follows:

link /share=bpi.exe -

bpi.olb/library,-

usr$library:realtime.olb/lib

 

The problem is that when I call a routine present in realtime.olb from bpi.c the program results with the following error

Exception thrown

com.hp.wsi.WsiServerException: %LIB-E-ACTIMAGE, error activating image $1$DKA101:[000000.wsit.][deploy]BPI.EXE;1

at com.hp.wsi.WsiJNIShell.n_getContext(Native Method)

at com.hp.wsi.WsiJNIShell.init(WsiJNIShell.java)

at bpi.bpiImpl.<init>(bpiImpl.java)

at bpi.bpiImpl.<init>(bpiImpl.java)

at bpicaller.main(bpicaller.java)

%CMA-F-EXIT_THREAD, current thread has been requested to exit

%TRACE-F-TRACEBACK, symbolic stack dump follows

image module routine line rel PC abs PC

 

My question is that how do I link realtime.olb into the wsit shareable image so that any routine within realtime.olb can be called using WSIT

OpenVMS v8.3 AlphaServer

Java 1.4.2

6 REPLIES 6
JohnApps
Occasional Visitor

Re: Calling C routine from JAVA using OpenVMS WSIT

Build a shareable image library rather than a static OLB
x2084
Trusted Contributor

Re: Calling C routine from JAVA using OpenVMS WSIT

>>>Build a shareable image library rather than a static OLB

<<<

It looks like the OP built one. The shown link command "link /share=bpi.exe" indicates this. In case of an executable image lib$fis would report a different error, likely "%RMS-F-RFA, invalid record's file address (RFA)" . Unfortunately there is no secondary error messages displayed. It seems like WSIT doesn't catch it or doesn't show it. Here, famous secondary messages are "-RMS-E-FNF" and "IMGACT-F-NOTNATIVE". So one can only guess: it seems that there is a logical name defined pointing to the image file; the equivalence string contains ";1". I would check the logical name and whether  it really points to an exisiting version of the shareable image file and whether that is a native image. (But I also I would remove the version number from the equivalence string.)

 

Re: Calling C routine from JAVA using OpenVMS WSIT

Are you building an inprocess or an out-of-process server?

 

An out-of-process server is the combination of a wsi$server.exe which calls via a small well defined wsit interface your code in a share able image. the wsi$server gets launched by the wsi$manager. wsi$manager reads the <apps>.wsi file which has a pointer to the sharable image. 

 

Also you have to produce a vector file for linking.

That way you make symbols to functions and data available to the linker.

 

We have put our legacy (some 85 to 120 LOC's) including acces to ORA DB into a shareable image.

 

Then you need to care how wsi$root:[deploy]<apps>.wsi is setup,

it offers you a choice to run your setup.com and establish a properly define a context,

there you need to define a pointer, pointing to your main sharable image which wsi$server must consume.

 

and you need a logical for each shara-able images such as i.e.

  "LIBUUID" = "DKB3:[SW-PROJEKTE.WEBSERVICES.AXIS2.TRUNK.C.BUILD.DEPLOY.LIB]LIBUUID.EXE"
  "LIBXML" = "DKB3:[SW-PROJEKTE.XML.LIBXML2.INCLUDE.LIBXML.]"
  "LIBZSHR" [exec] = "dkb3:[sw-projekte.zlib]libzshr.exe"

  "SPS_CHPWD" [exec] = "KERNEL:[SERVER]sps_chpwd.exe"

 

but you dont need a logical for your main shareable which is your legacy aplication if defined in <apps>.wsi

even when <apps> is a shareabale (it has to be) a logical is contra productive and results in errors.

 

Josef

josef.stadelmann@axa-winterthur.ch

 

 

Re: Calling C routine from JAVA using OpenVMS WSIT

This is one of our command file generated .OPT files we use for linking our very large shrabale image, which is then a shara to the wsi$server.exe. We use command procedures to interogate analysis files from .obj files and then consolidate it into .opt files and make sure that previous defined symbols are not redefined as that would lead to a symbol redefinition as well during linking.

 

you need a file like that declaring each global function and each global data element. Be aware about case sensitivity. That way we call in any direction, and from C to PASCAL and PASCAL to C routines etc.

 

Josef

 

IA64-1>ty _LINK2.OPT
!
GSMATCH=ALWAYS,1,1000
CASE_SENSITIVE=YES
symbol_vector=(FKT_ABS=PROCEDURE)
symbol_vector=(FKT_ANS=PROCEDURE)
symbol_vector=(FKT_AUSB=PROCEDURE)
symbol_vector=(FKT_AVT=PROCEDURE)
symbol_vector=(FKT_AWD=PROCEDURE)
symbol_vector=(FKT_BAT=PROCEDURE)
symbol_vector=(FKT_BON=PROCEDURE)
symbol_vector=(FKT_BYE=PROCEDURE)
symbol_vector=(FKT_CODE=PROCEDURE)
symbol_vector=(FKT_COMMAND=PROCEDURE)
symbol_vector=(FKT_CONCATCSV=PROCEDURE)
symbol_vector=(FKT_CREATE_SAVEPOINT=PROCEDURE)
symbol_vector=(FKT_DEA=PROCEDURE)
symbol_vector=(FKT_DELTA=PROCEDURE)
symbol_vector=(FKT_DOK=PROCEDURE)
symbol_vector=(FKT_DRU=PROCEDURE)
symbol_vector=(FKT_DRUC=PROCEDURE)
symbol_vector=(FKT_DTFB=PROCEDURE)
symbol_vector=(FKT_EJA=PROCEDURE)
symbol_vector=(FKT_ELE=PROCEDURE)
symbol_vector=(FKT_ERROR=PROCEDURE)
symbol_vector=(FKT_FRZ=PROCEDURE)
symbol_vector=(FKT_GAM=PROCEDURE)
symbol_vector=(FKT_GES=PROCEDURE)
symbol_vector=(FKT_GETFILE=PROCEDURE)
symbol_vector=(FKT_GLOB=PROCEDURE)
symbol_vector=(FKT_ID=PROCEDURE)
symbol_vector=(FKT_IGB=PROCEDURE)
symbol_vector=(FKT_INIT=PROCEDURE)
symbol_vector=(FKT_JVA=PROCEDURE)
symbol_vector=(FKT_KNR=PROCEDURE)
symbol_vector=(FKT_KOL=PROCEDURE)
symbol_vector=(FKT_KONZ=PROCEDURE)
symbol_vector=(FKT_KOPI=PROCEDURE)
symbol_vector=(FKT_LART=PROCEDURE)
symbol_vector=(FKT_LAS=PROCEDURE)
symbol_vector=(FKT_LE=PROCEDURE)
symbol_vector=(FKT_LISTDTF=PROCEDURE)
symbol_vector=(FKT_LISTFILES=PROCEDURE)
symbol_vector=(FKT_LOGIN=PROCEDURE)
symbol_vector=(FKT_LP=PROCEDURE)
symbol_vector=(FKT_MAS=PROCEDURE)
symbol_vector=(FKT_MELD=PROCEDURE)
symbol_vector=(FKT_MTA=PROCEDURE)
symbol_vector=(FKT_MTM=PROCEDURE)
symbol_vector=(FKT_MTU=PROCEDURE)
symbol_vector=(FKT_MTZ=PROCEDURE)
symbol_vector=(FKT_MVT=PROCEDURE)
symbol_vector=(FKT_PLAN=PROCEDURE)
symbol_vector=(FKT_PLANP=PROCEDURE)
symbol_vector=(FKT_PLR=PROCEDURE)
symbol_vector=(FKT_POA=PROCEDURE)
symbol_vector=(FKT_PRO=PROCEDURE)
symbol_vector=(FKT_PUTBERDAT=PROCEDURE)
symbol_vector=(FKT_PUTCLEARING=PROCEDURE)
symbol_vector=(FKT_PUTCODES=PROCEDURE)
symbol_vector=(FKT_PUTDOK=PROCEDURE)
symbol_vector=(FKT_PUTDOKTYP=PROCEDURE)
symbol_vector=(FKT_PUTDOKUMENTE=PROCEDURE)
symbol_vector=(FKT_PUTEDARTS=PROCEDURE)
symbol_vector=(FKT_PUTFILE=PROCEDURE)
symbol_vector=(FKT_PUTINFO=PROCEDURE)
symbol_vector=(FKT_PUTLART=PROCEDURE)
symbol_vector=(FKT_PUTPERS=PROCEDURE)
symbol_vector=(FKT_PUTPERSI=PROCEDURE)
symbol_vector=(FKT_PUTPKREGISTER=PROCEDURE)
symbol_vector=(FKT_PUTPLAN=PROCEDURE)
symbol_vector=(FKT_PUTRGUID=PROCEDURE)
symbol_vector=(FKT_PUTTARP=PROCEDURE)
symbol_vector=(FKT_PUTTITEL=PROCEDURE)
symbol_vector=(FKT_PUTTITELSP=PROCEDURE)
symbol_vector=(FKT_PUTUSER=PROCEDURE)
symbol_vector=(FKT_PUTUT=PROCEDURE)
symbol_vector=(FKT_PUTVALUE=PROCEDURE)
symbol_vector=(FKT_PUTVG=PROCEDURE)
symbol_vector=(FKT_PUTZEI=PROCEDURE)
symbol_vector=(FKT_REB=PROCEDURE)
symbol_vector=(FKT_REL=PROCEDURE)
symbol_vector=(FKT_RGU=PROCEDURE)
symbol_vector=(FKT_SCANPL=PROCEDURE)
symbol_vector=(FKT_SCH=PROCEDURE)
symbol_vector=(FKT_SETCURSOR=PROCEDURE)
symbol_vector=(FKT_SETP=PROCEDURE)
symbol_vector=(FKT_SKA=PROCEDURE)
symbol_vector=(FKT_SOMA=PROCEDURE)
symbol_vector=(FKT_SOND=PROCEDURE)
symbol_vector=(FKT_SPER=PROCEDURE)
symbol_vector=(FKT_SPLIT=PROCEDURE)
symbol_vector=(FKT_SRCKOL=PROCEDURE)
symbol_vector=(FKT_STI=PROCEDURE)
symbol_vector=(FKT_STOG=PROCEDURE)
symbol_vector=(FKT_STOP=PROCEDURE)
symbol_vector=(FKT_STOT=PROCEDURE)
symbol_vector=(FKT_STOV=PROCEDURE)
symbol_vector=(FKT_STZP=PROCEDURE)
symbol_vector=(FKT_TABE=PROCEDURE)
symbol_vector=(FKT_TARP=PROCEDURE)
symbol_vector=(FKT_TEX=PROCEDURE)
symbol_vector=(FKT_TEXT=PROCEDURE)
symbol_vector=(FKT_TIT=PROCEDURE)
symbol_vector=(FKT_TRAN=PROCEDURE)
symbol_vector=(FKT_TW=PROCEDURE)
symbol_vector=(FKT_UBR=PROCEDURE)
symbol_vector=(FKT_USER=PROCEDURE)
symbol_vector=(FKT_UT=PROCEDURE)
symbol_vector=(FKT_VERF=PROCEDURE)
symbol_vector=(FKT_VGA=PROCEDURE)
symbol_vector=(FKT_VGG=PROCEDURE)
symbol_vector=(FKT_VGL=PROCEDURE)
symbol_vector=(FKT_VGM=PROCEDURE)
symbol_vector=(FKT_VGT=PROCEDURE)
symbol_vector=(FKT_VIEW=PROCEDURE)
symbol_vector=(FKT_VN=PROCEDURE)
symbol_vector=(FKT_VT=PROCEDURE)
symbol_vector=(FKT_VTB=PROCEDURE)
symbol_vector=(FKT_WMBCREATE=PROCEDURE)
symbol_vector=(FKT_ZEI=PROCEDURE)
symbol_vector=(FKT_ZUB=PROCEDURE)
symbol_vector=(FMSCLR=PROCEDURE)
symbol_vector=(FMSGETALL=PROCEDURE)
symbol_vector=(FMSGETYES=PROCEDURE)
symbol_vector=(FMSPUT=PROCEDURE)
symbol_vector=(FMSRET=PROCEDURE)
symbol_vector=(FMSSETLOGICAL=PROCEDURE)
symbol_vector=(FMS_RET=PROCEDURE)
symbol_vector=(LIB$SET_LOGICAL=PROCEDURE)
symbol_vector=(LIB$SIGNAL=PROCEDURE)
symbol_vector=(MYUTF8Toisolat1=PROCEDURE)
symbol_vector=(MYisolat1ToUTF8=PROCEDURE)
symbol_vector=(PGSECNAME=DATA)
symbol_vector=(PWKSP=DATA)
symbol_vector=(SPA_CHPWD=PROCEDURE)
symbol_vector=(STR$GET1_DX=PROCEDURE)
symbol_vector=(StringTest=PROCEDURE)
symbol_vector=(UAR_FLD_ACTION=PROCEDURE)
symbol_vector=(VSStringTest=PROCEDURE)
symbol_vector=(VSStringTestBig=PROCEDURE)
symbol_vector=(WMBCREATE=PROCEDURE)
symbol_vector=(WRAP=PROCEDURE)
symbol_vector=(WSI$ACMS_SIGN_IN=PROCEDURE)
symbol_vector=(WSI$ACMS_SIGN_OUT=PROCEDURE)
symbol_vector=(WSI$ADD_PARAM=PROCEDURE)
symbol_vector=(WSI$ASSUME=PROCEDURE)
symbol_vector=(WSI$DCL_PROC_MAPS=DATA)
symbol_vector=(WSI$DSTR_FIX=PROCEDURE)
symbol_vector=(WSI$DSTR_FREE=PROCEDURE)
symbol_vector=(WSI$END_SESSION=PROCEDURE)
symbol_vector=(WSI$EXIT=PROCEDURE)
symbol_vector=(WSI$FILENAME_MAPS=DATA)
symbol_vector=(WSI$GET_FILE=PROCEDURE)
symbol_vector=(WSI$INFO_BLOCK=DATA)
symbol_vector=(WSI$INIT=PROCEDURE)
symbol_vector=(WSI$INIT_ENCODER=PROCEDURE)
symbol_vector=(WSI$INVOKE=PROCEDURE)
symbol_vector=(WSI$INVOKE_DCL=PROCEDURE)
symbol_vector=(WSI$LOGIN=PROCEDURE)
symbol_vector=(WSI$LOGOUT=PROCEDURE)
symbol_vector=(WSI$START_SESSION=PROCEDURE)
symbol_vector=(WSI$VMS_LOGIN=PROCEDURE)
symbol_vector=(WSI$VMS_LOGOUT=PROCEDURE)
symbol_vector=(axawl_build_reference_payload=PROCEDURE)
symbol_vector=(axawl_create_env_with_error_log=PROCEDURE)
symbol_vector=(axawl_deserialize_input_payload=PROCEDURE)
symbol_vector=(axawl_dump_payload=PROCEDURE)
symbol_vector=(axawl_get_localname=PROCEDURE)
symbol_vector=(axawl_get_text=PROCEDURE)
symbol_vector=(axawl_merge=PROCEDURE)
symbol_vector=(axawl_put=PROCEDURE)
symbol_vector=(axawl_ret=PROCEDURE)
symbol_vector=(axawl_save_payload=PROCEDURE)
symbol_vector=(axawl_serialize_output_payload=PROCEDURE)
symbol_vector=(fktmap=PROCEDURE)
symbol_vector=(getFLDNAM=PROCEDURE)
symbol_vector=(getFLDVAL=PROCEDURE)
symbol_vector=(getPayloadID=PROCEDURE)
symbol_vector=(getWorkspaceID=PROCEDURE)
symbol_vector=(getWsID=PROCEDURE)
symbol_vector=(getWscolID=PROCEDURE)
symbol_vector=(gsecname=DATA)
symbol_vector=(htwsinp=DATA)
symbol_vector=(htwsold=DATA)
symbol_vector=(htwsout=DATA)
symbol_vector=(login=PROCEDURE)
symbol_vector=(logout=PROCEDURE)
symbol_vector=(output_buffer=DATA)
symbol_vector=(payload_inp=DATA)
symbol_vector=(payload_out=DATA)
symbol_vector=(printnode=PROCEDURE)
symbol_vector=(putnode=PROCEDURE)
symbol_vector=(read_input=PROCEDURE)
IA64-1>

x2084
Trusted Contributor

Re: Calling C routine from JAVA using OpenVMS WSIT

VMS is not Unix - you should not export everything!

...

symbol_vector=(LIB$SET_LOGICAL=PROCEDURE)
symbol_vector=(LIB$SIGNAL=PROCEDURE)

...

symbol_vector=(STR$GET1_DX=PROCEDURE)

...

These are not your symbols, they should not be exported from your shareable image. Do you link against the VMS shareable image LIBRTL? Do you get Linker warnings/errors? There are also WSI$ symbols, which look suspcious. But I admit I don't know how WSIT is supposed to work. It looks like you link with a WSIT OLB, defining these symbols.

 

 

 

Re: Calling C routine from JAVA using OpenVMS WSIT

We're probably using older versions of the WSIT templates, but what it's worth

 

We use the WSIT generated build procedure which includes the line

 

$   link 'link_debug_options /share=WS1.exe 'opt_files

 

then edit the WSIT generated options file to include our libraries etc. as below.

 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

! Template: WSOPT v1.003

! ---------

! WS1.opt

!

! Template Version:   3.0.0.0

! Executable Version: 1.0

!

! Note:  You are free to modify WSIT-generated

!        source code in whatever way you choose.  Whether

!        or not performance improvements or degradations

!        result from so doing, such changes are made

!        entirely at your own discretion and risk, and

!        cannot be supported by HP.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

WS1-server.obj

:

mpg$lib:rts/libmpg

$lib:SQL/libmpg

$lib:Tpl/libmp

$lib:rts/lib

MySQLClient/Lib

LIBZ_SHR64/Share

SYS$LIBRARY:SSL$LIBCRYPTO_SHR/Share

SYS$LIBRARY:SSL$LIBSSL_SHR/Share
SYS$LIBRARY:WSI$COMMON.EXE/SHARE
SYMBOL_VECTOR=( WSI$INIT=PROCEDURE,-

        WSI$EXIT=PROCEDURE,- 

        WSI$START_SESSION=PROCEDURE,-

        WSI$END_SESSION=PROCEDURE,- 

        WSI$ACMS_SIGN_IN=PROCEDURE,- 

        WSI$ACMS_SIGN_OUT=PROCEDURE,- 

        WSI$VMS_LOGIN=PROCEDURE,- 

        WSI$VMS_LOGOUT=PROCEDURE,-

        WSI$INVOKE=PROCEDURE,-

        WSI$INVOKE_DCL=PROCEDURE,- 

        WSI$GET_FILE=PROCEDURE,- 

        WSI$INFO_BLOCK=DATA,- 

        WSI$DCL_PROC_MAPS=DATA,-

        WSI$FILENAME_MAPS=DATA,-

        EXEC=PROCEDURE-

        )

 

Hope this helps.