Creating a custom tomcat session manager without putting the jar in the CATALINA_HOME directory?

前端 未结 1 1953
执念已碎
执念已碎 2021-01-19 06:32

I am working on a custom session manager for Tomcat and I got it working with one caveat, I have to put the jar(and all the associated jars) in the CATALINA_HOME/lib directo

相关标签:
1条回答
  • 2021-01-19 06:52

    As of Tomcat 7.0.27, the <Manager> element in your META-INF/context.xml file is processed by the commons-digester and the effective ClassLoader is set to that which loaded the ContextConfig class -- one which firmly resides in Tomcat's server ClassLoader, which is outside of the ClassLoading chain of anything with access to the webapp's classes.

    So, without modifying the Tomcat source, there will be no way to load your Manager from within your webapp. Consider joining the Tomcat users' mailing list to discuss such a feature.

    EDIT 2015-067-01

    If you want to specify a ClassLoader for your web application, you'll need to use the <Loader> element within your <Context>: http://tomcat.apache.org/tomcat-8.0-doc/config/loader.html

    0 讨论(0)
提交回复
热议问题