2 Replies Latest reply: Jun 22, 2014 4:57 PM by NR RSS

    OAM SDK Issues

    NR

      Hi All,

       

      I am trying to enable SSO from my custom login page, when i try to access a protected resource, but the document code is not working, when i try to run the servlet, it's failing in creating the default instance of the Access Client.

       

      Here is the code that is failing:

       

                    AccessClient ac = null;

                    ac = AccessClient.createDefaultInstance(m_configLocation, AccessClient.CompatibilityMode.OAM_10G);

       

      I copied the AccessClient's ObAccessClient.xml under C:/AccessSDK11g/oblix/lib, but if i run the same code in Java Main method its instantiating but not from servlet.

       

      The error I am getting is the below one:

       

      weblogic.servlet.internal.ServletRequestImpl@300c94[

      POST /Application4-ViewController-context-root/loginservlet HTTP/1.1

      Connection: keep-alive

      Content-Length: 29

      Cache-Control: max-age=0

      Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

      Origin: http://localhost:7101

      User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36

      Content-Type: application/x-www-form-urlencoded

      Referer: http://localhost:7101/Application4-ViewController-context-root/samplesso.jsp

      Accept-Encoding: gzip,deflate,sdch

      Accept-Language: en-US,en;q=0.8

      Cookie: ADMINCONSOLESESSION=a_OJVfK_uvnv8qXf-Y1ELTKIZCHU0_ZrUzkm6RMsOZA7G5eN3w2g!2073012372; JSESSIONID=KGr5TlgXnKpmv9WdPtYCVJw3hdtFNb10mvMC0bGnsYZ3sKBvhj6y!-1952803984

      ]] Root cause of ServletException.

      java.lang.NoSuchMethodError: oracle.security.am.common.aaaclient.ObAAAServiceClient.<init>(Ljava/lang/String;[CILjava/lang/String;Ljava/lang/String;[C[CZIJJLjava/lang/Integer;Ljava/util/List;Ljava/util/List;Ljava/util/HashMap;)V

        at oracle.security.am.asdk.AccessClient.createClient(AccessClient.java:1549)

        at oracle.security.am.asdk.AccessClient.initializeHelper(AccessClient.java:1232)

        at oracle.security.am.asdk.AccessClient.initialize(AccessClient.java:1371)

        at oracle.security.am.asdk.AccessClient.<init>(AccessClient.java:930)

        at oracle.security.am.asdk.AccessClient.createDefaultInstance(AccessClient.java:351)

        Truncated. see log file for complete stacktrace

       

      I am just testing the sample servlet given in the document from Jdeveloper 11.1.1.6. The java class is able to instantiate the AccessClient but not the servlet. Its always giving the above error.

       

      I have checked the libraries, everything is good, I am only wondering how come the same code is working in simple java class but not in servlet, is it because the servlet or jsp uses weblogic and simple java class don't use.

       

      Document followed: http://docs.oracle.com/cd/E40329_01/dev.1112/e27134/as_api.htm#BGBCEHCI

       

      Thanks, any help is appreciated.

        • 1. Re: OAM SDK Issues
          KKT

          Refer the below solution from Oracle metalink.

           

          Solution :---

          The error: "java.lang.NoSuchMethodError: oracle.security.am.common.aaaclient.ObAAAServiceClient.<init>(Ljava/lang/String;[CILjava/lang/String;Ljava/lang/String;[C[CZIJJLjava/lang/Integer;Ljava/util/List;Ljava/util/List;)"

           

          means that a constructor of the class ObAAAServiceClient with the parameter list does not exist - but the class is present .

           

           

           

          The problem: the class file ObAAAServiceClient.class where provided by some jar files and in different versions.

           

           

           

          That the servlet used the correct version,  add in the JDeveloper application weblogic-application

          the following entry:

          <prefer-application-packages>

          <!-- add package names from the Oracle Access Server SDK -->

          <package-name>oracle.security.am.*</package-name>

          </prefer-application-packages>


           

           

          This will import all necessary classes from the packageoracle.security.am (plus all classes behind '*') in the servlet home directory.

           

           

          This has the effect, that the standard servlet class lookups will find the correct class.

           

           

          let us know for more issues.

           

          Thanks,

          ~KKT~

          • 2. Re: OAM SDK Issues
            NR

            Hi KKT,

             

            Thanks a lot for the tip, it actually worked, can you also let me know how to establish SSO by using the above code. I meant i am trying to access a resource (URL) which is configured with OAM SSO, and I have a written the above code in a sample app and trying to access the resource with response.sendRedirect.

             

            But now I am able to instantiate the AccessClient, but not able to forward the request to the protected resource, where the code response.redirect will fail as the protected resource will not be in the same sample servlet app.

             

            Can you let me know what to do.

             

            Thanks.