This article includes the steps to remove the tomcat warning message “org.glassfish.jersey.servlet.WebComponent filterFormParameters WARNING: A servlet request to the URI http://localhost:8081/artifactory/api/security/token contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters. Only resource methods using @FormParam will work as expected” from the Artifactory logs.
Introduction
These warning messages are from Tomcat, typically indicating that the request entity body has been processed already and any subsequent attempts to read the message body will likely fail. The provided external link offers additional details about this error. In certain situations within Artifactory, this warning may arise if an incorrect API request is made during token generation, leading to Tomcat issuing this warning message.
SAMPLE REST API
In this particular testing scenario, I have utilized the specified REST API to deliberately recreate the issue within the test instance.
curl -u<username>:"password" -XPOST "http://localhost:8081/artifactory/api/security/token" -d "username=admin" "scope=applied-permissions/user"
The below logs will be printed in the tomcat-catalina.log present inside the $JFROG_HOME/artifactory/var/log/tomcat/ folder
30-Jan-2024 14:35:59.619 WARNING [2024-01-30T14:35:59.464Z|d94877278796a4b|/artifactory/api/security/token|http-nio-8081-exec-5] org.glassfish.jersey.servlet.WebComponent.filterFormParameters A servlet request to the URI http://localhost:8081/artifactory/api/security/token contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters. Only resource methods using @FormParam will work as expected. Resource methods consuming the request body by other means will not work as expected.
To get rid of these warning messages in the logs, we can add the below logger in the logback.xml file present inside the path $JFROG_HOME/artifactory/var/etc/artifactory/logback. Xml, which in turn would tewak the log level to record only the actual errors.
<logger name="org.glassfish.jersey.servlet" level="ERROR" />

Note
Artifactory restart is NOT required for loggers to take effect.