Error java.lang.NoSuchMethodError after upgrading a SPS
search cancel

Error java.lang.NoSuchMethodError after upgrading a SPS

book

Article ID: 277659

calendar_today

Updated On:

Products

SITEMINDER

Issue/Introduction

After upgrading a CA Access Gateway to 12.8.8 GA the following errors are reported on startup in the tomcat log (nohup.out)

Jan 03, 2024 12:56:27 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them                . Skipping unneeded JARs during scanning can improve startup time and JSP compilation time                                                                                               .
Jan 03, 2024 12:56:28 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Servlet.init() for servlet [saml2nidws] threw exception
java.lang.NoSuchMethodError: 'java.util.Map javax.ws.rs.core.Application.getProperties()'
        at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:311)
        at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:297)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)

In the use case where this issue has been detected this was not invalidating functionality of the CA Access Gateway, but nonetheless, depending on the missing method this may be causing issues

Also the present error has been described for Servlet saml2nidws, but it could be any other loaded by Tomcat

Environment

CA Access Gateway 12.8.8.1892 upgraded from a previous version

Cause

When Tomcat starts, it loads all the jar files present in the

<SPS_HOME>/Tomcat/webapps/affwebservices/WEB-INF/lib

directory.

If there are different jar files implementing the same class (in this case  javax.ws.rs.core.api-2.1.6.jar and jsr311-api-1.1.1.jar) but one of them contains the class showing problems without the method implemented, and these one is loaded last, when Tomcat tries to use it for Servlet init it will return the error shown

Resolution

It is never an easy task to determine which class is loaded and which jar file implements a given class and method. However, it is possible to start Tomcat in verbose mode to show what is being loaded at each point.

To do this modify proxyserver.sh to include the following

$NOHUP_JAVACMD -verbose:class $JVM_MEM_OPTS $JVM_PERF_OPTS $SPS_TOMCAT_OPTS -DNETE_WA_ROOT=$NETE_WA_ROOT -DPWD=$PWD -classpath $CLASSPATH 

Then observer the nohup.out at startup to see how jar files and their classes are loaded

For instance you would see something like the following

[26.792s][info][class,load  ] javax.ws.rs.core.Application source: file:<SPS_HOME>/Tomcat/webapps/CA_AuthAZ/WEB-INF/lib/jakarta.ws.rs-api-2.1.6.jar

[36.247s][info][class,load  ] javax.ws.rs.core.Application source: file:<SPS_HOME>/Tomcat/webapps/affwebservices/WEB-INF/lib/jsr311-api-1.1.1.jar

which is telling you that the class is being loaded from jsr311-api-1.1.1.jar and thus possibly it is the method in this library which is failing

In these cases you may want to rename the lastes jar file loaded, in this case jsr311-api-1.1.1.jar so that the only one loaded at initialization time is the one implementing the desired method

 

Additional Information

While this description provides an explanation for this type of errors, this should be a rare occurrence and many times it may come from customization (leaving over classes specifically tailored for a certain system while it is being upgraded) or events like upgrade from a beta to a GA version or similar situations. The purpose of this article is to provide a plausible explanation for these errors and also to provide a possible way to troubleshoot them.