baloise / digital-signature

a digital signature confluence macro
https://marketplace.atlassian.com/1217404
Apache License 2.0
8 stars 8 forks source link

Digital signature - class cast exception #82

Closed ziton-git closed 1 year ago

ziton-git commented 2 years ago

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 commented 2 years ago

This is happening for our company as well.

bobbejokohler commented 2 years ago

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

vcknapp commented 2 years ago

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 commented 2 years ago

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

Tiliavir commented 2 years ago

Hi @vcknapp @ziton-git @bobbejokohler

Please have a look here: https://github.com/baloise/digital-signature/issues/70#issuecomment-953871870 This is a known issue, clearing the plugin cache should be sufficient.

Best regards Markus

vcknapp commented 2 years ago

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

Tiliavir commented 2 years ago

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

vcknapp commented 2 years ago

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 commented 2 years ago

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

MarkusTiede commented 2 years ago

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

Tiliavir commented 2 years ago

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 commented 2 years ago

PR to review https://github.com/baloise/digital-signature/pull/88

arburk commented 2 years ago

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:

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 commented 2 years ago

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

Tiliavir commented 1 year ago

Fixed in 7.0.7