[jboss-jira] [JBoss JIRA] (AS7-2418) Looking up BeanManager from JNDI doesn't work in ServletRequestListener.requestInitialized()
Stuart Douglas (Updated) (JIRA)
jira-events at lists.jboss.org
Sun Nov 6 16:29:45 EST 2011
[ https://issues.jboss.org/browse/AS7-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stuart Douglas updated AS7-2418:
--------------------------------
Assignee: Remy Maucherat (was: Stuart Douglas)
Component/s: Web
(was: CDI / Weld)
It appears that the NamespaceContextSelector is not being setup for this call
> Looking up BeanManager from JNDI doesn't work in ServletRequestListener.requestInitialized()
> --------------------------------------------------------------------------------------------
>
> Key: AS7-2418
> URL: https://issues.jboss.org/browse/AS7-2418
> Project: Application Server 7
> Issue Type: Bug
> Components: Web
> Affects Versions: 7.0.2.Final
> Reporter: Christian Kaltepoth
> Assignee: Remy Maucherat
>
> Looking up BeanManager from JNDI doesn't work if the lookup is done from ServletRequestListener.requestInitialized(). You can reproduce this issue by simply adding this class to CDI WAR application deployed to AS 7.0.2.Final:
> {code}
> @WebListener
> @WebFilter(urlPatterns = "/*")
> public class TestListener implements ServletRequestListener, Filter {
> @Override
> public void init(FilterConfig config) throws ServletException {
> lookupBeanManager("Filter.init()");
> }
> @Override
> public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
> ServletException {
> lookupBeanManager("filter.doFilter()");
> chain.doFilter(request, response);
> }
> @Override
> public void destroy() {
> }
> @Override
> public void requestInitialized(ServletRequestEvent event) {
> lookupBeanManager("ServletRequestListener.requestInitialized()");
> }
> @Override
> public void requestDestroyed(ServletRequestEvent arg0) {
> }
> private void lookupBeanManager(String calledFrom) {
> try {
> InitialContext ic = new InitialContext();
> Object beanManager = ic.lookup("java:comp/BeanManager");
> System.out.println(calledFrom + ": Lookup SUCCESS");
> } catch (NamingException e) {
> System.out.println(calledFrom + ": Lookup FAILED");
> }
> }
> }
> {code}
> You will see that the lookup works fine for the Filter methods {{initFilter}} and {{doFilter}}, but not for {{requestInitialized}}.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list