Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

can run/find my servlet in atlas-run, but can't run/find it in atlas-run-standalone --product jira .

jacob delddd
Contributor
July 4, 2018

I'm following an outdated tutorial, with a lot of bugs (wich i hope i have fixed). 

https://developer.atlassian.com/server/framework/atlassian-sdk/run-your-plugin-in-the-container/

 

When the plugin is running in atlas-run, then the servlet is visible. When running it in atlas-run-standalone --product jira --version 7.3.7 (version of our jira) then i can't even find the plugin within 'addons mannagement'.

What could be a possible problem?

 

related posts: 

-https://community.atlassian.com/t5/Answers-Developer-Questions/Error-during-JIRA-tutorial-at-step-2-plugin-container/qaq-p/506512

-https://community.atlassian.com/t5/Answers-Developer-Questions/Run-your-plugin-in-the-container/qaq-p/499034

-https://community.atlassian.com/t5/Answers-Developer-Questions/Build-Error-in-JIRA-plugin-tutorial/qaq-p/505734

 

pom:

<?xml version="1.0" encoding="UTF-8"?>
<!--jira versie op aaaa server is 7.3.7 -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.ebo.plugins</groupId>
<artifactId>sprintReader</artifactId>
<version>1.0.0-SNAPSHOT</version>

<organization>
<name>aaaaaa</name>
<url>aaaaaaa/</url>
</organization>

<name>aaaaaaaa</name>
<description>This is the com.aaaaa.plugins:sprintReader plugin for Atlassian Refapp.</description>
<packaging>atlassian-plugin</packaging>

<dependencies>


<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-runtime</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>

<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>${plugin.testrunner.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
<!--https://developer.atlassian.com/server/framework/atlassian-sdk/adding-sal-dependency/ ZELF TOEGEVOEGD-->
<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope> <!-- Uses the application's SAL instead of bundling it into the plugin. -->
</dependency>

</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.atlassian.platform</groupId>
<artifactId>platform</artifactId>
<version>${platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.atlassian.platform</groupId>
<artifactId>third-party</artifactId>
<version>${platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-refapp-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${refapp.version}</productVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>

<!-- See here for an explanation of default instructions: -->
<!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

<!-- Add package to export here -->
<Export-Package>
com.ebo.com.ebo.plugins.plugins.api,
</Export-Package>

<!-- Add package import here -->
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*
</Import-Package>

<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>

<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<platform.version>3.0.0</platform.version>
<refapp.version>3.3.6</refapp.version>
<amps.version>6.3.15</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>

<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

</project>

 

attlas-plugin.xml

<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="sprintReader"/>

<!-- add our web resources -->
<web-resource key="aaaaa-resources" name="aaaaaaaWeb Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>

<resource type="download" name="aaaaaa.css" location="/css/aaaaaaaa.css"/>
<resource type="download" name="aaaaaa.js" location="/js/aaaaaaa.js"/>
<resource type="download" name="images/" location="/images"/>

<context>aaaaaa</context>
</web-resource>

<servlet name="adminUI" class="com.aaaaa.plugins.plugins.refapp.MyPluginServlet" key="test">
<url-pattern>/test</url-pattern> <!-- test nog veranderen -->
</servlet>

</atlassian-plugin>

 

class

package com.aaaaa.plugins.plugins.refapp;

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 java.io.IOException;
import java.net.URI;
import com.atlassian.sal.api.auth.LoginUriProvider;
import com.atlassian.sal.api.user.UserManager;
public class MyPluginServlet extends HttpServlet
{

private static final Logger log = LoggerFactory.getLogger(MyPluginServlet.class);

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

{
resp.setContentType("text/html");

resp.getWriter().write( some basic html );

}

}

 

1 answer

1 accepted

2 votes
Answer accepted
Nir Haimov
Community Champion
July 4, 2018

The problem is not in the code.

Your code is fine, when you type "atlas-run" your plugin is part of the jira instance created.

When you type "atlas-run-standalone" you create instance that not related to your plugin.

So if you want to see your plugin in the standalone jira instance, you have to manually upload your plugin jar from the "manage add-ons"

jacob delddd
Contributor
July 4, 2018

But then what is the reason i have a dead link at: http://localhost:2990/jira/plugins/servlet/test?

Nir Haimov
Community Champion
July 4, 2018

You get dead link after you installed the plugin?

jacob delddd
Contributor
July 4, 2018

I closed it & used atlas-run --product jira --version 7.3.7.

It finally works, thank you!!

Nir Haimov
Community Champion
July 4, 2018

You are welcome :)

Please close this ticket by marking my solution as the answer :)

Suggest an answer

Log in or Sign up to answer