help with jni and tomcat

General discussion on the JZOS batch launcher and toolkit
Post Reply
Guest

help with jni and tomcat

Post by Guest »

I have created a simple jni class wrapper:

package org.apache.catalina.authenticator;

public class zosSecThread {

public static native int create ( String user, String password );

zosSecThread ( ) { }

static {

System.loadLibrary("zosThreadSecurity");

System.out.println("Thread Security Library Loaded");

}

}

I know my library is loading successfully.

But I am getting a link error:

Sep 26, 2005 3:47:21 PM org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request processing
java.lang.UnsatisfiedLinkError: create

Any help would be appreciated
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

It can't find an export for your native method implementation in your dll (.so)
Guest

Post by Guest »

Thank you ,

here is my (.h):

/* DO NOT EDIT THIS FILE - it is machine generated */

/* Header for class zosSecThread */




extern "C" {

/*
* Class: zosSecThread
* Method: create
* Signature: (Ljava/lang/String;Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_zosSecThread_create
(JNIEnv *, jclass, jstring, jstring);


}



Here is my c code:


JNIEXPORT jint JNICALL Java_zosSecThread_create
( JNIEnv *env, jclass obj, jstring userid,
jstring passwrd )
{


Here is my compile:

c89 -o libzosThreadSecurity.so -I ./ \
-I /sys/javatm2/v1r4m2/usr/lpp/java/J1.4/include/ \
-W c,dll,expo,list -W l,dll,map zosThreadSecurity.c \
/sys/javatm2/v1r4m1/usr/lpp/java/J1.4/bin/classic/libjvm.x

So please tell me what I am doing wrong
Post Reply