It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Jira Plugin - velocity templates not rendered

Hi,

I am trying to create a Jira plugin. I have started from the archetype atlassian-connect-spring-boot-archetype.

The logs show that the request is resolved from test-connect-edit to connect-edit and then the flow reaches the controller. But after the controller, /edit is requested which is not resolved to the velocity template.

I have tried the following:

  1. Added the velocity and velocity-tools dependency in the pom.xml, got the same error
  2. Tried using the atlassian TemplateRenderer class, but somehow not able to resolve the dependencies needed. Was not able to compile the code

Following are the details of the setup:

Template placed at /resources/templates/edit.vm 

atlassian-connect.json entry

{
"name": { "value": "Edit" },
"key": "test-connect-edit",
"url": "/connect-edit",
"conditions": [{
"condition": "user_is_logged_in"
}],
"location": "system.top.navigation.bar"
}

 

The Controller:

@RequestMapping(value = "/connect-edit", method = RequestMethod.GET)
public String getEditPage(@AuthenticationPrincipal AtlassianHostUser hostUser, Model model, HttpServletResponse response) {
addValueAttributeToModel(hostUser, model);
return "edit";

}

 

Following is the generated log:

2019-10-10 17:29:55.889 DEBUG 26900 --- [nio-8083-exec-7] c.a.c.s.i.a.jwt.JwtAuthenticationFilter : Retrieved JWT from request
2019-10-10 17:29:58.305 DEBUG 26900 --- [nio-8083-exec-7] c.a.c.s.i.a.j.JwtAuthenticationProvider : Parsed JWT: {"sub":"5c4b5b86e1e4793912e098c7","qsh":"2d0abcd298eef39efcbd0d413b58769c399ccc058da1b67560ef3026ac26df6c","iss":"94b7fe42-a1d1-3d2f-8c58-ac4b16e83d1c","context":{},"exp":1570709650,"iat":1570708750}
2019-10-10 17:29:58.328 DEBUG 26900 --- [nio-8083-exec-7] c.a.c.s.i.a.j.JwtAuthenticationProvider : Canonical request for incoming JWT: [CanonicalHttpServletRequest@6139c61e method = 'GET', relativePath = '/connect-edit', parameterMap = '[xdm_e -> (https://testdev.atlassian.net),xdm_c -> (channel-AtlassianAddonFirst__test-connect-edit),cp -> (),xdm_deprecated_addon_key_do_not_use -> (AtlassianAddonFirst),lic -> (none),cv -> (1.531.0),jwt -> (eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1YzRiNWI4NmUxZTQ3OTM5MTJlMDk4YzciLCJxc2giOiIyZDBhYmNkMjk4ZWVmMzllZmNiZDBkNDEzYjU4NzY5YzM5OWNjYzA1OGRhMWI2NzU2MGVmMzAyNmFjMjZkZjZjIiwiaXNzIjoiOTRiN2ZlNDItYTFkMS0zZDJmLThjNTgtYWM0YjE2ZTgzZDFjIiwiY29udGV4dCI6e30sImV4cCI6MTU3MDcwOTY1MCwiaWF0IjoxNTcwNzA4NzUwfQ.f2VhhLCpXyQfySYvsrdvf-W-4sESAMKWhq2nxXA8LpA),]']
2019-10-10 17:29:58.332 DEBUG 26900 --- [nio-8083-exec-7] c.a.c.s.i.a.j.JwtAuthenticationProvider : Verified JWT for host https://testdev.atlassian.net (94b7fe42-a1d1-3d2f-8c58-ac4b16e83d1c)
2019-10-10 17:29:58.333 DEBUG 26900 --- [nio-8083-exec-7] o.s.web.servlet.DispatcherServlet : GET "/connect-edit?xdm_e=https%3A%2F%2Ftestdev.atlassian.net&xdm_c=channel-AtlassianAddonFirst__test-connect-edit&cp=&xdm_deprecated_addon_key_do_not_use=AtlassianAddonFirst&lic=none&cv=1.531.0&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1YzRiNWI4NmUxZTQ3OTM5MTJlMDk4YzciLCJxc2giOiIyZDBhYmNkMjk4ZWVmMzllZmNiZDBkNDEzYjU4NzY5YzM5OWNjYzA1OGRhMWI2NzU2MGVmMzAyNmFjMjZkZjZjIiwiaXNzIjoiOTRiN2ZlNDItYTFkMS0zZDJmLThjNTgtYWM0YjE2ZTgzZDFjIiwiY29udGV4dCI6e30sImV4cCI6MTU3MDcwOTY1MCwiaWF0IjoxNTcwNzA4NzUwfQ.f2VhhLCpXyQfySYvsrdvf-W-4sESAMKWhq2nxXA8LpA", parameters={masked}
2019-10-10 17:29:58.336 DEBUG 26900 --- [nio-8083-exec-7] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public java.lang.String com.test.controller.SettingsController.getEditPage(com.atlassian.connect.spring.AtlassianHostUser,org.springframework.ui.Model,javax.servlet.http.HttpServletResponse)
2019-10-10 17:30:00.535 DEBUG 26900 --- [nio-8083-exec-7] o.s.w.s.v.ContentNegotiatingViewResolver : Selected 'text/html' given [text/html, application/xhtml+xml, image/webp, image/apng, application/signed-exchange;v=b3, application/xml;q=0.9, */*;q=0.8]
2019-10-10 17:30:00.536 DEBUG 26900 --- [nio-8083-exec-7] o.s.w.servlet.view.InternalResourceView : View name 'edit', model {atlassianConnectLicense=none, atlassian-connect-license=none, atlassianConnectLocale=null, atlassian-connect-locale=null, atlassianConnectTimezone=null, atlassian-connect-timezone=null, atlassianConnectAllJsUrl=https://testdev.atlassian.net/atlassian-connect/all-debug.js, atlassian-connect-all-js-url=https://testdev.atlassian.net/atlassian-connect/all-debug.js, atlassianConnectToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJBdGxhc3NpYW5BZGRvbkZpcnN0Iiwic3ViIjoiNWM0YjViODZlMWU0NzkzOTEyZTA5OGM3IiwiY2xpZW50S2V5IjoiOTRiN2ZlNDItYTFkMS0zZDJmLThjNTgtYWM0YjE2ZTgzZDFjIiwiaXNzIjoiQXRsYXNzaWFuQWRkb25GaXJzdCIsImV4cCI6MTU3MDcwOTY5OCwiaWF0IjoxNTcwNzA4Nzk4fQ.ag2dq_j8PVYKK0LTWrZX0n0vH_Thvalw0pUqMM3pb48, atlassian-connect-token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJBdGxhc3NpYW5BZGRvbkZpcnN0Iiwic3ViIjoiNWM0YjViODZlMWU0NzkzOTEyZTA5OGM3IiwiY2xpZW50S2V5IjoiOTRiN2ZlNDItYTFkMS0zZDJmLThjNTgtYWM0YjE2ZTgzZDFjIiwiaXNzIjoiQXRsYXNzaWFuQWRkb25GaXJzdCIsImV4cCI6MTU3MDcwOTY5OCwiaWF0IjoxNTcwNzA4Nzk4fQ.ag2dq_j8PVYKK0LTWrZX0n0vH_Thvalw0pUqMM3pb48}
2019-10-10 17:30:00.536 DEBUG 26900 --- [nio-8083-exec-7] o.s.w.servlet.view.InternalResourceView : Forwarding to [edit]
2019-10-10 17:30:00.536 DEBUG 26900 --- [nio-8083-exec-7] o.s.web.servlet.DispatcherServlet : "FORWARD" dispatch for GET "/edit?xdm_e=https%3A%2F%2Ftestdev.atlassian.net&xdm_c=channel-AtlassianAddonFirst__test-connect-edit&cp=&xdm_deprecated_addon_key_do_not_use=AtlassianAddonFirst&lic=none&cv=1.531.0&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1YzRiNWI4NmUxZTQ3OTM5MTJlMDk4YzciLCJxc2giOiIyZDBhYmNkMjk4ZWVmMzllZmNiZDBkNDEzYjU4NzY5YzM5OWNjYzA1OGRhMWI2NzU2MGVmMzAyNmFjMjZkZjZjIiwiaXNzIjoiOTRiN2ZlNDItYTFkMS0zZDJmLThjNTgtYWM0YjE2ZTgzZDFjIiwiY29udGV4dCI6e30sImV4cCI6MTU3MDcwOTY1MCwiaWF0IjoxNTcwNzA4NzUwfQ.f2VhhLCpXyQfySYvsrdvf-W-4sESAMKWhq2nxXA8LpA", parameters={masked}
2019-10-10 17:30:00.540 DEBUG 26900 --- [nio-8083-exec-7] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]
2019-10-10 17:30:00.545 DEBUG 26900 --- [nio-8083-exec-7] o.s.w.s.r.ResourceHttpRequestHandler : Resource not found
2019-10-10 17:30:00.545 DEBUG 26900 --- [nio-8083-exec-7] o.s.web.servlet.DispatcherServlet : Exiting from "FORWARD" dispatch, status 404
2019-10-10 17:30:00.546 DEBUG 26900 --- [nio-8083-exec-7] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND
2019-10-10 17:30:00.546 DEBUG 26900 --- [nio-8083-exec-7] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/error?xdm_e=https%3A%2F%2Ftestdev.atlassian.net&xdm_c=channel-AtlassianAddonFirst__test-connect-edit&cp=&xdm_deprecated_addon_key_do_not_use=AtlassianAddonFirst&lic=none&cv=1.531.0&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1YzRiNWI4NmUxZTQ3OTM5MTJlMDk4YzciLCJxc2giOiIyZDBhYmNkMjk4ZWVmMzllZmNiZDBkNDEzYjU4NzY5YzM5OWNjYzA1OGRhMWI2NzU2MGVmMzAyNmFjMjZkZjZjIiwiaXNzIjoiOTRiN2ZlNDItYTFkMS0zZDJmLThjNTgtYWM0YjE2ZTgzZDFjIiwiY29udGV4dCI6e30sImV4cCI6MTU3MDcwOTY1MCwiaWF0IjoxNTcwNzA4NzUwfQ.f2VhhLCpXyQfySYvsrdvf-W-4sESAMKWhq2nxXA8LpA", parameters={masked}
2019-10-10 17:30:00.548 DEBUG 26900 --- [nio-8083-exec-7] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public com.atlassian.connect.spring.internal.AtlassianConnectErrorController$ErrorJson com.atlassian.connect.spring.internal.AtlassianConnectErrorController.error(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2019-10-10 17:30:00.551 DEBUG 26900 --- [nio-8083-exec-7] m.m.a.RequestResponseBodyMethodProcessor : Using 'application/json;q=0.8', given [text/html, application/xhtml+xml, image/webp, image/apng, application/signed-exchange;v=b3, application/xml;q=0.9, */*;q=0.8] and supported [application/json, application/*+json, application/json, application/*+json]
2019-10-10 17:30:00.552 DEBUG 26900 --- [nio-8083-exec-7] m.m.a.RequestResponseBodyMethodProcessor : Writing [com.atlassian.connect.spring.internal.AtlassianConnectErrorController$ErrorJson@1c9add68]
2019-10-10 17:30:00.554 DEBUG 26900 --- [nio-8083-exec-7] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404

 

 

2 answers

1 accepted

0 votes
Answer accepted

Adding this here for completeness:

Spring-boot has officially deprecated the support for Velocity.

As this was a new development, I have incorporated Thymeleaf.

Dario Atlassian Team Oct 11, 2019

Thanks for the update @VS ! 

I have accepted your answer to this topic so that this question is now marked as resolved :) 

 

Cheers,
Dario

Like VS likes this
0 votes
Dario Atlassian Team Oct 11, 2019

Hi @VS ,

Welcome to the Atlassian Community!

I am not sure if it can be of any help, but you may want to review the below developers blog post:

 

However, please notice that this is not the best place to get support on development related issues. 

As mentioned in https://bitbucket.org/atlassian/atlassian-connect-spring-boot/src/master/ :

Getting help

If you need help using Spring Boot, see the Getting help section of the Spring Boot Reference Guide.

If you need help developing against Atlassian products, see the Atlassian Developer site.

If you need help using functionality provided by atlassian-connect-spring-boot, please ask in the Atlassian Developer Community.

If you want to report a problem, please raise a support request in Atlassian Ecosystem's Developer Service Desk.

 

So, in case the provided link does not help, you may want to ask this same question in the Atlassian Developer Community.

 

Cheers,
Dario

Thanks @Dario . Will move the discussion to the dev community.

Like Dario likes this
Dario Atlassian Team Oct 11, 2019

You are very welcome @VS   

However, before posting the question in there first search if anything similar has already been asked by someone else since there are chances similar topics have already been discussed.

Have a nice weekend!

Dario

Like VS likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

314 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you