求助,JNI调用TUXEDO报错
麻烦大家帮忙看看
103225.cbly03!?proc.438306.1.0: 07-24-2009: Tuxedo Version 8.1, 32-bit
103225.cbly03!?proc.438306.1.0: GP_CAT:1561: ERROR: Problem with license file /tuxedo/tuxedo8.1/udataobj/lic.txt
103225.cbly03!?proc.438306.1.0: LIBTUX_CAT:6031: ERROR: Unable to pre-process buffer before tranmission. Error code(4/3606)
103225.cbly03!?proc.438306.1.0: LIBWSC_CAT:1045: ERROR: Presend on message failed
103225.cbly03!?proc.438306.1.0: LIBWSC_CAT:1011: ERROR: tpcall() message send failure
我是在AIX5.2 上装的TUXDO8.1,是用C 的maikefile调用.so文件没有问题,用JNI调用就报这个错
xlc -c testconnect.c -I$TUXDIR/include -I/usr/java14/include
xlc -G -o libct.so testconnect.o -L${TUXDIR}/lib -I$TUXDIR/include -lwsc -lbuft -lwsc -lgpnet -lfml -lfml32 -lengine -lpthread
下面是我C文件调用的部分
JNIEXPORT jint JNICALL Java_testconnect_send_1recv(JNIEnv * env, jobject obj)
{
char * sendbuf;
char * rcvbuf;
int sendlen;
long rcvlen;
int ret;
jfieldID commStringfid;
TPINIT * tpinfo = NULL;
char * sendjstr;
int tmpi;
tuxputenv("WSNADDR=//192.168.221.105:4444");
printf("wsnaddr=[%s]\n", tuxgetenv("WSNADDR"));
tpinfo = (TPINIT *)tpalloc("TPINIT", NULL, TPINITNEED(32));
if(tpinfo != NULL)
{
tpinfo->datalen = 0;
sprintf(tpinfo->usrname, "");
sprintf((char*) &(tpinfo->data), "");
sprintf(tpinfo->cltname, "");
sprintf(tpinfo->passwd, "");
tpinfo->flags = TPU_IGN | TPSA_FASTPATH;
}
else {
(void)fprintf(stderr, "\nERROR: tpalloc failed (%s)\n", tpstrerror(tperrno));
tpterm();
return -101;
}
tmpi = tpinit(tpinfo);
printf("tpinit(tpinfo)=[%d]\n", tmpi);
if (tmpi == -1)
{
(void)fprintf(stderr, "\nERROR: tpalloc failed (%s)\n", tpstrerror(tperrno));
tpfree((char *)tpinfo);
tpterm();
return -101;
}
sendjstr = "339 0000@INQ A0005 TYUIO userid=A0005|brchno=9901|tmnlno=A005|prcscd=@INQ|RGCD=9901|TSRG=9901|SVID=A005|USID=A0005|PRID=@INQ|";
sendlen = strlen(sendjstr);
if((sendbuf = (char *) tpalloc("STRING", NULL, sendlen + 1)) == NULL) {
(void) fprintf(stderr, "\nError allocating send buffer\n");
tpterm();
return -102;
}
(void) strcpy(sendbuf, sendjstr);
if((rcvbuf = (char *) tpalloc("STRING", NULL, rcvlen)) == NULL) {
(void) fprintf(stderr, "\nError allocating receive buffer\n");
tpfree(sendbuf);
tpterm();
return -103;
}
printf("sendbuf=[%s],sendlen=[%d]\n", sendbuf, sendlen);
ret = tpcall("MIDDB", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);
if(ret == -1) {
if (tperrno==TPETIME)
ret=-105;
else
ret=-104;
(void) fprintf(stderr, "\nCan't send request to service MIDDB\n");
(void) fprintf(stderr, "\nTperrno = %d\n", tperrno);
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
printf("ret=[%d]\n", ret);
return ret;
}
if (commStringfid != 0)
{
(*env)->SetObjectField(env, obj, commStringfid, JNU_NewStringNative(env, rcvbuf));
}
printf("rcvbuf =[%s],rcvlen =[%d]\n", rcvbuf, rcvlen);
tpfree(sendbuf);
tpfree(rcvbuf);
tpfree((char *)tpinfo);
return ret;
}