Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Digital signature - class cast exception #82

Closed
ziton-git opened this issue Dec 27, 2021 · 15 comments
Closed

Digital signature - class cast exception #82

ziton-git opened this issue Dec 27, 2021 · 15 comments
Assignees
Milestone

Comments

@ziton-git
Copy link

Hi Support

Something has happened with Digital Signature... It has stopped working across the entire platform/Confluence we have.

Behaviour is like this:

On any page add the DS-macro -> fill in what is needed and hit save -> macro will look okay, but:

  1. Edit the macro again and it appears broken, or
  2. Save the page and it appears broken

The error given is the same irrespective of 1 or 2:

**Error rendering macro 'signature'

class com.baloise.confluence.digitalsignature.Signature cannot be cast to class com.baloise.confluence.digitalsignature.Signature (com.baloise.confluence.digitalsignature.Signature is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @32dc35ce; com.baloise.confluence.digitalsignature.Signature is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @5a5001e0)**

Action taken:

Not much I can do, I guess... I have tried disabling and re-enabling the plugin: no change.

I am really to look for details in the logs and share with you - please let me know of what to look for.

Brgds Felter

@bobbejokohler
Copy link

This is happening for our company as well.

@bobbejokohler
Copy link

Do you have an update on this issue? Need screenshots or logs?

@vcknapp
Copy link

vcknapp commented Jan 11, 2022

This is happening for our customer as well. Please can someone take a look?

Hi Support

Something has happened with Digital Signature... It has stopped working across the entire platform/Confluence we have.

Behaviour is like this:

On any page add the DS-macro -> fill in what is needed and hit save -> macro will look okay, but:

  1. Edit the macro again and it appears broken, or
  2. Save the page and it appears broken

The error given is the same irrespective of 1 or 2:

**Error rendering macro 'signature'

class com.baloise.confluence.digitalsignature.Signature cannot be cast to class com.baloise.confluence.digitalsignature.Signature (com.baloise.confluence.digitalsignature.Signature is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @32dc35ce; com.baloise.confluence.digitalsignature.Signature is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @5a5001e0)**

Action taken:

Not much I can do, I guess... I have tried disabling and re-enabling the plugin: no change.

I am really to look for details in the logs and share with you - please let me know of what to look for.

Brgds Felter

@vcknapp
Copy link

vcknapp commented Jan 11, 2022

Please @Tiliavir, can you take a look at this issue?

@Tiliavir Tiliavir self-assigned this Jan 11, 2022
@Tiliavir Tiliavir added this to To do in CoP Open-Source via automation Jan 11, 2022
@Tiliavir Tiliavir moved this from To do to Review in progress in CoP Open-Source Jan 11, 2022
@Tiliavir
Copy link
Member

Hi @vcknapp @ziton-git @bobbejokohler

Please have a look here: #70 (comment)
This is a known issue, clearing the plugin cache should be sufficient.

Best regards
Markus

CoP Open-Source automation moved this from Review in progress to Done Jan 11, 2022
@Tiliavir Tiliavir reopened this Jan 11, 2022
CoP Open-Source automation moved this from Done to In progress Jan 11, 2022
@vcknapp
Copy link

vcknapp commented Jan 12, 2022

Hi @Tiliavir, I just uninstalled and re-installed the plugin and the issue is persisting. Please can you help?

@Tiliavir
Copy link
Member

Hi @vcknapp did you also invalidate the plugin cache and restart confluence afterwards?

@vcknapp
Copy link

vcknapp commented Jan 12, 2022

Hi @vcknapp did you also invalidate the plugin cache and restart confluence afterwards?

Hi @Tiliavir, I don't have access to where Confluence is installed to restart it so I have advised our customer to try that.

@MarkusTiede MarkusTiede moved this from In progress to Review in progress in CoP Open-Source Jan 13, 2022
@MarkusTiede
Copy link
Member

MarkusTiede commented Jan 13, 2022

Hi @vcknapp - we've just briefly discussed the issue reported (again) here; we'd kindly like to ask you to

  • check the steps above (clean install of plug-in, cache invalidation and restart of confluence server) and verify that it's resolving this issue (we guess so as it has been a common and frequently occurring problem in the recent past)
  • check your Confluence version (reported Confluence server 7.13.2 - plugin 7.0.4) : we're guessing it's the Data Center version (and not the Confluence Server one) - if so a quick confirmation would help: we're planning to publish a compatible / certified DC version in early Q2 2022 (please see / comment / reference to issue Datacenter ready digital-signature #72 for further details)

