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
  • Community
  • Answers Developer Questions
  • Questions
  • The plugin key '${project.groupId}.${project.artifactId}-tests' must either match the OSGi bundle symbolic name (Bundle-SymbolicName) or be specified in the Atlassian-Plugin-Key manifest header

The plugin key '${project.groupId}.${project.artifactId}-tests' must either match the OSGi bundle symbolic name (Bundle-SymbolicName) or be specified in the Atlassian-Plugin-Key manifest header

I am trying to follow the example given at http://blogs.atlassian.com/2013/03/atlassian-sdk-plugin-code-generation-with-stash/. Compilation seems to be ok, but when I try to run I get the following error:

[INFO] [talledLocalContainer] INFO: Initializing Spring root WebApplicationContext
[INFO] [talledLocalContainer] 2013-06-18 12:54:49,941 INFO  [localhost-startStop-1]  c.a.s.i.server.BuildInfoLogger Starting Stash 2.5.0 (9e87d57 built on Mon Jun 10 21:02:40 CEST 2013)
[INFO] [talledLocalContainer] 2013-06-18 12:54:50,650 INFO  [localhost-startStop-1]  c.a.s.i.server.BuildInfoLogger JVM: Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM 1.6.0_43-b01
[INFO] [talledLocalContainer] 2013-06-18 12:54:52,983 INFO  [localhost-startStop-1]  c.a.s.internal.home.HomeLockAcquirer Successfully acquired lock on home directory /work/2013/atlassian/stash_plugin/plugin-example/target/stash/home for 9741@jobbpc.bitfrost
[INFO] [talledLocalContainer] 2013-06-18 12:54:54,915 WARN  [localhost-startStop-1]  com.jolbox.bonecp.BoneCPConfig JDBC password not set in driver properties, copying it from pool config
[INFO] [talledLocalContainer] 2013-06-18 12:55:13,495 INFO  [localhost-startStop-1]  com.atlassian.stash Switching to log level [DEBUG]
[INFO] [talledLocalContainer] 2013-06-18 12:55:13,530 DEBUG [localhost-startStop-1]  c.a.s.i.t.SemaphoreThrottleService Configured resource [scm-hosting] with 6 tickets and an acquire timeout of 300 s
[INFO] [talledLocalContainer] 2013-06-18 12:55:13,534 DEBUG [localhost-startStop-1]  c.a.s.i.t.SemaphoreThrottleService Configured resource [scm-command] with 25 tickets and an acquire timeout of 2 s
[INFO] [talledLocalContainer] 2013-06-18 12:55:13,635 DEBUG [localhost-startStop-1]  c.a.s.i.avatar.DiskAvatarRepository Not purging temporary avatars; /work/2013/atlassian/stash_plugin/plugin-example/target/stash/home/data/avatars/tmp does not exist
[INFO] [talledLocalContainer] 2013-06-18 12:55:16,411 INFO  [localhost-startStop-1]  c.a.s.i.hook.DefaultHookService Hook callback socket listening on 127.0.0.1:32934
[INFO] [talledLocalContainer] 2013-06-18 12:55:18,442 DEBUG [localhost-startStop-1]  c.a.s.i.i.ChangesetIndexingScheduler Starting changeset indexing thread pool with a maximum of 2 threads
[INFO] [talledLocalContainer] 2013-06-18 12:55:28,469 WARN  [localhost-startStop-1]  c.a.p.o.f.t.s.ScanDescriptorForHostClassesStage The plugin 'atlassian-universal-plugin-manager-plugin-2.11.1.jar' uses a package 'org.apache.commons.fileupload.servlet' that is also exported by the application.  It is highly recommended that the plugin use its own packages.
[INFO] [talledLocalContainer] 2013-06-18 12:55:34,985 ERROR [localhost-startStop-1]  o.s.web.context.ContextLoader Context initialization failed
[INFO] [talledLocalContainer] java.lang.IllegalArgumentException: The plugin key '${project.groupId}.${project.artifactId}-tests' must either match the OSGi bundle symbolic name (Bundle-SymbolicName) or be specified in the Atlassian-Plugin-Key manifest header
[INFO] [talledLocalContainer]   at com.atlassian.plugin.osgi.factory.OsgiPluginUninstalledHelper.install(OsgiPluginUninstalledHelper.java:77) ~[atlassian-plugins-osgi-3.0.0-m34.jar:na]
[INFO] [talledLocalContainer]   at com.atlassian.plugin.osgi.factory.OsgiPlugin.installInternal(OsgiPlugin.java:420) ~[atlassian-plugins-osgi-3.0.0-m34.jar:na]
[INFO] [talledLocalContainer]   at com.atlassian.plugin.impl.AbstractPlugin.install(AbstractPlugin.java:418) ~[atlassian-plugins-core-3.0.0-m34.jar:na]
[INFO] [talledLocalContainer]   at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:768) ~[atlassian-plugins-core-3.0.0-m34.jar:na]
[INFO] [talledLocalContainer]   at com.atlassian.plugin.manager.DefaultPluginManager.init(DefaultPluginManager.java:241) ~[atlassian-plugins-core-3.0.0-m34.jar:na]
[INFO] [talledLocalContainer]   at com.atlassian.stash.internal.plugin.CorePluginManager.onApplicationEvent(CorePluginManager.java:45) ~[stash-platform-2.5.0.jar:na]
[INFO] [talledLocalContainer]   at com.atlassian.stash.internal.plugin.CorePluginManager.onApplicationEvent(CorePluginManager.java:16) ~[stash-platform-2.5.0.jar:na]
[INFO] [talledLocalContainer]   at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:96) ~[spring-context-3.2.2.RELEASE.jar:3.2.2.RELEASE]
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334) ~[spring-context-3.2.2.RELEASE.jar:3.2.2.RELEASE]
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948) ~[spring-context-3.2.2.RELEASE.jar:3.2.2.RELEASE]
[INFO] [talledLocalContainer]   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) ~[spring-context-3.2.2.RELEASE.jar:3.2.2.RELEASE]
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) ~[spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) ~[spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
[INFO] [talledLocalContainer]   at com.atlassian.johnson.spring.web.context.JohnsonContextLoaderListener.initWebApplicationContext(JohnsonContextLoaderListener.java:102) [atlassian-johnson-spring-2.1.0.jar:na]
[INFO] [talledLocalContainer]   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887) [catalina.jar:7.0.40]

