+ Start a Discussion
Saravanan Sivalingam 1Saravanan Sivalingam 1 

error thie line

What this error?

KeyManagerFactory not initialized
Error is in expression '{!accessToken}' in component <apex:page> in page document407_access_token: Class.checkingAccessToken.accessToken: line 50, column 1
An unexpected error has occurred. Your development organization has been notified.


What I did so far?
1. Created a vf page and controller
2. Controller contains http callouts.
3. Custom link to call this VF page.
4. When I click the link. its showing the above error
Best Answer chosen by Saravanan Sivalingam 1
pconpcon
So your issue is most likely that you have a variable named "http" and it's conflicting with the class.  I would recommend changing line 50 of your controller to
 
Http h = new Http();
HttpResponse res = h.send(req);

I've found that the Http class is one of the classes in Salesforce that gives me all sorts of troubles if I have any name conflicts.

All Answers

pconpcon
Can you please include the visualfore page and the controller here?  And please make sure to note if line 50 of your pasted code does not line up with line 50 of your error message?  If you cannot provide all of the class, please provide all of the parts pertaining to the checkingAccessToken class and any methods that lead to this point in the code.

NOTE: When adding code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.
pconpcon
So your issue is most likely that you have a variable named "http" and it's conflicting with the class.  I would recommend changing line 50 of your controller to
 
Http h = new Http();
HttpResponse res = h.send(req);

I've found that the Http class is one of the classes in Salesforce that gives me all sorts of troubles if I have any name conflicts.
This was selected as the best answer
Saravanan Sivalingam 1Saravanan Sivalingam 1
@pcon Thanks for the response. it's solved now. But when I tried it first and multiple times its showing same error. After last one its working.