[ 
https://issues.apache.org/jira/browse/DELTASPIKE-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15432053#comment-15432053
 ] 

Sean Flanigan commented on DELTASPIKE-1198:
-------------------------------------------

Hi John, what are you saying a feature of bean val 1.1? Are you talking about 
CDIAwareConstraintValidatorFactory or BeanManagerProvider? Has 
CDIAwareConstraintValidatorFactory been replaced by something else?

My use case: I have a monolithic application, with a mixture of unit tests 
based on CDI-Unit (which uses Weld SE) and plain non-CDI JUnit tests. At 
runtime, the code is deployed to EAP 7 or WildFly 10, but I'm not having a 
problem there, nor in my Arquillian integration tests, because there I just use 
CDIAwareConstraintValidatorFactory in a Weld/CDI environment. I'm actually in 
the process of migrating to EAP 7 from 6.

If META-INF/validation.xml points to CDIAwareConstraintValidatorFactory, my CDI 
tests work, but some of my non-CDI tests fail, because Hibernate loads 
CDIAwareConstraintValidatorFactory and it tries to initialise 
BeanManagerProvider.

If META-INF/validation.xml is missing, my non-CDI tests are okay (they don't 
use any validators which require CDI), but some of my CDI tests fail because 
the CDI validators don't have their CDI injections.

If META-INF/validation.xml points to 
org.zanata.test.TestingConstraintValidatorFactory, which only uses 
CDIAwareConstraintValidatorFactory if isActive() is true, that would work in 
all cases, except for this problem with BeanManagerProvider.isActive().


> BeanManagerProvider.isActive() returns true after container shutdown
> --------------------------------------------------------------------
>
>                 Key: DELTASPIKE-1198
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-1198
>             Project: DeltaSpike
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.7.0, 1.7.2
>            Reporter: Sean Flanigan
>
> While trying to implement DELTASPIKE-1197 I found that 
> {{BeanManagerProvider.isActive()}} returns true after container shutdown.
> The javadocs for {{isActive()}} say "@return true if the BeanManagerProvider 
> is ready to be used", but when it is in this state, the BeanManagerProvider 
> can't actually be used because the CDI container is not active. 
> In the case of Weld, when {{BeanProvider.getContextualReference()}} was 
> called I got errors like "java.lang.IllegalStateException: Singleton not set 
> for STATIC_INSTANCE => []". There was no stack trace, but that message comes 
> from Weld's RegistrySingletonProvider.java.
> It would seem reasonable to reset bmpSingleton to null during 
> cleanupStoredBeanManagerOnShutdown, but for some reason this breaks a lot of 
> tests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to