Bernd,

On 9/17/21 03:52, Bernd Schatz wrote:
Hi Matthias,


Am 17.09.21 um 09:39 schrieb bernd.sch...@daimler.com:
From: "Keil, Matthias (ORISA Software GmbH)" <matthias.k...@orisa.de>
To: users@tomcat.apache.org <users@tomcat.apache.org>
Subject: JASPIC AuthConfigProvider packaged with the web application not found

I would like to develop an AuthConfigProvider and would like to deploy it together in a web application.

The Tomcat 9 configuration reference for the AuthConfigProvider indicates that "The implementation may be packaged with the web application or in Tomcat's $ CATALINA_BASE / lib directory."

The variant with the $ CATALINA_BASE / lib directory works as expected. My class of the AuthConfigProvider is found and instantiated. The variant of packing the implementation together with the web application does not work. In this case I get a java.lang.ClassNotFoundException.
[SNIP]

You can register it by using a ServletContextListener (or via CDI):

AuthConfigFactory factory = AuthConfigFactory.getFactory();
factory.registerConfigProvider(new AuthProvider(), "HttpServlet", null, "TEST");

Don't forget to:

private String configRegistrationId;

public void contextInitialized(...) {
  AuthConfigFactory factory = AuthConfigFactory.getFactory();
configRegistrationId = factory.registerConfigProvider(new AuthProvider(), "HttpServlet", null, "TEST");
}

public void contextDestroyed(...) {
  if(null != configRegistrationId) {

AuthConfigFactory.getFactory().removeRegistration(configRegistrationId);
  }
}

... or you will introduce a memory leak.

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to