Bitbucket Data Center 9.0 Early Access Program release

9.0.0-eap05 now includes com.atlassian.bitbucket.rest.v2.api.repository.RestMinimalRef and com.atlassian.bitbucket.rest.v2.api.RestLinkedMapEntity.

RestPage is still being worked on (it’s the last Rest object we plan to put in API).

1 Like

We don’t intend to make this package public (that should be true across all products - I’m not seeing it in Confluence, either).

Can you explain a bit more about how you’re using the classes in com.atlassian.sal.core.upgrade? I’m only seeing DefaultPluginUpgradeManager and PluginUpgrader and I’m not seeing how that allows you to track AO’s initialisation.

WP7 does not install and does not work. No Errors.

I’m seeing this in the logs:

Caused by: org.osgi.framework.BundleException: Unable to resolve com.izymes.workzone.wp7 [122](R 122.0): missing requirement [com.izymes.workzone.wp7 [122](R 122.0)] osgi.wiring.package; (osgi.wiring.package=javax.annotation) Unresolved requirements: [[com.izymes.workzone.wp7 [122](R 122.0)] osgi.wiring.package; (osgi.wiring.package=javax.annotation)]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4398)
	... 31 common frames omitted

After digging into the error a bit, it appears OsgiServices.importOsgiService references javax.annotation so that package needs to be made public.

We’ll include that package in the next EAP (and I’ll test this plugin to ensure it works - thank you for providing it).

1 Like

Trying the latest docker image for Bitbucket 9.0.0-eap05, we get

JRE_HOME ‘/opt/java/openjdk’ is Java 11.0.23
Atlassian Bitbucket requires Java 17 to run

Could Atlassian please fix their docker images in such a way that it comes with the supported minimal Java version?

I assume it doesn’t make sense any more to publish jdk11 images for Bitbucket 9 …

1 Like

Thanks for looking into this @bplump !
I’ve added javax.annotation:javax.annotation-api as a bundled dependency to the WP7 plugin pom and it installs now :partying_face:
I’ve looked in atlassian-plugins-osgi-javaconfig-0.6.0.pom and it has the javax.annotation:javax.annotation-api dependency as provided, and since atlassian-plugins-osgi-javaconfig is used in plugin’s spring java config it would need to be exported by BB.
However it also seems to work if the plugin bundles its own.

1 Like

We wait for AO to initialize before manually invoking the upgrade methods in PluginUpgrader.
Essentially, we extend PluginUpgrader and run upgrade tasks when we have ensured the AO is initialized.

@bplump , thanks for your great work on EAP05. It’s in truly good shape for plugin migration!
Given the fact that EAP04 was kind of hard to use for complex plugin migration, would you please advocate for at least another 2 weeks of BB 9 GA delay to give vendors a fair chance?
In other words, I feel like working with EAP04 has not been as effective as I hoped and we’ve lost a lot of time navigating obstacles that turned out to be oversights in EAP04.
Thanks a lot for you kind consideration.
Best, Ulrich

3 Likes

I’m actually pretty surprised that bundling with the plugin works… but we’ll fix it “for real” in the next EAP. Thanks for reporting this with a code example.

1 Like

I’ve tried our plugin in the EAP05 version of the Bitbucket and got the following errors to logs:
1.

Caused by: java.lang.NoClassDefFoundError: com/google/common/collect/ListMultimap
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Unknown Source)
	at java.base/java.lang.Class.getDeclaredMethods(Unknown Source)
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:467)
	... 10 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ListMultimap not found by com.stiltsoft.bitbucket.graphs.bitbucket-graphs-plugin [120]
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1591)
	... 14 common frames omitted

It happened because I used provided guava dependency in the POM file, but if I bundle this dependency to the app I will get the following error during the build step:

[INFO] --- bitbucket:8.17.0:validate-banned-dependencies (default-validate-banned-dependencies) @ bitbucket-graphs-plugin ---
[INFO] validate banned dependencies
[INFO] Dependencies excluded from banning: []
[INFO] Platform version range: '[0,)'
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:
make sure platform artifacts are not bundled into plugin
Found Banned Dependency: com.google.guava:guava:jar:32.1.3-jre
Use 'mvn dependency:tree' to locate the source of the banned dependencies.

What should I do with the guava dependency?

If I bundle all the dependencies from the step 1 and skip the banning dependencies build step I will get the following error:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'avatarHelper': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.stiltsoft.bitbucket.graphs.manager.AvatarHelper] from ClassLoader [com.stiltsoft.bitbucket.graphs.bitbucket-graphs-plugin [119]]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:298)
	... 9 common frames omitted
Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.stiltsoft.bitbucket.graphs.manager.AvatarHelper] from ClassLoader [com.stiltsoft.bitbucket.graphs.bitbucket-graphs-plugin [119]]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:485)
	at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321)
	... 9 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/atlassian/bitbucket/rest/v2/api/user/RestPerson
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Unknown Source)
	at java.base/java.lang.Class.getDeclaredMethods(Unknown Source)
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:467)
	... 10 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.atlassian.bitbucket.rest.v2.api.user.RestPerson not found by com.stiltsoft.bitbucket.graphs.bitbucket-graphs-plugin [119]
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1591)
	... 14 common frames omitted

