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

Mark Struberg commented on DELTASPIKE-782:
------------------------------------------

The only thing which is wrong is that some containers try to bootstrap 
applications with a totally different ClassLoader than they use later at 
runtime. That CRIES for problems! And we are just the first one to blow up, but 
there are many more issues with that approach (again: not OUR approach, but the 
container setup).

You MUST support the case that someone stores classes, static fields etc when 
booting up and using CDI extensions. If you later at runtime would use another 
ClassLoader, then all those instances collected in some CDI extensions (not 
only DeltaSpike!) would crash with ClassLoader errors.

There are basically 1 valid scenarios: 
1.) The container boots up with the 'EAR ClassLoader' and later uses different 
child classloaders for each WAR at runtime. Still the WarClassLoaders have the 
EarClassLoader as parent -> works perfectly fine with DS.

2.) Each WAR get's booted with it's own BeanManager (+ 1 for the 'common' parts 
like JMS). This is what you get in WebSphere. -> works perfectly fine with DS.

3.) There is only 1 ClassLoader and all is treated as 'flat' -> works perfectly 
fine with DS.

So what is the issue? Where can I retest the scenario to see what the real 
problem is?


> BeanManager lookup fails when BeanManager created in parent classloader and 
> in SE mode
> --------------------------------------------------------------------------------------
>
>                 Key: DELTASPIKE-782
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-782
>             Project: DeltaSpike
>          Issue Type: Bug
>          Components: CdiControl, Core
>    Affects Versions: 1.1.0
>            Reporter: Shay matasaro
>            Assignee: John D. Ament
>
> using embeadded tomcat and CdiServletContextListener attempting to use 
> BeanProvider from within a Servlet fails:
> ov 16, 2014 8:19:10 AM org.apache.catalina.core.StandardWrapperValve invoke
> SEVERE: Servlet.service() for servlet [YourServlet] in context with path [/] 
> threw exception
> java.lang.IllegalStateException: Unable to find BeanManager. Please ensure 
> that you configured the CDI implementation of your choice properly.
>       at 
> org.apache.deltaspike.core.api.provider.BeanManagerProvider.getBeanManager(BeanManagerProvider.java:201)
>       at 
> org.apache.deltaspike.core.api.provider.BeanProvider.getBeanManager(BeanProvider.java:475)
>       at 
> org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference(BeanProvider.java:118)
>       at 
> org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference(BeanProvider.java:101)
> The following code resolves fine in the same location:
> BeanManager beanManager = 
> CdiContainerLoader.getCdiContainer().getBeanManager();
> looks like bmi.loadTimeBm at BeanManagerProvider is not being set properly 
> when using the servlet listener



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

Reply via email to