Results 1 to 3 of 3
  1. #1
    hannehomuth's Avatar
    hannehomuth is offline Member
    Join Date
    Jul 2008
    Location
    Sommerfeld (Brandenburg, Germany)
    Posts
    36
    Rep Power
    0

    Default [SOLVED] JNI gives Error undefined Symbol, do I miss an Headerfile?

    Hello Everyone,
    at first thank you for reading this post. I'd like to you use the gnome keyring manager to save/load Passwords out of my own java app. If tried things with dbus, but it seems not to work. Now I wanna to write my own wapper for the method calls to use the keyring manager. I started to write my Java class. It looks like this.
    Java Code:
    /**
     *
     * @author jhomuth
     */
    public class KeyRingConnector {
        
        public native void addPasswordToKeyRingManger();
        public native boolean isKeyRingDaemonAvailable();
        
        static
        {
           Runtime.getRuntime().load("/usr/lib/libdbus-1.so.3");
           Runtime.getRuntime().load("/usr/lib/libglib-2.0.so.0");
           Runtime.getRuntime().load("/lib/i686/cmov/libc.so.6");
           Runtime.getRuntime().load("/usr/lib/libpcre.so.3");
           Runtime.getRuntime().load("/lib/libselinux.so.1");
           Runtime.getRuntime().load("/lib/ld-linux.so.2");
           Runtime.getRuntime().load("/usr/lib/libgnome-keyring.so");
           Runtime.getRuntime().load("/home/jhomuth/projekte/LDAP/src/de/sourcepark/ldap/KeyRingConnector.dll");
        }    
    }

    Furthermore I wrote the C Class which looks like this

    Java Code:
    //File: KeyRingConnector.c
    #include "de_sourcepark_ldap_KeyRingConnector.h"
    #include <jni.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <glib.h>
    #include <gnome-keyring.h>
     
    JNIEXPORT void JNICALL Java_de_sourcepark_ldap_KeyRingConnector_addPasswordToKeyRingManger (JNIEnv *env, jobject obj)
    {
        printf("Damm I used JNI");
    }
     
    JNIEXPORT jboolean JNICALL Java_de_sourcepark_ldap_KeyRingConnector_isKeyRingDaemonAvailable (JNIEnv *env, jobject obj)
    {
     
    #define false 0
    #define true (!false)
     
       if(gnome_keyring_is_available())
       {
            return true;
       }
       else return false;
    }
    But when I wanna run my Programm I get an java.lang.UnsatisfiedLinkError

    Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: /home/jhomuth/projekte/LDAP/src/de/sourcepark/ldap/KeyRingConnector.dll: /home/jhomuth/projekte/LDAP/src/de/sourcepark/ldap/KeyRingConnector.dll: undefined symbol: gnome_keyring_is_available

    I think I'm missing a Headerfile in my C Class or do I have to load another library?

    Thx for help

  2. #2
    hannehomuth's Avatar
    hannehomuth is offline Member
    Join Date
    Jul 2008
    Location
    Sommerfeld (Brandenburg, Germany)
    Posts
    36
    Rep Power
    0

    Default

    I found it by myself. I've had to put the libgnome-keyring into my own dll using

    gcc -shared -o KeyRingConnector.dll KeyRingConnector.o /usr/lib/libgnome-keyring.so

  3. #3
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Please mark it as SOLVED.. :)
    To finish sooner, take your own time....
    Nivedithaaaa

Similar Threads

  1. symbol not found error
    By rmartyce in forum New To Java
    Replies: 1
    Last Post: 05-23-2008, 06:58 AM
  2. Cannot Resolve Symbol error...
    By seral1969 in forum New To Java
    Replies: 4
    Last Post: 02-18-2008, 01:17 AM
  3. Error: cannot find symbol
    By silvia in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 06:39 AM
  4. Error: cannot find symbol
    By cachi in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 09:12 PM
  5. Error: cannot resolve symbol, help me
    By mathias in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 08-06-2007, 03:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •