Quantcast
Channel: SCN : Popular Discussions - Java Development
Viewing all articles
Browse latest Browse all 518

java.lang.UnsatisfiedLinkError: getVersion()Ljava/lang/String; Windows

$
0
0

Hi,

 

We are getting this error java.lang.UnsatisfiedLinkError when application tries to make a native call to getVersion(). From my research so far what I got that if we do not have the .dll file place correctly or if there is an issue in loading the file we get this error.

 

But in this case we see the libraries getting loaded fine but when tries to call this method we are getting the error.

 

Note: we have placed the dll's under C:\windows\system32

 

Code snippet:

-


public class SSO2Test{

      

public static String SECLIBRARY;

 

     public static String SSO2TICKETLIBRARY = "sapssoext";

 

     static {

          if (System.getProperty("os.name").startsWith("Win")) {

                    SECLIBRARY = "sapsecu.dll";

          } else {

               SECLIBRARY = "libsapsecu.so";

          }

          try {

               System.loadLibrary(SSO2TICKETLIBRARY);

               System.out.println("SAPSSOEXT loaded.");

          } catch (Throwable e) {

               System.out.println("Error during initialization of SSO2TICKET:\n"

                         + e.getMessage());

          }

               }

 

 

public static native synchronized String getVersion();

 

     public static void main(String[] args) throws Exception {

 

          try {

                

               System.out.println("Start SSO2TICKET main");

               System.out.println("****** test version*******");

               String version = SSO2Test.getVersion();

               System.out.println("Version of SAPSSOEXT: " + version);

                

               // MORE CODE

          } catch (Exception e) {

               System.out.println(e);

          } catch (Throwable te) {

               System.out.println(te);

          }

     }

}

 

Output:

 

SAPSSOEXT loaded.

Start SSO2TICKET main

            • test version*******

java.lang.UnsatisfiedLinkError: SSO2Test.getVersion()Ljava/lang/String;

 

-


 

Looking at the output its clear that loading the library part is fine. The error is getting thrown when trying to call the method.

 

Kindly provide assistance to resolve the same.

 

Thank You.

 

Edited by: abhijeet21 on Dec 29, 2009 9:56 PM

 

Edited by: abhijeet21 on Dec 29, 2009 9:57 PM


Viewing all articles
Browse latest Browse all 518

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>