Yes, that was just a way to reproduce the issue.
About the real usecase that Hoang has reported, it is a Spring 3.x web app. For a certain reason, Spring auto scans all Valves which causes the issue.
I think it was just a way to reproduce the issue and Trong does not want to use the PortalClusteredSSOSupportValve in Tomcat :-)On Mar 18, 2013, at 5:14 PM, Marek Posolda <mposolda@redhat.com> wrote:Hi Trong,
Notes inline.
On 18/03/13 12:25, Trong Tran wrote:
Hi,yes, I am able to reproduce it with Servlet Context listener. But I am still not sure if I understand the usecase. Why you need to access PortalClusteredSSOSupportValve from some Servlet Context listener on Tomcat? Thing is that PortalClusteredSSOSupportValve is meant to be used only in JBoss because it uses JBoss specific clustered SSO valve. It does not makes sense to use it in Tomcat.
We can easily reproduce the problem in Tomcat by just reference the PortalClusteredSSOSupportValve class in a Servlet Context listener of a web app, to load it.
And it seems that moving PortalClusteredSSOSupportValve to packaging/jboss7 won't solve your issue, because than you won't be able to compile your listener anyway because PortalClusteredSSOSupportValve won't be available. But maybe I still don't uderstand the usecase...
I am able to have listener on Tomcat with code like this and it works without throwing error:
public class PortalSSOValveListener implements ServletContextListener {
ValveBase portalClusteredSSOSupportValve;
public void contextInitialized(ServletContextEvent sce) {
if (new J2EEServerInfo().isJBoss()) {
PortalClusteredSSOSupportValve casted = (PortalClusteredSSOSupportValve)portalClusteredSSOSupportValve;
// Do something with the valve
}
}
public void contextDestroyed(ServletContextEvent sce) {
}
private ValveBase findValve() {
// TODO: Find valve somehow...
return null;
}
}
yes, It sucks that this api is changed...
I can see that it has been changed in org.apache.catalina.valves.ValveBase since Tomcat API 7.0 which already defined a final start() method from its indirect parent class org.apache.catalina.util.LifecycleBase
http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/valves/ValveBase.html
I confirmed that the problem doesn't happen in JBoss, so I guess this api part is not consistent between Tomcat and JBossWeb.
Hmm... I tried to run "mvn dependency:tree" in module component/web/security where PortalClusteredSSOSupportValve currently is. And I am seeing that it's using jboss.web:jbossweb:jar:2.1.3.GA:provided for compilation.
In addition, there is no error in compile time as it is using tomcat catalina version 6.0.29 declared in gatein-dep.
Marek
Thanks,