Jump to content


Click the link below to see the new game I'm developing!


Photo
- - - - -

Obscure Server Side Object (SSO) error - and the resolution !


No replies to this topic

#1 DARREN

DARREN

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 396 posts
  • Gender:Male
  • Location:Florida,USA

Posted 17 July 2015 - 09:56 PM

We are implementing a new security package that will be referenced by all of our applications as a central repository for permissions and user account data. This package will sit along side and interface with our LDAP repository. We created a custom Java SSO that all of the applications go through to get the permissions etc. When we invoked a method from PROIV to get the permissions we received the following error.

 

PROIV Error  835 - SSO METHOD CALL {OurCustomSSO}.getFirstPermissionByUserName FAILED 

 

Error Details
-------------
SSO Exception: java.lang.ClassCastException                                                                                                                                                                                                               
com.sun.jndi.ldap.LdapCtx cannot be cast to org.springframework.ldap.core.DirContextOperations                                                                                                                                                            
Java Stack Trace:                                                                                                                                                                                                                                        
org.springframework.ldap.core.LdapTemplate$34.mapFromContext(LdapTemplate.java:1839)                                                                                                                                                                      
org.springframework.ldap.core.ContextMapperCallbackHandler.getObjectFromNameClassPair(ContextMapperCallbackHandler.java:69)                                                                                                                   
org.springframework.ldap.core.CollectingNameClassPairCallbackHandler.handleNameClassPair(CollectingNameClassPairCallbackHandler.java:50)                                                                                                 
org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:367)                                                                                                                                                                                  
org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:309)                                                                                                                                                                                  
org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:642)                                                                                                                                                                                  
org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:578)                                                                                                                                                                                  
org.springframework.ldap.core.LdapTemplate.find(LdapTemplate.java:1836)                                                                                                                                                                                   
org.springframework.ldap.core.LdapTemplate.find(LdapTemplate.java:1857)                                                                                                                                                                                   
org.springframework.ldap.core.LdapTemplate.findOne(LdapTemplate.java:1865)                                                                                                                                                                                
com.thig.{myapp}.ldap.dao.ldapDaoImpl.findPersonByUsername(ldapDaoImpl.java:63)                                                                                                                                                                         
com.thig.{myapp}.{myApplicationApi}.getAllPermissionsByUsername({myApplicationApi}.java:187)                                                                                                                                              
com.thig.{myapp}.{myApplicationSSO}.getFirstPermissionByUserName({myApplicationSSO}.java:139)                                                                                                                                                 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                                                                                                                               
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)                                                                                                                                                                             
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                                                                                                                     
java.lang.reflect.Method.invoke(Method.java:606)                                                                                                                                                                                                          
com.northgatearinso.proiv.sso.ssomanager.SSOManager.invokeMethod(Unknown Source)  
 
I am providing the verbiage that one of our Java developers (that solved the issue) provided me in the hopes that if you experience a similar issue then you will have a reference. We gave him a medal for resolving this one  :D  :D
 

Versions involved:

jdk1.7.0_60

spring-ldap-core 2.0.3.RELEASE

 

For posterity:

 

When PROIV loads an SSO jar, it does so in a class loader which is a child of

the application/system class loader. This causes the use of Spring LDAP to

result in a class cast exception from com.sun.jndi.ldap.LdapCtx to

org.springframework.ldap.core.DirContextOperations. This happens because the

Java JNDI classes use the Thread Context Class Loader (TCCL) to load object

factories used as part of a JNDI lookup. Since the Thread Context Class Loader

defaults to the application/system class loader, and the application/system

class loader does not contain the Spring LDAP classes (they are included in the

child class loader), the appropriate Spring object factory is not loaded. The

current solution is to, within the SSO, set the TCCL to the current class

loader (the class loader for the current class) which includes the Spring LDAP

classes.

 

---------------------------------------------------------------------------

Class Loader hierarchy when running myappsso jar directly:

---------------------------------------------------------------------------

                Classloader sun.misc.Launcher$AppClassLoader@70a6aa31:

                                file:ssotest/]

                                file:ssotest/myappapi-1.0-SNAPSHOT.jar

                Classloader sun.misc.Launcher$ExtClassLoader@4defb0be:

                                file:/opt/jdk1.7.0_60/jre/lib/ext/dnsns.jar

                                file:/opt/jdk1.7.0_60/jre/lib/ext/localedata.jar]

                                file:/opt/jdk1.7.0_60/jre/lib/ext/sunec.jar

                                file:/opt/jdk1.7.0_60/jre/lib/ext/sunjce_provider.jar

                                file:/opt/jdk1.7.0_60/jre/lib/ext/sunpkcs11.jar

                                file:/opt/jdk1.7.0_60/jre/lib/ext/zipfs.jar

 

-----------------------------------------------------------------------

Class Loader hierarchy when myappsso is run by PROIV:

-----------------------------------------------------------------------

                Classloader java.net.URLClassLoader@592fa617:

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/activation.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/avalon-framework-4.2.0.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/batik-all-1.7.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/commons-io-1.3.1.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/commons-logging-1.0.4.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/fop.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/fopwrapper.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/mail.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/northgate-lexicon-imp-exp.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/northgate-lexicon.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/serializer-2.7.0.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/servlet.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/sso/forgerockapi-1.0-SNAPSHOT.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/sso/northgatearinso-sso.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/sso/pdfextract.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/sso/proivsso-0.0.1-SNAPSHOT-11.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/ssomanager.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/xalan-2.7.0.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/xercesImpl-2.7.1.jar]

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/xml-apis-1.3.04.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/xml-apis-ext-1.3.04.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/xmlgraphics-commons-1.4.jar

                Classloader sun.misc.Launcher$AppClassLoader@781fb069:

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/fop.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/fopwrapper.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/mail.jar]

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/northgate-lexicon.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/ojdbc6.jar

                                file:/opt/pro4/v7.1.53.4/virtual_machine/javalib/ssomanager.jar

                Classloader sun.misc.Launcher$ExtClassLoader@6876fb1b:

                                file:/opt/jdk1.7.0_60/jre/lib/ext/dnsns.jar

                                file:/opt/jdk1.7.0_60/jre/lib/ext/localedata.jar]

                                file:/opt/jdk1.7.0_60/jre/lib/ext/sunec.jar

                                file:/opt/jdk1.7.0_60/jre/lib/ext/sunjce_provider.jar

                                file:/opt/jdk1.7.0_60/jre/lib/ext/sunpkcs11.jar

                                file:/opt/jdk1.7.0_60/jre/lib/ext/zipfs.jar

 

 


Things should be made as simple as possible, but not simpler



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Click the link below to see the new game I'm developing!