axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Hatton" <>
Subject RE: Axis / JNI - need help!
Date Mon, 30 Jun 2003 11:35:29 GMT
Hi Harald,
Do you think this might be a security problem? I've had problems loading native code in Tomcat
You might try making sure your JNIDate class is loaded by the system classloader, rather than
the application classloader. I'm not familiar with the versions of Tomcat you mention but
it probably needs to be in common/classes or (as a JAR) common/lib of your Tomcat directory.
Or (depending on your knowledge of  Tomcat) maybe there is a .policy file you can edit to
give your application directory the right permissions.
Hope this helps

-----Original Message-----
From: Harald Pollak []
Sent: 30 June 2003 12:17
Subject: Axis / JNI - need help!

Hy everybody!

I try to use JNI within a Axis-Service. I try since weeks to bring it to work, but my result
is every time the same:


my enviroment:
Linux: SuSE 8.2
Tomcat 5 ( 5.0.3 Alpha ) ( allso tried with Tomcat 4.1.24 )
Axis 1.1 ( final ) ( allso tried with 1.1rc2 )
Client: Mozzila 1.4

I call the function getDate with 2 Parameters via:

The Code:

The Implementation:

public class ServicesSoapBindingImpl implements SMS.JNIWS{

    public java.lang.String getDate(java.lang.String in0, int in1) throws java.rmi.RemoteException
        String s = new String();

        try {
            System.err.println("init Class"); 

         JNIDate jd = new JNIDate();
            System.err.println("call methode: "); 
            s = jd.getDate(in0, in1);
            System.err.println("finnished: " + s); 
        } catch (Exception ex) {
        return s; 

    public java.lang.String getVersion() throws java.rmi.RemoteException {
        return "1.0";

    public java.lang.String getEnv() throws java.rmi.RemoteException {
//        return System.getProperty("java.library.path");
        return AxisProperties.getProperty("java.library.path");


the Class-JNIDate:

class JNIDate {

    static { System.loadLibrary("JNIDate"); }

    public native String getJNIDate(String Server, int Port );

    public String getDate(String Server, int Port) {
        String s;
        try {
           s= getJNIDate(Server,Port);
            return s;
        } catch (Exception e) {
            return (String)(e.getMessage() + "\n : "+e.getCause().toString());

the output on Tomcat-console:
    init class
    call methode

there is no  exception in logs or on console

when i call the getEnv - Methode:
    The path with my library-dir is shown.

What i allso tried:
    To outcommend the Nativecall and return a simpel string from JNIDate.getJNIDate ->
works fine.

    To write a servlet using the JNIDate.class and call it. -> works fine!

So my questions:

1.) has anybody allready written a Axis-Service using his own JNI-Class?
2.) has anybody seen a misstake in the upper code ( maybe i'm "codeblinde" - and it's a simple
error, so I read over it many times )?
3.) Has anyone a sample - I can try in my enviroment?


View raw message