Searching for the string "must either match the OSGi bundle symbolic name" on google only gives 8 references, all to pages at atlassian.com (one bitbucket.org). Following all of those did not make me much wiser, only that the issue could perhaps be related to less common java versions like IBM's JDK. I am running Fedora 17 with the default java-1.7.0-openjdk-1.7.0.19.x86_64 package, but I also downloaded the latest java 6 sdk from Oracle and used that.

JAVA_HOME=/work/2013/atlassian/stash_plugin/jdk1.6.0_43
export JAVA_HOME

PATH=$JAVA_HOME/bin:$PATH
export PATH

This made no difference.

I have made the following changes to the code base:

$ git log --oneline 
22d5a90 Update BeerOClockHook.java according to http://blogs.atlassian.com/2013/03/atlassian-sdk-plugin-code-generation-with-stash/
fab8cb1 Add project.groupId and project.artifactId properties
6eaa59e Specify resource text encoding
7706f90 Ran atlas-create-stash-plugin-module
9626676 Ran atlas-create-stash-plugin
4eb2a4c initial commit
$

The Initial commit is just a .gitignore file added, and here are full details for the other changes (excluding the generated code):

$ git log --oneline -p 7706f90..22d5a90
22d5a90 Update BeerOClockHook.java according to http://blogs.atlassian.com/2013/03/atlassian-sdk-plugin-code-generation-with-stash/
diff --git a/src/main/java/com/mycompany/stash/plugin/hook/BeerOClockHook.java b/src/main/java/com/mycompany/stash/plugin/hook/BeerOClockHook.java
index a57b4b9..9ae09f9 100644
--- a/src/main/java/com/mycompany/stash/plugin/hook/BeerOClockHook.java
+++ b/src/main/java/com/mycompany/stash/plugin/hook/BeerOClockHook.java
@@ -4,21 +4,28 @@ import com.atlassian.stash.hook.*;
 import com.atlassian.stash.hook.repository.*;
 import com.atlassian.stash.repository.*;
 import java.util.Collection;
