axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Nüßler <>
Subject JNI
Date Wed, 15 Aug 2007 10:57:14 GMT
hello users,

my first experience in ws was axis2c 3 month ago.
when i noticed that axis2c has no client session,
i decided to take axis2java, cause i don#T want
to implement on my own.

my service has to communicate with some
hardwaredevices. i build an jni wrapper
dll to talk to that devices - this works
fine. but when i try to load the libary
in the skeleton i run into trouble.

i have searched the user- and developer-list,
saw that i am not the only onw that runs
into trouble with jni,
but didn't find a proper answer.

so my question is, has anyone of you
did this succefully ?

my enviroment :
java 1.6

what i did :

1. write a simple service with a method that
adds 2 int's (adb-codegen) - works fine

2. write a jni-dll with the same method and
test it standalone - works fine

3. try to integrate :
place the native method in the skeleton,

public native int addieren(int a, int b);

generate with javah -jni the header-file,

   (JNIEnv *, jclass, jint, jint);

implement method and build the jni-dll,

Java_org_apache_ws_axis2_Jni_1serviceSkeleton_addieren(JNIEnv *env, 
jobject obj, jint a, jint b) {
	return (a + b);

declare static construct in skeleton,

static {
   try {
   } catch(Exception e) {

when i use "System.loadLibrary" the dll could not be found,
i searched the web and checked my Windows PATH variable,
placed the dll in different folders like c:\windows\system32,
but same result.

when i use "System.load" the dll was found, but it seems
that the native method could not perform correctly

here is my implementation :

     addieren( addieren) {

   AddierenResponse response = new AddierenResponse();
   int a = addieren.getParam0();
   int b = addieren.getParam1();

   System.out.println("--- server before --------");

   int c = addieren(a,b);

   System.out.println("--- server after --------");
   System.out.println("c : " + c);

   return response;

with "System.load" the server prints out the line
before the native method call and sents back an
Fault :

i do not know how to handle this,
any help would be appreciated.

mfg derMark

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message