Looks like the CarbonContext doesn't have a username. It shouldn't be the
case if you have logged in to the server.

Thanks,
Johann.

On Fri, Oct 24, 2014 at 5:38 PM, Shiva Balachandran <sh...@wso2.com> wrote:

> Hi All,
>
> I am doing some development work on IS, I used the following code to
> retrieve all the service providers
>
> ApplicationManagementService aptMgtService =
> ApplicationManagementService.getInstance();
> try{
> log.info(aptMgtService);
> ApplicationBasicInfo[] applicationBasicInfo =
> aptMgtService.getAllApplicationBasicInfo();
> for (ApplicationBasicInfo appData :applicationBasicInfo)
> {
> log.info(aptMgtService.getApplication(appData.getApplicationName()));
> log.info
> (aptMgtService.getApplication(appData.getApplicationName()).getInboundAuthenticationConfig());
>
> }
> }
> catch(IdentityApplicationManagementException ex) {
> if (log.isDebugEnabled()) {
> log.debug(ex.getMessage());
>
> }
> }
>
> There is a null point exeception being fired when the line
> aptMgtService.getAllApplicationBasicInfo(); is executed,
>
> Here is the error -
>
> 2014-10-24 17:31:41,501] ERROR
> {org.wso2.carbon.identity.application.mgt.ApplicationManagementService} -
>  Error occurred while retrieving the all applications
> java.lang.NullPointerException
> at
> org.wso2.carbon.utils.multitenancy.MultitenantUtils.getTenantAwareUsername(MultitenantUtils.java:50)
> at
> org.wso2.carbon.identity.application.mgt.ApplicationMgtUtil.isUserAuthorized(ApplicationMgtUtil.java:90)
> at
> org.wso2.carbon.identity.application.mgt.dao.impl.ApplicationDAOImpl.getAllApplicationBasicInfo(ApplicationDAOImpl.java:1978)
> at
> org.wso2.carbon.identity.application.mgt.ApplicationManagementService.getAllApplicationBasicInfo(ApplicationManagementService.java:164)
> at
> org.wso2.carbon.identity.tools.saml.validator.SAMLValidatorService.getIssuersOfSAMLServiceProviders(SAMLValidatorService.java:218)
>
> I want to know if i have created/used the Application Manangement Service
> class right? I am using this code in another service class.
>
> Thank you,
> Shiva Balachandran
> Software Engineer
> WSO2 Inc.
>
> Mobile - +94 774445788
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Thanks & Regards,

*Johann Dilantha Nallathamby*
Associate Technical Lead & Product Lead of WSO2 Identity Server
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - *+94777776950*
Blog - *http://nallaa.wordpress.com <http://nallaa.wordpress.com>*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to