+import java.util.Calendar;
 
+/**
+ * Prevent pushes after 5pm on a Friday
+ */
 public class BeerOClockHook implements PreReceiveRepositoryHook
 {
-    /**
-     * Disables deletion of branches
-     */
     @Override
     public boolean onReceive(RepositoryHookContext context, Collection<RefChange> refChanges, HookResponse hookResponse)
     {
         for (RefChange refChange : refChanges)
         {
-            if (refChange.getType() == RefChangeType.DELETE)
+            // check if master is being updated
+            if ("refs/heads/master".equals(refChange.getRefId()))
             {
-                hookResponse.err().println("The ref '" + refChange.getRefId() + "' cannot be deleted.");
-                return false;
+                // if it's after 5pm on a friday (Beer O'Clock), prevent the push
+                Calendar now = Calendar.getInstance();
+                if (now.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY && now.get(Calendar.HOUR_OF_DAY) >= 17) {
+                    hookResponse.err().println("Pushing to master is *not allowed* after beer o'clock!");
+                    return false;
+                }
+                break;
             }
         }
         return true;
fab8cb1 Add project.groupId and project.artifactId properties
diff --git a/pom.xml b/pom.xml
index 8b2b834..7892f7b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -109,6 +109,10 @@
     </build>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+        <project.groupId>com.mycompany.stash.plugin</project.groupId>
+        <project.artifactId>my-fun-plugin</project.artifactId>
+
         <stash.version>2.5.0</stash.version>
         <stash.data.version>2.5.0</stash.data.version>
         <amps.version>4.2.1</amps.version>
6eaa59e Specify resource text encoding
diff --git a/pom.xml b/pom.xml
index 53df00a..8b2b834 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,6 +108,7 @@
         </plugins>
     </build>
     <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <stash.version>2.5.0</stash.version>
         <stash.data.version>2.5.0</stash.data.version>
         <amps.version>4.2.1</amps.version>
$

The file target/test-classes/META-INF/MANIFEST.MF contains the following

Manifest-Version: 1.0
Bundle-SymbolicName: com.mycompany.stash.plugin.my-fun-plugin-tests
Bundle-Version: 1.0
Bundle-Name: my-fun-plugin-1.0-SNAPSHOT-tests
DynamicImport-Package: *
Atlassian-Plugin-Key: com.mycompany.stash.plugin.my-fun-plugin-tests

and "${project.groupId}.${project.artifactId}-tests" is not equal to "com.mycompany.stash.plugin.my-fun-plugin-tests" which osgi understandably complains about. But obviously the variables should somehow have been expanded by something (maven?).

Adding project.groupId and project.artifactId as properties (suggested by one of my collueages) did not make any difference.

So what do I have to do to get the local stash instance running without problems?

Update:

The original generated pom.xml containen

<stash.version>2.5.0</stash.version>

Changing to version 2.2.0 (as used by https://bitbucket.org/tpettersen/stash-beer-o-clock-hook) or 2.4.1 (which is the version our company is using) made the problem go away. So apparently the problem described above is specific to stash version 2.5.0 only.

1 answer

1 accepted

4 votes
Answer accepted

Hi Håkon,

Sorry for the delay and thanks for reporting the issue with so much detail. It appears something has changed between 2.4.x and 2.5.0 (most likely AMPS). The good news is there is a simple fix, by removing the src/test/resources/atlassian-plugin.xml (and maybe cleaning the target directory) the issue goes away. See here for more details.

https://answers.atlassian.com/questions/179683/fatal-error-during-add-on-development

As mentioned on that page I will raise an issue internally and we will investigate further.

Charles

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Thursday in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

113 views 0 10
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you