Hello Friends
We are tring to implement SSO between SAP Portal server and the Java application deployed in SAP J2ee engine using SAP token.We are using SSO2Ticket.java class.But we are getiing error saying that "java.lang.UnsatisfiedLinkError: init"
although sapssoext.so and libsapsecu.so present in LD_LIBRARY_PATH.Pls help us.
Below is the code we are using.
Cookie[] all_Cookies = request.getCookies ();
String ticket = "";
int i = 0;
for (i=0; i<all_Cookies.length; i++) {
//Get MYSAPSSO2 cookie from request context...
if ("MYSAPSSO2".equals (all_Cookies<i>.getName ())) {
ticket = all_Cookies<i>.getValue ();
System.out.println("ticket noww==>" + ticket);
break;
}
}
//If no ticket present we output an error page
if ("".equals(ticket)) {
System.out.println("Ticket not found");
}
else {
Object [] o;
o=null;
try {
//
o = SSO2Ticket.evalLogonTicket (ticket, "SAPdefault", null);
} catch (Exception e) {
}
catch (Throwable te) {
} String PrtUsr = (String)o[4]; //Portal user
System.out.println("PrtUsris"+ PrtUsr);
SSO2Ticket.java class :
public class SSO2Ticket { public static final int ISSUER_CERT_SUBJECT = 0;
public static final int ISSUER_CERT_ISSUER = 1;
public static final int ISSUER_CERT_SERIALNO = 2;
public static final int ISSUER_CERT_SUMMARY = 3;
public static final int ISSUER_CERT_SERIAL = 4;
public static final int ISSUER_CERT_VALIDITY = 5;
public static final int ISSUER_CERT_FINGERPRINT= 6;
public static final int ISSUER_CERT_ALGID = 7;
public static final int ISSUER_CERT_ALL = 8;
private static boolean initialized = false;
public static String SECLIBRARY ;
public static String SSO2TICKETLIBRARY = "sapssoext";
static {
if (System.getProperty("os.name").startsWith("Win")) {
SECLIBRARY = "sapsecu.dll"; /* Windows */
} else if (System.getProperty("os.name").startsWith("Mac")) {
SECLIBRARY = "libsapsecu.jnilib"; /* Mac */
} else if (System.getProperty("os.name").startsWith("HP")) {
if (false == System.getProperty("os.arch").startsWith("IA64")) {
SECLIBRARY = "libsapsecu.sl"; /* HP RISC */
} else {
SECLIBRARY = "libsapsecu.so"; /* HP IA64 */
}
} else {
System.out.println("libsapsecu for solaris with complete path");
SECLIBRARY = "/oracle/sapmntess/ESS/exe/libsapsecu.so"; /* Default for Linux/Unix */
}
try {
System.out.println("not before loading with complete path");
//System.loadLibrary(SSO2TICKETLIBRARY);
System.out.println("SAPSSOEXT loaded.");
System.out.println("SAPSSOEXT loaded11.");
System.out.println("not before loading with complete path");
init(SECLIBRARY);
System.out.println("not after loading with complete path");
} catch (Exception e) {
System.out.println ("Error during initialization of SSO2TICKET newww:\n" + e.getStackTrace());
}
System.out.println("static part ends.\n");
}
public static native synchronized boolean init(String seclib);
Waiting for your reply.