Topic
  • 4 replies
  • Latest Post - ‏2013-10-14T17:43:41Z by TivoliHelp
TivoliHelp
TivoliHelp
10 Posts

Pinned topic Unable to get InitialPlatformContext

‏2013-10-11T01:03:57Z |

I am working on coding a java class to create provisioning policies. However I am facing a problem at the very first step to get a InitialPlatformContext.

My Code to get InitialPlatformContext:

 

public static PlatformContext getPlatformContext() throws RemoteException,
ApplicationException {
 
String itimUser = "ITIM Manager";
 
String itimPswd = "Passw0rd";
 
String itimRealm = "itimCustomRealm";
 
 
Hashtable<String, String> env = new Hashtable<String, String>();
//env.put(InitialPlatformContext.CONTEXT_FACTORY, "com.ibm.itim.apps.impl.websphere.WebspherePlatformContextFactory");
env.put(InitialPlatformContext.CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(PlatformContext.PLATFORM_URL,"corbaloc:iiop:localhost:2809");
 
env.put(PlatformContext.PLATFORM_PRINCIPAL, itimUser);
env.put(PlatformContext.PLATFORM_CREDENTIALS, itimPswd);
env.put(PlatformContext.PLATFORM_REALM, itimRealm);
 
System.out.println("Creating new PlatformContext \n");
 
return new InitialPlatformContext(env);
}

 

 

I get the following Error:

 

Exception in thread "main" java.lang.ClassCastException: com.ibm.websphere.naming.WsnInitialContextFactory incompatible with com.ibm.itim.apps.PlatformContextFactory
at com.ibm.itim.apps.InitialPlatformContext.createPlatformContext(InitialPlatformContext.java:127)
at com.ibm.itim.apps.InitialPlatformContext.<init>(InitialPlatformContext.java:77)
at com.ibm.S.tools.Utils.getPlatformContext(SeterusUtils.java:96)
at com.ibm.S.tools.CreateProvisioningPolicy.run(CreateProvisioningPolicy.java:38)
at com.ibm.S.tools.CreateProvisioningPolicy.main(CreateProvisioningPolicy.java:68)

 

If you have seen similar issue, kindly let me know the resolution.

 

If I change the CONTEXT FACTORY to "com.ibm.itim.apps.impl.websphere.WebspherePlatformContextFactory", the error changes to:

ception in thread "main" java.lang.NoClassDefFoundError: com.ibm.cv.CVProxyException
at com.ibm.itim.exception.ITIMException.getMessage(ITIMException.java:127)
at com.ibm.itim.exception.ITIMException.getLocalizedMessage(ITIMException.java:99)
at java.lang.Throwable.toString(Throwable.java:247)
at java.lang.Throwable.printStackTrace(Throwable.java:332)
at java.lang.Throwable.printStackTrace(Throwable.java:212)
at com.ibm.itim.exception.ITIMException.printStackTrace(ITIMException.java:178)
at com.ibm.itim.exception.ITIMException.printStackTrace(ITIMException.java:171)
at com.ibm.S.tools.CreateProvisioningPolicy.run(CreateProvisioningPolicy.java:57)
at com.ibm.S.tools.CreateProvisioningPolicy.main(CreateProvisioningPolicy.java:68)
Caused by: java.lang.ClassNotFoundException: com.ibm.cv.CVProxyException
at java.net.URLClassLoader.findClass(URLClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:660)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:346)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
... 9 more

