Debugging a plugin that won't enable

I’m new to Confluence plugin development, and fairly new to JAVA. My situation is likely elementary for many people here, but being new, I could use a little guidance.

I started with the “Hello World” plugin tutorial. From there I expanded the project to add several additional macros, a new tool menu item (web-item), and a skeleton for a custom action (xwork). All of this is working fine, per the various tutorials available.

My trouble started when I began fiddling with the custom action function. I added a couple dependencies in the pom.xml, and now my plugin won’t enable. The output indicates that the plugin is taking too long to do so. Note that no changes have been made to any code files or the atlassian-plugin.xml. Removing the dependencies allows the plugin to enable (and function) properly.

I’ve tried different versions (and builds) of JAVA and I tried increasing the JVM memory. I also tried reconstructing the plugin from scratch. All to no avail.

How does one approach debugging this? Can someone provide a little guidance, please?

Potentially relevant details:

  • Confluence SDK is running in a Linux (Ubuntu 21.04 Server) VM on a Windows 10 host. VM is configured with 10 cores and 16G of RAM.
  • Currently using Oracle JDK 1.8.0_251. I’ve also tried AdoptOpenJDK 8 and 11.
  • The dependencies added are for OpenHTMLtoPDF.

Thanks in advance!

Hi @SeanMahnken and welcome to the developer community :slight_smile:

To further understand the problem, could you share both the pom.xml (at least the problematic dependencies) and the exceptions thrown by the UPM in the application logs when the app is installed?

Hi Ahmed. Thanks for responding.

When I look at my application logs (obtained through “Create support zip”), only the Synchrony log has any content. Both the instrumentation and the atlassian-diagnostics logs are empty. I presume that means I’ve got something not quite right in my setup. How do I find/enable the UPM log content?

Hi again Sean!

Assuming you are running a dev instance (e.g. with atlas-debug) and have quick reload enabled, the application logs will be printed into the same terminal you used to run the app. UPM logs should be enabled by default for errors faced during app installation.

To trigger the logs again, run atlas-package to build your app again. After the maven build completes successfully, watch the logs and see when quick reload picks up on the changes and completes reinstallation. At that point, if a problem is encountered, the UPM will log the exception to the same log.

Hope this helps get you closer to the root cause of the issue.

Thanks! I found a clue, though there’s details here I don’t yet know how to interpret.

[INFO] [talledLocalContainer] Starting Quick Reload - ‘/home/sean/development/SdlConfluence/sdl-document/target/sdl-document-1.0.0-SNAPSHOT.jar’…
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] 2021-09-16 16:42:39,435 INFO [QuickReload - Plugin Installer] [atlassian.plugin.manager.DefaultPluginManager] updatePlugin Updating plugin ‘com.sdl.document.sdl-document’ from version ‘1.0.0-SNAPSHOT’ to version ‘1.0.0-SNAPSHOT’
[INFO] [talledLocalContainer] 2021-09-16 16:42:39,460 ERROR [QuickReload - Plugin Installer] [plugin.osgi.factory.OsgiPluginInstalledHelper] availableForTraversal Cannot determine required plugins, cannot resolve bundle ‘com.sdl.document.sdl-document’
[INFO] [talledLocalContainer] 2021-09-16 16:42:39,465 ERROR [QuickReload - Plugin Installer] [plugin.osgi.factory.OsgiPlugin] enableInternal Detected an error (BundleException) enabling the plugin ‘com.sdl.document.sdl-document’ : Unable to resolve com.sdl.document.sdl-document [292](R 292.0): missing requirement [com.sdl.document.sdl-document [292](R 292.0)] osgi.wiring.package; (osgi.wiring.package=org.apache.avalon.framework.logger) Unresolved requirements: [[com.sdl.document.sdl-document [292](R 292.0)] osgi.wiring.package; (osgi.wiring.package=org.apache.avalon.framework.logger)]. This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn’t meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see
[INFO] [talledLocalContainer] 2021-09-16 16:42:39,466 WARN [QuickReload - Plugin Installer] [atlassian.plugin.impl.AbstractPlugin] enable Unable to enable plugin ‘com.sdl.document.sdl-document’
[INFO] [talledLocalContainer] 2021-09-16 16:42:39,466 WARN [QuickReload - Plugin Installer] [atlassian.plugin.impl.AbstractPlugin] enable Because of this exception
[INFO] [talledLocalContainer] com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: com.sdl.document.sdl-document

It appears that my plugin is unable to resolve itself. What’s the meaning of the “[292](R 292.0)]” that appears in a couple of the log lines?

So this only happens if I add the following additional dependencies in the pom.xml file:

  <!-- OpenHTMLtoPDF dependencies -->
  	<!-- ALWAYS required, usually included transitively. -->
  	<!-- Required for PDF output. -->

${openhtml.version} is defined in the properties at the end of the file.

Being inexperienced with JAVA, what kind of programming error would result in a bundle not being able to resolve itself?

Reading this log again, is it saying it can’t find com.sdl.document.sdl-document (my plugin), or the package I added the dependencies for?

So after a bunch of web digging, I’ve learned a few things. Most folks will likely already know, but in case another noob like myself reads this thread, I’ll point it out – The ERROR statements in the log do list the problematic package. It’s the “org.apache.avalon.framework.logger” in the log snippet above.

I’m not sure how to figure out which code is trying to access that function. I did a trial-and-error approach and got lucky. Some of the content I found online indicated that the package should be excluded in the imports section of the pom.xml file, so I did that, and it worked. So having started from the atlas-create-confluence-plugin command, I updated the section for the confluence-maven-plugin to exclude three patterns. The section now reads:


Thanks ahmed.alaghbari for the help!

1 Like