Configure Gravatar Server
Asked by Sebastien Erard:

We are running Bamboo and Confluence with the Confluence Avatar Server (<https://plugins.atlassian.com/plugins/com.cutlass.confluence.plugin.rest.cas>). Bamboo can access a Gravatar server, but is nailed down to [gravatar.com](http://gravatar.com). Is is possible to redirect Bamboo to use the Confluence Avatar Server?


Answers:
author: James Dumay
body: Hi Sebastien, redirecting Bamboo to use the Confluence Avatar Server isn't possible as we have hard coded [gravatar.com](http://gravatar.com) in the code and we are unlikely to make this configurable anytime soon.

comments: author: Sebastien Erard
body: There is a ticket about this one: <https://jira.atlassian.com/browse/BAM-8451>


author: Justin Shapiro
body: Vote for that issue! <https://jira.atlassian.com/browse/BAM-8451>

The workaround is to implement GravatarService yourself. Change GRAVATAR_URL to your server:

private static String GRAVATAR_URL = "https://yourserver/confluence/rest/cas/1.0/avatar/server/";

Compile and install into:

\<bambooinstall\>webapp/WEB-INF/classes/com/atlassian/bamboo/user/gravatar

problem with this approach is that you need to do it each time you upgrade.

comments: author: EddieW
body: Can you expand that a bit Justin?

I created a GravatarServiceImpl that implements the interface, using my own server, but after placing the compiled class in the directory yuo mention (which i had to create) it blows up!

I used the source downloaded from my.atlassian and changed the variable for server_URL only... not sure why it doesnt have the requred method.

```
2012-08-21 14:07:05,520 ERROR [http-8085-16] [FiveOhOh] 500 Exception was thrown.com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NoSuchMethodError: com.atlassian.bamboo.user.gravatar.GravatarServiceImpl.access$000(Lcom/atlassian/bamboo/user/gravatar/GravatarServiceImpl;)Lcom/atlassian/bamboo/configuration/AdministrationConfigurationManager;             ....Caused by: java.lang.NoSuchMethodError: com.atlassian.bamboo.user.gravatar.GravatarServiceImpl.access$000(Lcom/atlassian/bamboo/user/gravatar/GravatarServiceImpl;)Lcom/atlassian/bamboo/configuration/AdministrationConfigurationManager;                ... 201 more
```


author: Justin Shapiro
body: I pretty much did the same thing. You would do this in the unpacked war under your java container (?tomcat?). The classes in the classes direcectory are loaded before those in the lib directory which is why yours should get picked up first. I didn't have the code in front of me when I posted that but it would seem I also added:

public void setGravatarUrl(String gravatarUrl) { this.GRAVATAR_URL = gravatarUrl; }

Also I have done this in 3.1.1 and 3.4.4 YMMV


author: EddieW
body: Hmm, maybe it is a change in the AdministrationConfigurationManager.

It uses a lazyreference that seems to be bombing out. I am trying a hard coded boolean for the enabled variable.


author: EddieW
body: Yes! That was my trouble. The Atlassian provided class used a lazyreference for the boolean as to whether gravatar was enabled or not. ANd (for whatver reason) it blew up trying to access the adminstrationConfigurationManagement property for the actual value.

So I just hard coded a true (if I am deploying a custom class obvuiously I want the service enabled), and added soem explicit logging to alude to that.

<br />

So whenever you try to enable/disable the option you get:

2012-08-21 16:26:16,243 WARN \[http-8085-3\] \[GravatarServiceImpl\] A custom GravatarService class is in the WEB-INF/classes/com/atlassian/bamboo/user/gravatar directory, and will ignore the admin setting.

2012-08-21 16:26:16,243 WARN \[http-8085-3\] \[GravatarServiceImpl\] Gravatar URL : <https://myserver/wiki/rest/cas/1.0/avatar/server/>


Tags: bamboo

gravatar