[cdi-dev] [JBoss JIRA] (CDI-743) NPE when trying to get BeanManager after container was closed
Matej Novotny (Jira)
issues at jboss.org
Fri Feb 15 09:38:00 EST 2019
[ https://issues.jboss.org/browse/CDI-743?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matej Novotny updated CDI-743:
------------------------------
Steps to Reproduce:
Try to run this application:
{code}
import javax.enterprise.inject.se.SeContainer;
import javax.enterprise.inject.se.SeContainerInitializer;
import javax.enterprise.inject.spi.CDI;
public class NPEOnSecondGetBeanManager {
public static void main(String[] args) {
SeContainer container = SeContainerInitializer.newInstance()
.disableDiscovery()
.addBeanClasses(BeanClass.class)
.initialize();
CDI.current().getBeanManager();
container.close();
CDI.current().getBeanManager();
}
public static class BeanClass {
}
}
{code}
was:
Try to run this application:
import javax.enterprise.inject.se.SeContainer;
import javax.enterprise.inject.se.SeContainerInitializer;
import javax.enterprise.inject.spi.CDI;
public class NPEOnSecondGetBeanManager {
public static void main(String[] args) {
SeContainer container = SeContainerInitializer.newInstance()
.disableDiscovery()
.addBeanClasses(BeanClass.class)
.initialize();
CDI.current().getBeanManager();
container.close();
CDI.current().getBeanManager();
}
public static class BeanClass {
}
}
> NPE when trying to get BeanManager after container was closed
> -------------------------------------------------------------
>
> Key: CDI-743
> URL: https://issues.jboss.org/browse/CDI-743
> Project: CDI Specification Issues
> Issue Type: Bug
> Affects Versions: 2.0 .Final, 2.0.SP1
> Environment: simple application that uses weld-se-core and cdi api.
> Reporter: Doychin Bondzhev
> Priority: Major
>
> CDI.current() should produce IllegalStateException when there is no active container at the moment.
> Instead on the second call in the sample application CDI.current() returns null and that results in NPE.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the cdi-dev
mailing list