Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Can't start plugin with PageBuilderService Edited

I've made servlet plugin for crowd with template and when I try to add js and css resources like described here https://developer.atlassian.com/server/confluence/web-resource-module/  plugin can't start with that error in logs


[INFO] [talledLocalContainer] 2021-05-19 12:25:37,553 QuickReload - Plugin Installer ERROR [plugin.osgi.factory.OsgiPlugin] Plugin 'com.example.crowd.plugin.crowdplugin2' never resolved service '&pageBuilderService' with filter '(&(objectClass=com.atlassian.webresource.api.assembler.PageBuilderService)(objectClass=com.atlassian.webresource.api.assembler.PageBuilderService))'
[INFO] [talledLocalContainer] 2021-05-19 12:25:37,553 FelixDispatchQueue INFO [osgi.container.felix.FelixOsgiContainerManager] Stopped bundle com.example.crowd.plugin.crowdplugin2 (70)

here is atlassian-plugin.xml 

<?xml version="1.0" encoding="UTF-8"?>
<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}"/>
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>
<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="crowdplugin2"/>
<!-- add our web resources -->
<web-resource key="crowdplugin2-resources" name="crowdplugin2 Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="crowdplugin2.css" location="/css/crowdplugin2.css"/>
<resource type="download" name="crowdplugin2.js" location="/js/crowdplugin2.js"/>
<resource type="download" name="images/" location="/images"/>
<context>crowdplugin2</context>
</web-resource>
<web-item name="WebItem" i18n-name-key="web-item.name" key="web-item" section="topnav" weight="1000">
<description key="web-item.description">The WebItem Plugin</description>
<label key="web-item.label"/>
<link linkId="web-item-link">http://localhost:4990/crowd/plugins/servlet/userblock</link>
</web-item>
<servlet name="User Block" i18n-name-key="user-block.name" key="user-block" class="com.example.crowd.plugin.servlet.UserBlock">
<description key="user-block.description">The User Block Plugin</description>
<url-pattern>/userblock</url-pattern>
</servlet>
</atlassian-plugin>

 here is servlet class:

import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.templaterenderer.TemplateRenderer;
import com.atlassian.webresource.api.assembler.PageBuilderService;
import javax.inject.Inject;

@Scanned
public class UserBlock extends HttpServlet {
@ComponentImport
private final TemplateRenderer templateRenderer;
@ComponentImport
private PageBuilderService pageBuilderService;
private static final Logger log = LoggerFactory.getLogger(UserBlock.class);

@Inject
public UserBlock(TemplateRenderer templateRenderer, PageBuilderService pageBuilderService) {
this.templateRenderer = templateRenderer;
this.pageBuilderService = pageBuilderService;
}

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("text/html");
templateRenderer.render("template.vm", resp.getWriter());
pageBuilderService.assembler().resources().requireWebResource("ru.ftc.crowd.plugin.crowdplugin2:crowdplugin2-resources");

}
}

In pom.xml I have

<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-webresource-api</artifactId>
<version>4.1.3</version>
</dependency>

When I remove PageBuilderService from servlet class, plugin starts and I my template renders. 

What should I do to add js and css to my template?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

☕️ Monday coffee with Jexo: Weekly Atlassian news roundup | 21st June 2021

Hi community 👋, as every Monday we're bringing you a quick update on what happened in the Atlassian ecosystem last week. There were a few interesting events like for example the announcement of th...

29 views 0 4
Read article

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