Adding Web Resources Lead to Dead Link?


I am new to JIRA plug in development. I was trying to had some web resources (an html and js file) to my project. However when I did I got a dead link error after running atlas-package to quick reload.

My atlassian-plugin.xml is as follows

<?xml version="1.0" encoding="UTF-8"?>

<atlassian-plugin key="${atlassian.plugin.key}" name="${}" plugins-version="2"> 
    <vendor name="${}" url="${project.organization.url}"/>  
    <param name="plugin-icon">images/pluginIcon.png</param>  
    <param name="plugin-logo">images/pluginLogo.png</param> 
  <!-- add our i18n resource -->  
  <resource type="i18n" name="i18n" location="ngdemo"/>  
  <!-- add our web resources -->  
  <web-resource key="ngdemo-resources" name="ngdemo Web Resources"> 
    <resource type="download" name="ngdemo.css" location="/css/ngdemo.css"/>  
    <resource type="download" name="ngdemo.js" location="/js/ngdemo.js"/>  
    <resource type="download" name="images/" location="/images"/>  
  <servlet name="Demo Servlet" i18n-name-key="" key="demo-servlet" class="com.grushka.demo.servlet.DemoServlet"> 
    <description key="demo-servlet.description">The Demo Servlet Plugin</description>  
  <web-resource key="scriptaculous">
    <resource type="download" name="index.html" location="/javascript/index.html" />
    <resource type="download" name="script.js" location="/javascript/script.js" />

My is as follows (based on

package com.grushka.demo.servlet;

import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.webresource.api.assembler.PageBuilderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.atlassian.templaterenderer.TemplateRenderer;

public class DemoServlet extends HttpServlet{
    //private static final Logger log = LoggerFactory.getLogger(DemoServlet.class);

    private PageBuilderService pageBuilderService;

    public DemoServlet(PageBuilderService pageBuilderService)
        this.pageBuilderService = pageBuilderService;

    //private final TemplateRenderer templateRenderer;

    //public DemoServlet(TemplateRenderer templateRenderer) {
    //    this.templateRenderer = templateRenderer;

    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException

        //templateRenderer.render("index.vm", resp.getWriter());


The structure is
->Java -->com.grushka.demo.servlet —>DemoServlet
->resources -->javascript —>index.html
->resources -->javascript —>script.js
->resources -->atlassian-plugin.xml

Again, I am very new to this so any help is appreciated!

I’ve only added WebAction (webwork1 in atlassian-plugin.xml) pages so my experience might be a bit different to what you’re trying to achieve but from what I’ve experienced, your best bet is to look at the target\jira\home\log\atlassian-jira.log.

I usually clear the log, then refresh to the 404 page and look at the log. AFAIK 404 pages come from errors in configuration/Java so I wouldn’t worry about JavaScript for now.

For instance, are you sure your plugin key is com.grushka.demo.servlet? Also from examples I am looking at, maybe you need to output something in the response for it to work.

I hope this will help you

When I look at that I get this error: ERROR [c.a.p.osgi.factory.OsgiPlugin] Plugin ‘com.grushka.demo.ngdemo’ never resolved service ‘&pageBuilderService’ with filter ‘(&(objectClass=com.atlassian.webresource.api.assembler.PageBuilderService)(objectClass=com.atlassian.webresource.api.assembler.PageBuilderService))’

I’m not sure what this means?

  1. Your servlet is not rendering anything
  2. I’m not sure how you are planning to use downloaded <resource type="download" name="index.html" location="/javascript/index.html" />
  3. I’d recommend using a WebWork action as mentioned in the other answer