Any thoughts???

  • SourabhM
    SourabhM
    21 Posts

    Re: Unable to get InitialPlatformContext

    ‏2013-10-11T06:14:15Z  

    Hi,

    The below jar was missing from class path.

    ITIM_HOME/lib/com.ibm.cv.kmip.ext.jar

    I also developed similar code to create/modify/delete  provisioning policy. I have below jars attached to class path.

    set PLATFORM_CONTEXT_FACTORY=com.ibm.itim.apps.impl.websphere.WebSpherePlatformContextFactory
    set CP=%CP%;%ITIM_HOME%/lib/api_ejb.jar
    set CP=%CP%;%ITIM_HOME%/lib/itim_api.jar
    set CP=%CP%;%ITIM_HOME%/lib/itim_server_api.jar
    set CP=%CP%;%ITIM_HOME%/lib/jlog.jar
    set CP=%CP%;%ITIM_HOME%/lib/jffdc.jar
    set CP=%CP%;%ITIM_HOME%/lib/com.ibm.cv.kmip.ext.jar
    set CP=%CP%;%ITIM_HOME%/data
    set CP=%CP%;%JAVA_HOME%/jre/lib/ext/jaas.jar
    set CP=%CP%;%APP_SRV_TOP%/plugins/com.ibm.ws.runtime.jar
    set CP=%CP%;%APP_SRV_TOP%/plugins/com.ibm.ws.emf.jar
    set CP=%CP%;%APP_SRV_TOP%/plugins/com.ibm.ws.wccm.jar
    set CP=%CP%;%APP_SRV_TOP%/plugins/com.ibm.ws.ejbportable.jar
    set CP=%CP%;%APP_SRV_TOP%/runtimes/com.ibm.ws.webservices.thinclient_7.0.0.jar

    Please let me know,if you have still any issue.

    Cheers,
    SourabhM
     

    Updated on 2013-10-11T06:18:27Z at 2013-10-11T06:18:27Z by SourabhM
  • TivoliHelp
    TivoliHelp
    10 Posts

    Re: Unable to get InitialPlatformContext

    ‏2013-10-11T18:27:23Z  
    • SourabhM
    • ‏2013-10-11T06:14:15Z

    Hi,

    The below jar was missing from class path.

    ITIM_HOME/lib/com.ibm.cv.kmip.ext.jar

    I also developed similar code to create/modify/delete  provisioning policy. I have below jars attached to class path.

    set PLATFORM_CONTEXT_FACTORY=com.ibm.itim.apps.impl.websphere.WebSpherePlatformContextFactory
    set CP=%CP%;%ITIM_HOME%/lib/api_ejb.jar
    set CP=%CP%;%ITIM_HOME%/lib/itim_api.jar
    set CP=%CP%;%ITIM_HOME%/lib/itim_server_api.jar
    set CP=%CP%;%ITIM_HOME%/lib/jlog.jar
    set CP=%CP%;%ITIM_HOME%/lib/jffdc.jar
    set CP=%CP%;%ITIM_HOME%/lib/com.ibm.cv.kmip.ext.jar
    set CP=%CP%;%ITIM_HOME%/data
    set CP=%CP%;%JAVA_HOME%/jre/lib/ext/jaas.jar
    set CP=%CP%;%APP_SRV_TOP%/plugins/com.ibm.ws.runtime.jar
    set CP=%CP%;%APP_SRV_TOP%/plugins/com.ibm.ws.emf.jar
    set CP=%CP%;%APP_SRV_TOP%/plugins/com.ibm.ws.wccm.jar
    set CP=%CP%;%APP_SRV_TOP%/plugins/com.ibm.ws.ejbportable.jar
    set CP=%CP%;%APP_SRV_TOP%/runtimes/com.ibm.ws.webservices.thinclient_7.0.0.jar

    Please let me know,if you have still any issue.

    Cheers,
    SourabhM
     

    Thanks Sourabh..That did resolve my issue. I am facing another issue now, please help if you are familiar...
     
     
     
    Oct 11, 2013 2:10:47 PM null null
    WARNING: WSVR0072W
    Oct 11, 2013 2:10:47 PM null null
    WARNING: WSVR0072W
    Oct 11, 2013 2:10:47 PM null null
    WARNING: WSVR0072W
    Oct 11, 2013 2:10:47 PM null null
    WARNING: WSVR0072W
    Oct 11, 2013 2:10:47 PM null null
    INFO: Client code attempting to load security configuration
     
    Exception in thread "P=46475:O=0:CT" java.lang.SecurityException: Unable to locate a login configuration
    at com.ibm.security.auth.login.ConfigFile.<init>(ConfigFile.java:124)
    at java.lang.J9VMInternals.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1345)
    at javax.security.auth.login.Configuration$3.run(Configuration.java:267)
    at java.security.AccessController.doPrivileged(AccessController.java:251)
    at javax.security.auth.login.Configuration.getConfiguration(Configuration.java:261)
    at javax.security.auth.login.LoginContext$1.run(LoginContext.java:260)
    at java.security.AccessController.doPrivileged(AccessController.java:202)
    at javax.security.auth.login.LoginContext.init(LoginContext.java:257)
    at javax.security.auth.login.LoginContext.<init>(LoginContext.java:426)
    at com.ibm.S.tools.SUtils.getSubject(SUtils.java:132)
    at com.ibm.S.tools.CreateProvisioningPolicy.run(CreateProvisioningPolicy.java:40)
    at com.ibm.S.tools.CreateProvisioningPolicy.main(CreateProvisioningPolicy.java:68)
    Caused by: java.io.IOException: Unable to locate a login configuration
    at com.ibm.security.auth.login.ConfigFile.init(ConfigFile.java:281)
    at com.ibm.security.auth.login.ConfigFile.<init>(ConfigFile.java:122)
    ... 12 more
     
     
    It seems it is not able to find the jaas config file. I did put the jaas config in the classpath but still I am getting this error.. This is from my jaas.conf:
     
    WSLogin {
        com.ibm.ws.security.common.auth.module.proxy.WSLoginModuleProxy required delegate=com.ibm.ws.security.common.auth.module.WSLoginModuleImpl;
     
    };
     
     
    ITIM {
        com.ibm.ws.security.common.auth.module.proxy.WSLoginModuleProxy required delegate=com.ibm.itim.apps.jaas.spi.PlatformLoginModule;
     
    };
     
  • SourabhM
    SourabhM
    21 Posts

    Re: Unable to get InitialPlatformContext

    ‏2013-10-14T02:31:38Z  
    Thanks Sourabh..That did resolve my issue. I am facing another issue now, please help if you are familiar...
     
     
     
    Oct 11, 2013 2:10:47 PM null null
    WARNING: WSVR0072W
    Oct 11, 2013 2:10:47 PM null null
    WARNING: WSVR0072W
    Oct 11, 2013 2:10:47 PM null null
    WARNING: WSVR0072W
    Oct 11, 2013 2:10:47 PM null null
    WARNING: WSVR0072W
    Oct 11, 2013 2:10:47 PM null null
    INFO: Client code attempting to load security configuration
     
    Exception in thread "P=46475:O=0:CT" java.lang.SecurityException: Unable to locate a login configuration
    at com.ibm.security.auth.login.ConfigFile.<init>(ConfigFile.java:124)
    at java.lang.J9VMInternals.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1345)
    at javax.security.auth.login.Configuration$3.run(Configuration.java:267)
    at java.security.AccessController.doPrivileged(AccessController.java:251)
    at javax.security.auth.login.Configuration.getConfiguration(Configuration.java:261)
    at javax.security.auth.login.LoginContext$1.run(LoginContext.java:260)
    at java.security.AccessController.doPrivileged(AccessController.java:202)
    at javax.security.auth.login.LoginContext.init(LoginContext.java:257)
    at javax.security.auth.login.LoginContext.<init>(LoginContext.java:426)
    at com.ibm.S.tools.SUtils.getSubject(SUtils.java:132)
    at com.ibm.S.tools.CreateProvisioningPolicy.run(CreateProvisioningPolicy.java:40)
    at com.ibm.S.tools.CreateProvisioningPolicy.main(CreateProvisioningPolicy.java:68)
    Caused by: java.io.IOException: Unable to locate a login configuration
    at com.ibm.security.auth.login.ConfigFile.init(ConfigFile.java:281)
    at com.ibm.security.auth.login.ConfigFile.<init>(ConfigFile.java:122)
    ... 12 more
     
     
    It seems it is not able to find the jaas config file. I did put the jaas config in the classpath but still I am getting this error.. This is from my jaas.conf:
     
    WSLogin {
        com.ibm.ws.security.common.auth.module.proxy.WSLoginModuleProxy required delegate=com.ibm.ws.security.common.auth.module.WSLoginModuleImpl;
     
    };
     
     
    ITIM {
        com.ibm.ws.security.common.auth.module.proxy.WSLoginModuleProxy required delegate=com.ibm.itim.apps.jaas.spi.PlatformLoginModule;
     
    };
     

    Hi,

    It looks like either code not able to pick or read the jaas config file.

    Below are the details of my batch file used to run the loader utility.

    set LOGIN_CONFIG=../properties/jaas_login_was.conf

    "%JAVA_HOME%/bin/java" %OPTS% %SYSTEM_PROPERTIES% -cp "%CP%" -Djava.security.auth.login.config=%LOGIN_CONFIG% -Dapps.context.factory=%PLATFORM_CONTEXT_FACTORY% -Dapps.server.url=%APP_SRV_URL% -Dapps.ejb.user=%EJB_USER% -Dapps.ejb.pswd=%EJB_PSWD% -Ditim.user=%ITIM_USER% -Ditim.pswd=%ITIM_PSWD% -Dtenant.id=%TENANT_ID% -Dldapserver.root=%LDAPSERVER_ROOT% com.ibm.iam.utilities.PolicyLoader %*

    Cheers,
    Sourabh

  • TivoliHelp
    TivoliHelp
    10 Posts

    Re: Unable to get InitialPlatformContext

    ‏2013-10-14T17:43:41Z  
    • SourabhM
    • ‏2013-10-14T02:31:38Z

    Hi,

    It looks like either code not able to pick or read the jaas config file.

    Below are the details of my batch file used to run the loader utility.

    set LOGIN_CONFIG=../properties/jaas_login_was.conf

    "%JAVA_HOME%/bin/java" %OPTS% %SYSTEM_PROPERTIES% -cp "%CP%" -Djava.security.auth.login.config=%LOGIN_CONFIG% -Dapps.context.factory=%PLATFORM_CONTEXT_FACTORY% -Dapps.server.url=%APP_SRV_URL% -Dapps.ejb.user=%EJB_USER% -Dapps.ejb.pswd=%EJB_PSWD% -Ditim.user=%ITIM_USER% -Ditim.pswd=%ITIM_PSWD% -Dtenant.id=%TENANT_ID% -Dldapserver.root=%LDAPSERVER_ROOT% com.ibm.iam.utilities.PolicyLoader %*

    Cheers,
    Sourabh

    Thanks Sourabh. You are right. I was missing this -> "Djava.security.auth.login.config=%LOGIN_CONFIG%"