I'm getting java.lang.NoSuchMethodError for PermissionManager.isSystemAdministrator()

Hi,

I have just released a version 8.8.0 compatible plugin, which was a bit of a nightmare with Atlassian closing so much things down in the Java API.

After many days I was able to get a POM working and compiling my code and everything tested well from versions 7.16 up to 8.8.

I released this new version and POW, it blew up as the first customers started to install it.

It throws this error, and I have no idea why, this code is 10 years old and always worked and doesn’t rely on any third-party code.

 -- url: /rest/pageviewtracker/1.0/statistics/views | userName: xxxx | referer: https://xxxxxxxxx/display/~2562/testar+testar | traceId: 4dbf60d472a3f4e5
java.lang.NoSuchMethodError: 'boolean com.atlassian.confluence.security.PermissionManager.isSystemAdministrator(com.atlassian.confluence.user.ConfluenceUser)'

Does anyone know why this function, which compiles all versions, is not available at runtime?

I assume I need to add a jar to my POM for runtime support, but this doesn’t make sense as it should be part of Confluence core code.

Please HELP ASAP…

1 Like

Dear Chris,

I assume this thread already picked up the topic: Confluence 8.8 release EAP available now - #58 by scott.dudley. I didn’t screen for an answer.

Good luck

Andreas

Hi @andreas1 ,

Yes that looks like it is indeed the issue, I have been using ConfluenceUser in this function now for many years, this looks like a stupid Atlassian error that needs to be fixed. There needs to be a 2 years cut-over period where both API’s are valid until EOL of the older one. 8.7 is not EOL.

Hi Chris,

Sorry about that. We added new methods to PermissionManager to replace the ones that used the legacy com.atlassian.user.User type, instead using the current ConfluenceUser type. This does mean that if you recompile against 8.8 ands run against an older version, you get the NoSuchMethodError.

The quick workaround is to cast the user argument to User, to force it to use the deprecated PermissionManager methods.

I’m curious though - you say you compiled against 8.8 and tested against everything back to 7.16. Did this problem not come up in testing?

Continuing the discussion from I'm getting java.lang.NoSuchMethodError for PermissionManager.isSystemAdministrator():

:smiling_face_with_three_hearts:|Column 1 | Column 2 | Column 3 | Column 4|
|— | — | — | —|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |