Voting in a Confluence Answers
Asked by Jonas Andersson:

Hi,

We are experimenting around with "Questions" for Confluence, and would like to be able to create a question that consists of a vote with 3 options.. Is that possible somehow?

I get to insert the vote macro, but when trying to vote Questions shows a "There was a problem casting a vote. Returned status: error, error: Internal Server Error"

When editing the property of the vote macro, it shows error:

"There is no metadata configured for this macro which means no configuration screen can be presented here.  
If this is a user macro then you can add metadata to the template using the [User Macro Administration](https://flownet.nl.flowtraders.local/admin/usermacros.action) console."

Catalina.out:

```
2016-01-05 15:43:56,763 ERROR [http-bio-8091-exec-39322] [common.error.jersey.ThrowableExceptionMapper] toResponse Uncaught exception thrown by REST service: com.atlassian.confluence.content.CustomContentEntityObject cannot be cast to com.atlassian.confluence.pages.AbstractPage -- url: /rest/surveyplugin/1.0/pages/38742108/votes | userName: &lt;myname&gt; | referer: https://&lt;ourconfluence&gt;/questions/38741965/answers/38742108?flashId=507343721java.lang.ClassCastException: com.atlassian.confluence.content.CustomContentEntityObject cannot be cast to com.atlassian.confluence.pages.AbstractPage    at com.atlassian.confluence.pages.persistence.dao.hibernate.HibernateAbstractPageDao.getAbstractPageById(HibernateAbstractPageDao.java:41)    at sun.reflect.GeneratedMethodAccessor925.invoke(Unknown Source)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)    at java.lang.reflect.Method.invoke(Unknown Source)    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)    at com.sun.proxy.$Proxy57.getAbstractPageById(Unknown Source)    at com.atlassian.confluence.pages.DefaultPageManager.getAbstractPage(DefaultPageManager.java:187)    at com.atlassian.confluence.pages.DefaultPageManager.getById(DefaultPageManager.java:204)    at com.atlassian.confluence.pages.DefaultPageManager.getById(DefaultPageManager.java:77)    at sun.reflect.GeneratedMethodAccessor800.invoke(Unknown Source)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)    at java.lang.reflect.Method.invoke(Unknown Source)
```

UPDATED:

The vote plugin we are using is: Survey and Vote Macros 2.9.2.

To reproduce:

1. create a new question. Add a question in "Ask a question"-box
2. in the rich text editor, we add

```
{vote}
```

3. Clicking on the box, and clicking the edit button results in the error:  
No Macro Metadata  
There is no metadata configured for this macro which means no configuration screen can be presented here.

If this is a user macro then you can add metadata to the template using the [User Macro Administration](https://flownet.nl.flowtraders.local/admin/usermacros.action) console.


Answers:
author: Steven F Behnke
body: Err bug


author: Steven F Behnke
body: I am under the impression that confluence questions doesn't support all macros for some reason or another. A quick search here found a lot of relevant discussion here on this Answer: <https://answers.atlassian.com/questions/262516/problemserror-with-macro-as-part-of-an-answer-in-confluence-questions>The next step is to find a hug in the issue tracker that covers this. ;)


author: Jonas Andersson
body: You are right, sorry about that. I clarified the question a bit just now, and showed how it can be reproduced.So it's not a custom user macro. I opened a case with atlassian who claimed that they did not manage to reproduce the error i see, making me assume it should work with the current version i use.


author: Steven F Behnke
body: No one can possibly know what votemacro you're referring to, since you've quite clearly indicated it's a custom User Macro. Also, I am not positive your two errors are connected in any way, shape, or form. Confluence complains about meta data if you don't define any, in a custom user macro. If you haven't completed the requirements, it will complain.Now, your server error is different - com.atlassian.confluence.content.CustomContentEntityObject cannot be cast to com.atlassian.confluence.pages.AbstractPageThe code is bad. It's not doing something that's possible. Perhaps this works on Pages but not Questions, is that what's wrong?


Tags: questions-for-confluence