I have tried to create a new Bitbucket plugin. The plugin seems to work fine when I try it out in eclipse. However when I try to start it with atlas-debug I get this log:
[INFO] [talledLocalContainer] Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle org.aphelion.fix.version.pusher.fix-version-pusher [103]: Unable to resolve 103.0: missing requirement [103.0] package; (package=COM.jrockit.reflect)
[INFO] [talledLocalContainer] at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3564) ~[Felix.class:na]
[INFO] [talledLocalContainer] ... 19 common frames omitted
What can cause this and how can I solve it?
Community moderators have prevented the ability to post new answers.
The error indicates that while building your plugin, the maven-amps plugin detected that your code uses/depends on a class from the com.jrockit.reflect
package. As a result, it injected an OSGI Package-Import instruction for that package in the META-INF/MANIFEST.MF file.
What surprises me is that you get that dependency at all. Are you by chance compiling (and running) using a JRockit JVM? If so, try to switch to the Oracle JVM or OpenJDK JVM. Note that the JRockit JVM is not supported (see https://confluence.atlassian.com/display/BitbucketServer/Supported+platforms).
If you are not using JRockit, one of your dependencies is pulling it in. You can check that by running mvn dependency:tree
from the root of your plugin and search for jrockit.
I have just installed the Oracle JVM, however is it possible that the Atlassian compile uses a different JVM than my main one? Can I check that?. The Maven tree didn't display the package, however the startup displays this:
[WARNING] The manifest should contain versions for all imports to prevent ambiguity at install time due to multiple versions of a package. Here are some suggestions for the maven-stash-plugin configuration generated for this project to start from:
<configuration>
<instructions>
<Import-Package>
javax.crypto;version="0.0.0",
sun.reflect;version="0.0.0",
javax.security.auth.x500;version="0.0.0",
org.slf4j;version="0.0.0",
javax.naming;version="0.0.0",
jrockit.vm;version="0.0.0",
org.apache.oro.text.regex;version="0.0.0",
org.joda.convert;version="0.0.0",
javax.naming.directory;version="0.0.0",
nu.xom;version="0.0.0",
COM.jrockit.reflect;version="0.0.0",
groovy.lang;version="0.0.0",
javax.naming.ldap;version="0.0.0",
org.ietf.jgss;version="0.0.0",
com.atlassian.stash.*;version="0.0.0",
com.google.common.collect;version="0.0.0",
javax.crypto.spec;version="0.0.0",
org.codehaus.groovy.r*;version="0.0.0",
org.apache.avalon.framework.logger;version="0.0.0",
javax.servlet;version="0.0.0",
javax.net;version="0.0.0",
javax.net.ssl;version="0.0.0",
org.apache.log;version="0.0.0",
org.apache.log4j;version="0.0.0",
org.apache.tools.ant*;version="0.0.0",
sun.security.util;version="0.0.0",
javax.inject;version="0.0.0"
</Import-Package>
</instructions>
</configuration>
You may notice many packages you weren't expecting. This is usually because of a bundled jar that references packages that don't apply. You can usually remove these or if necessary, mark them as optional by adding ';resolution:=optional' to the package import. Packages that are detected as version '0.0.0' usually mean either they are JDK packages or ones that aren't referenced in your project, and therefore, likely candidates for removal entirely.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian AMPS will not install a different JVM and should use the standard JVM. You can check which JVM you're using by running java -version
on the command line.
If that turns out to be the Oracle JVM, can you post the dependencies you have listed in your pom?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
The pom dependencies:
<dependencies>
<dependency>
<groupId>com.atlassian.stash</groupId>
<artifactId>stash-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.stash</groupId>
<artifactId>stash-spi</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.stash</groupId>
<artifactId>stash-page-objects</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.rcarz</groupId>
<artifactId>jira-client</artifactId>
</dependency>
</dependencies>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You could import it as optional for bnd in our pom.xml and hope that it is not used in your plug-in or any of your dependencies:
<Import-Package> COM.jrockit.*;resolution:=optional
Hope this helps,
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That would probably help me, if I understood it .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<plugins> <plugin> <groupId>com.atlassian.maven.plugins</groupId> <artifactId>bitbucket-maven-plugin</artifactId> <extensions>true</extensions> <configuration> <instructions> <Import-Package> COM.jrockit.*;resolution:=optional </Import-Package> </configuration> </plugin> </plugins>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hope that helps. You should already have such a section in your plug-ins pom.xml.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.