I started down the path of adding “My Communities” to my little test database and following the same process as I had found the profile information I went to the playground and looked at the Java snippets for SmartCloud – get Communities
and from that I created the following Java code in my Utils class. When looking at the eclipse errors and adding the correct imports, there is no services.client.smartcloud.communities.Community option.
Running that I got the following error in my XPage
I knew that the only Endpoint I had created was the managed-bean “smartcloud”
So I copied and pasted the entire smartcloud bean in my faces-config.xml, renamed it “connections” and voila it solved the problem. Called connections, connecting to the SmartCloudOAuthEndpoint. Weird!
So I am not sure if this is a bug or defect or what within the SBT. It looks like many of the “connections” classes and objects have been ported over to smartcloud as there and many smartcloud classes with the same name and functions as the connections ones.
Or maybe this is intentional for some reason that I am not aware of.
Either way – noted and recorded so I don’t forget.
[…] Something missing in smartcloud SBT ? – “Cannot find Endpoint connections” […]
Hi Marky,
that’s no bug, but a feature 🙂
If you create a new CommunityService you can specify which endpoint to use – but there is a default. If you do not specify the endpoint, the sbt tries to use the endpoint called “connections”. If there is no endpoint called “connections” specfied in the faces-config.xml, then this fails obviously…
For my projects I’m testing against several Connections instances – Connections Cloud/Smartcloud, Greenhouse, and on premises installations. As there are some differences between the Smartcloud and the on premises versions I’m using a configuration document/Setup bean for this, to be able to switch without having to rebuild the application.
My code to get the communityService (called in the constructor of a “handler” bean) is as follows:
public void initialize () {
try {
endpointName = Setup.get().getEndpoint(); // “QAconnectionsSSO”;
if (null == endpointName || endpointName.isEmpty()) {
endpointName = “connectionsSSO”;
}
myEndpoint = EndpointFactory.getEndpointUnchecked(endpointName);
this.communityService = (new CommunityService (myEndpoint));
} catch (Throwable e) {
DebugToolbar.get().error(e);
}
}
Hans-Peter
Thank you so much for taking the time to comment. I see now that just because I used the Endpoint to authenticate it does not carry on through the session and I should have added it to the communities connection.
Really appreciate it 🙂
Marky,
what I just realized:
You have bound the endpoint (bean) to the *application scope* within the faces-config.xml. This means that – if you are reusing the endpoint within the application – all users will get the Connections data of the first user who logged on using your application! Probably not what you are intending to happen…
Hans-Peter
Aw crap I meant to change that – I knew that 🙂
thanks
Fix the image thank you – I took the screenshot last week before I realized the problem – see previous post on the bean scope
thanks again mate 🙂