@MarkusTiede MarkusTiede changed the title Digital signature - not working - Confluence server 7.13.2 - plugin 7.0.4 Digital signature - class cast exception Jan 13, 2022
@MarkusTiede
Copy link
Member

MarkusTiede commented Jan 13, 2022

feedback from todays mob-pair programming - @arburk @Tiliavir @svene @kullmanp :

https://community.developer.atlassian.com/t/confluence-dc-throws-classcastexception-when-getting-object-from-bandana-after-app-upgrade/31894/4

[...] So the solution we frequently use is to add a event listener, that listens for the PluginEnabledEvent and clears our caches. [...]

Ideas worth a try

  • register listener for plug-in lifecycle events to invalidate cache manually
  • derive from already existing (correct usage) base class (rather than implementing the Macro interface completely on our own) that's handling this lifecycle already
  • try to reproduce this issue using the DC version of confluence; @vcknapp do you happen to have a test environment where we'd check adjusted versions in future together (in advance)? We'd be happy providing you e.g. with a preview version here.

Tiliavir added a commit that referenced this issue Feb 5, 2022
- BandanaManager.init() is called initially
- removes workaround with clone
- serialization of Signature to JSON using GSON
@Tiliavir
Copy link
Member

Tiliavir commented Feb 5, 2022

Besides other posts regarding this issue in the "Atlassian Developer Community" this one summarizes it quite well:

[...] is caused by the fact during cache replication in Data Center RMI uses webapp class loader to deserialize cache invalidation message and not OSGi class loader associated with your plugin’s OSGi bundle.
The easiest way to work around this problem is to use keys that can be serialized/deserialized by webapp class loader (e.g. java.lang.String) [...]

and further

The Atlassian guide on using Data Centre Compatible caches here 19 says the cache can contain keys and values that implement Serializable however from what I have seen serializing pojos does not work as there are different classloaders in play which results in ClassCastException.

Following that, I've added a PR that should address this issue in a self healing way. Meaning: The issue might occur again after an environment gets this patch (and requires a manual plugin cache reset / reboot once again), but should be fixed for all following updates.

@MarkusTiede
Copy link
Member

MarkusTiede commented Feb 10, 2022

PR to review #88

@arburk
Copy link
Contributor

arburk commented Apr 27, 2022

Deeper investigations on that issue have shown a strange behaviour with Bandana Manager when upgrading the plugin. As soon as the plugin is updated, former created key-value pairs in Bandana Manager are still present by their key but corresponding values are null. This can be reproduced by following steps:

  • install plugin v7.0.4
  • create content and sign with digital signature
  • Bandana Manager contains entry with Signature.hash as key and corresponding signature as value
  • upgrade plugin to v7.0.5
  • Bandana Manager still contains former Signature.hash key but value is null

It is not yet clear why and how the value is getting lost, in particular as no write or update method on Bandana Manager can be noticed during the steps mentioned above. A quick research has also shown, that this behavior is monitored by others developers, too (e.g. https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Bandana-Keys-persist-plugin-update-but-values-don-t/qaq-p/459762)

@MarkusTiede
Copy link
Member

Maybe filing a bug directly @atlassian (developer board) - maybe more people and project (as above mentioned) are affected by this.

@MarkusTiede MarkusTiede moved this from Review in progress to In progress in CoP Open-Source May 5, 2022
This was referenced May 5, 2022
Tiliavir added a commit that referenced this issue Aug 22, 2022
@Tiliavir Tiliavir removed this from In progress in CoP Open-Source May 5, 2023
Tiliavir added a commit that referenced this issue Sep 10, 2023
Tiliavir added a commit that referenced this issue Sep 10, 2023
#82: ClassCastException after Plugin update on DC
@Tiliavir Tiliavir added this to the 7.0.6 milestone Sep 10, 2023
@Tiliavir
Copy link
Member

Tiliavir commented Oct 6, 2023

Fixed in 7.0.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

6 participants