Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,458,036
Community Members
 
Community Events
176
Community Groups

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?

1 answer

0 votes

Hi @aas

 

As just answered on your previous question, just in case other Crowd users stumble over this question here:

App development related questions like this are best asked in the Crowd Development category of the Atlassian Developer Community, you have a greater chance to get feedback from other app developers there.

That said, to set expectations, you'll note that there are comparatively few Crowd related questions and even less answers there - regardless, quite some Atlassian team members monitoring the community by now, so hopefully they can loop in someone from the Crowd team.

Cheers,

Steffen

Hi @Steffen Opel _Utoolity_ 

Unfortunately I don't know how ask questions in Atlassian Developer Community, there no any buttons to create topic or ask questions. I can only read topics

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events