Error message "java.lang.NoSuchMethodError: 'javax.servlet.http.Cookie[] com.spotfire.server.security.AuthenticationContext.getCookies()" while upgrading to 14.0 and above

Error message "java.lang.NoSuchMethodError: 'javax.servlet.http.Cookie[] com.spotfire.server.security.AuthenticationContext.getCookies()" while upgrading to 14.0 and above

book

Article ID: KB0070165

calendar_today

Updated On:

Products Versions
Spotfire Server 14.0 and higher

Description

If custom web authentication is enabled in versions earlier than 14.0 and you attempt to upgrade Spotfire to version 14.0 or later. In that case, the upgrade may either fail with the following error, or users may be unable to log in using custom authentication.
 
ERROR 2024-03-29T14:46:31,556+0000 [] [localhost].[/spotfire].[default]: Servlet.service() for servlet [default] in context with path [/spotfire] threw exception [Filter execution threw an exception] with root cause
java.lang.NoSuchMethodError: 'javax.servlet.http.Cookie[] com.spotfire.server.security.AuthenticationContext.getCookies()'
	at tpp.TotalPaymentCustomAuthenticator.GetSessionId(TotalPaymentCustomAuthenticator.java:97) ~[?:?]
	at tpp.TotalPaymentCustomAuthenticator.authenticate(TotalPaymentCustomAuthenticator.java:78) ~[?:?]
	at com.spotfire.server.security.ExternalAuthenticator.authenticateUsingCustomAuthenticator(ExternalAuthenticator.java:229) ~[?:?]
	at com.spotfire.server.security.ExternalAuthenticator.authenticate(ExternalAuthenticator.java:211) ~[?:?]
	at com.spotfire.server.security.ExternalAuthenticator.authenticate(ExternalAuthenticator.java:203) ~[?:?]
	at

Issue/Introduction

This article describes the steps to resolve the error "java.lang.NoSuchMethodError: 'javax.servlet.http.Cookie[] com.spotfire.server.security.AuthenticationContext.getCookies()" that may occur while upgrading to version 14.0 or newer.

Resolution

The error mentioned above occurs due to the migration from Java EE to Jakarta EE starting from version 14.0. Therefore, any custom web authentication code developed needs to be modified and rebuilt.

The key difference is that some imports from Javax must be changed to Jakarta, requiring adjustments to your code to resolve this issue.

For example, javax.servlet.http.HttpServletRequest must be changed to jakarta.servlet.http.HttpServletRequest.

A list of components with changed namespace can be found here:  https://wiki.eclipse.org/Jakarta_EE_Maven_Coordinates

Additional Information

Spotfire Server Release Note List of components Custom Web Authentication