Issue Type: Bug Bug
Affects Versions: 1.1.13.Final
Assignee: Jozef Hartinger
Created: 12/Jun/13 3:38 AM
Description:

Weld observes AfterBeanDiscovery events with @Default qualifier. However, if another CDI container is present, e.g. if another module is using OpenWebBeans to manage CDI solely for this component, then Weld will receive this event and throw an IllegalStateException:

Exception in thread "main" java.lang.IllegalStateException: Singleton is not set
	at org.jboss.weld.bootstrap.api.helpers.IsolatedStaticSingletonProvider$IsolatedStaticSingleton.get(IsolatedStaticSingletonProvider.java:52)
	at org.jboss.weld.Container.instance(Container.java:54)
	at org.jboss.weld.context.AbstractContext.<init>(AbstractContext.java:67)
	at org.jboss.weld.context.AbstractManagedContext.<init>(AbstractManagedContext.java:11)
	at org.jboss.weld.context.AbstractUnboundContext.<init>(AbstractUnboundContext.java:31)
	at org.jboss.weld.environment.se.contexts.ThreadContext.<init>(ThreadContext.java:40)
	at org.jboss.weld.environment.se.WeldSEBeanRegistrant.registerWeldSEContexts(WeldSEBeanRegistrant.java:49)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:267)
	at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:474)
	at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:440)
	at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:430)
	at org.apache.webbeans.config.BeansDeployer.fireAfterBeanDiscoveryEvent(BeansDeployer.java:332)
	at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:192)
	at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:129)
	at com.company.mavenproject1.boot.BootWebBeans.startApplication(BootWebBeans.java:41)
	at com.company.mavenproject1.boot.BootWebBeans.run(BootWebBeans.java:28)
	at com.company.mavenproject1.boot.BootWebBeans.main(BootWebBeans.java:23)

I consider this being a major issue because it implies that it's impossible to develop components / modules / bean archives (whatever you call it) which use a private CDI container. As soon as Weld is present on the class path, e.g. to manage CDI for the client application, you will get this IllegalStateException.

Project: Weld
Priority: Major Major
Reporter: Christian Schlichtherle
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira