The following component will print during creation, but I never see the destroy. I debug the SeamListener, and find that the only 4 items in the Contexts.application (and in fact the Lifecycle.application) are:
2009-09-09 09:35:54,060 [httpWorkerThread-4848-1] DEBUG org.jboss.seam.contexts.Lifecycle - Shutting down application and destroying contexts
2009-09-09 09:35:54,060 [httpWorkerThread-4848-1] DEBUG org.jboss.seam.contexts.Contexts - destroying: org.apache.catalina.jsp_classpath
2009-09-09 09:35:54,060 [httpWorkerThread-4848-1] DEBUG org.jboss.seam.contexts.Contexts - destroying: javax.servlet.context.tempdir
2009-09-09 09:35:54,060 [httpWorkerThread-4848-1] DEBUG org.jboss.seam.contexts.Contexts - destroying: org.apache.catalina.WELCOME_FILES
2009-09-09 09:35:54,060 [httpWorkerThread-4848-1] DEBUG org.jboss.seam.contexts.Contexts - destroying: org.apache.catalina.resources
The component
@Name("testApp")
@Startup
@Scope(ScopeType.APPLICATION)
public class TestAppComp {
@Logger
Log log;
@Create
public void create() {
Context ctx = Contexts.getApplicationContext();
if (ctx != null)
for (String name: ctx.getNames())
log.warn(name);
log.warn("TestAppComp CREATED");
}
@Destroy
public void destroy() {
log.warn("TestAppComp DESTROYED");
}
}
I'm running this on Glassfish v2.1 with Seam 2.2.0.GA, but a coworker said he attempted it on JBoss 5 with a very simple config. It is very important that @Destroy work for me, as I need to have my connection pool (which is in Spring IoC) cleaned up on App shutdown. Am I approaching this wrong? Do I have other issues? Any help is appreciated!