The app can’t find the com.atlassian.bitbucket.rest.v2.api.user.RestPerson class. The following dependency is in the POM file:

<dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-rest-v2-api</artifactId>
            <scope>provided</scope>
</dependency>

Please advice on what should I do to eliminate this error?

1 Like

Have you raised a bug for this behaviour? It sounds like something we should fix.

Atlassian is not going to make PluginUpgrader public in Platform 7.

While the REST maven dependencies are now available via com.atlassian.bitbucket.server:bitbucket-rest-v2-api, I don’t see this working for RestApplicationUser at runtime.

Caused by: org.osgi.framework.BundleException: Unable to resolve com.izymes.workzone.wp7 [138](R 138.0): missing requirement [com.izymes.workzone.wp7 [138](R 138.0)] osgi.wiring.package; (osgi.wiring.package=com.atlassian.bitbucket.rest.v2.api.user) Unresolved requirements: [[com.izymes.workzone.wp7 [138](R 138.0)] osgi.wiring.package; (osgi.wiring.package=com.atlassian.bitbucket.rest.v2.api.user)]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4398)
	... 67 common frames omitted

Proof: Build and install the WP7 test plugin on Bitbucket EAP05

====

PS: the plugin installs if the code makes NO reference to any com.atlassian.bitbucket.server:bitbucket-rest-v2-api class like so:

         ApplicationUser user = authenticationContext.getCurrentUser();

-        RestApplicationUser restApplicationUser = new RestApplicationUser(user);
+        Map<String, String> restApplicationUser = new HashMap<>();
+        restApplicationUser.put("name", user.getName());
+        restApplicationUser.put("slug", user.getSlug());
+        restApplicationUser.put("email", user.getEmailAddress());
+        restApplicationUser.put("id", user.getId() + "");
+        restApplicationUser.put("type", user.getType().name());

I see a similar problem as soon as the code references any com.atlassian.bitbucket.rest.v2.api.* class.

It’s probably the case that com.atlassian.bitbucket.server:bitbucket-rest-v2-api exposes the RestXYZ classes, but they are not exported. Can you confirm @bplump and team?

1 Like

9.0.0-eap06 has now been released!

The following REST v2-compatible objects and APIs are now available:

RestChangeset
RestPage

The following packages from rest-v2-api have now been made public so plugins are now able to use the rest objects added in 9.0.0-eap05 and 9.0.0-eap06:

com.atlassian.bitbucket.rest.v2.api.avatar
com.atlassian.bitbucket.rest.v2.api.comment
com.atlassian.bitbucket.rest.v2.api.commit
com.atlassian.bitbucket.rest.v2.api.project
com.atlassian.bitbucket.rest.v2.api.property
com.atlassian.bitbucket.rest.v2.api.pull
com.atlassian.bitbucket.rest.v2.api.repository
com.atlassian.bitbucket.rest.v2.api.scope
com.atlassian.bitbucket.rest.v2.api.user

Additional packages made available to plugins:

javax.annotation
javax.annotation.concurrent
javax.annotation.meta
javax.annotation.security
javax.annotation.sql
2 Likes

Could Atlassian please fix their docker images in such a way that it comes with the supported minimal Java version?

Thanks for raising this issue, we will investigate and fix it

1 Like

It’s probably the case that com.atlassian.bitbucket.server:bitbucket-rest-v2-api exposes the RestXYZ classes, but they are not exported. Can you confirm @bplump and team?

Yep, this was the case. This should now be resolved in 9.0.0-eap06. Let us know if there are further issues. Thanks!

cc: @YuriKarnilaev

1 Like

Thanks for raising this issue, we will investigate and fix it

The eap06 tag now comes correctly with Java 17, but there are still images tagged ‘9.0.0-eap06-jdk11’, which doesn’t seem to make sense, does it?

Can I check if EAP06 is shipped with atlassian-plugins-core:8.0.10 whereas it is 8.0.15 for Confluence eap? Will we get a new EAP with these changes?
It is difficult if there are platform changes but product adoption differs as we can’t share the same code between different apps.

1 Like

The eap06 tag now comes correctly with Java 17, but there are still images tagged ‘9.0.0-eap06-jdk11’, which doesn’t seem to make sense, does it?

This should be resolved by the next eap

1 Like

I don’t get Bitbucket to store ‘build results’ when sent via build status api :cry: I get

< HTTP/1.1 400 
< X-AREQUESTID: @1ERJU6Kx964x618x0
< X-AUSERID: 2
< X-AUSERNAME: admin
< X-Content-Type-Options: nosniff
< Content-Type: text/plain
< Content-Length: 273
< Date: Thu, 20 Jun 2024 06:04:21 GMT
< Connection: close
< 
Unexpected end-of-input: expected close marker for Object (start marker at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 1])
* Closing connection 1
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]

The same payload (from the API docs example) works :white_check_mark: for the legacy commit status api: http://host/rest/build-status/1.0/commits/d6edcbf924697ab811a867421dab60d954ccad99

Are we expecting a different REST API spec for build results in BB9?

Hi, can you please confirm that org.osgi.framework is included in eap6?

I am having problems with DynamicModuleRegistration as it cannot autowire org.osgi.framework.BundleContext

Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.osgi.framework.BundleContext' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}