Weld doesn't find deployment unit in a jar located in an EAR's lib directory
----------------------------------------------------------------------------
Key: AS7-1761
URL:
https://issues.jboss.org/browse/AS7-1761
Project: Application Server 7
Issue Type: Bug
Components: CDI / Weld
Affects Versions: 7.0.1.Final
Environment: Jenkins build 1590
Reporter: Juergen Zimmermann
Assignee: Stuart Douglas
I'm using Jenkins build 1590. My deployed EAR has the name "swe.ear", and
contains
* lib/sweUtil.jar,
* the EJB module sweEJB.jar, and
* the web module sweWeb.war.
Furthermore sweUtil.jar contains META-INF/persistence.xml defining the persistence unit
"SwePersistenceUnit".
The web module contains this configuration class for Seam:
public class SeamPersistenceConfig {
@Produces
@SwePersistence
@PersistenceContext(unitName = "SwePersistenceUnit")
private EntityManager emSwe;
}
The following injection is in a CDI-managed bean of the web module:
@Inject
@SwePersistence
private EntityManager em;
When the EntityManager is being injected I'm getting the following stacktrace because
persistence.xml is not in the web module "sweWeb.war", but in the jar file
inside the EAR's lib directory:
19:06:10,986 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/swe].[Faces Config]]
(http--127.0.0.1-8080-6) Servlet.service() for servlet Faces Config threw exception:
java.lang.RuntimeException: Can't find a deployment unit named SwePersistenceUnit at
subdeployment "sweWeb.war" of deployment "swe.ear"
at
org.jboss.as.weld.services.bootstrap.WeldJpaInjectionServices.getScopedPUName(WeldJpaInjectionServices.java:94)
[jboss-as-weld-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
at
org.jboss.as.weld.services.bootstrap.WeldJpaInjectionServices.resolvePersistenceContext(WeldJpaInjectionServices.java:59)
[jboss-as-weld-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
at org.jboss.weld.util.Beans.injectEEFields(Beans.java:784)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:181)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:54)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:176)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:142)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:170)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:339)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:67)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:693)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.bean.AbstractReceiverBean.getReceiver(AbstractReceiverBean.java:84)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.bean.ProducerField$1.produce(ProducerField.java:134)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:361)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.builtin.ee.EEResourceProducerField.createUnderlying(EEResourceProducerField.java:170)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.builtin.ee.EEResourceProducerField.access$000(EEResourceProducerField.java:54)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.builtin.ee.EEResourceProducerField$EEResourceCallable.call(EEResourceProducerField.java:80)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.builtin.CallableMethodHandler.invoke(CallableMethodHandler.java:50)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:62)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:125)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weldx.persistence.EntityManagerFactory$1337657821$Proxy$_$$_Weld$Proxy$.createEntityManager(EntityManagerFactory$1337657821$Proxy$_$$_Weld$Proxy$.java)
[weld-core-1.1.2.Final.jar:]
at
org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.create(ManagedPersistenceContextBeanLifecycle.java:95)
[seam-persistence-3.1.0.Beta2.jar:]
at
org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.create(ManagedPersistenceContextBeanLifecycle.java:45)
[seam-persistence-3.1.0.Beta2.jar:]
at org.jboss.seam.solder.bean.ImmutableBean.create(ImmutableBean.java:81)
[seam-solder-3.1.0-20110830.040748-5.jar:]
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:122)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:124)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.jboss.weld.proxies.EntityManager$ManagedPersistenceContext$1265132818$Proxy$_$$_WeldClientProxy.getQualifiers(EntityManager$ManagedPersistenceContext$1265132818$Proxy$_$$_WeldClientProxy.java)
[weld-core-1.1.2.Final.jar:]
at
org.jboss.seam.persistence.PersistenceContextsImpl.beforeRender(PersistenceContextsImpl.java:115)
[seam-persistence-3.1.0.Beta2.jar:]
at
org.jboss.seam.persistence.PersistenceContextsImpl$Proxy$_$$_WeldClientProxy.beforeRender(PersistenceContextsImpl$Proxy$_$$_WeldClientProxy.java)
[seam-persistence-3.1.0.Beta2.jar:]
at
org.jboss.seam.faces.transaction.TransactionPhaseListener.handleTransactionsBeforePhase(TransactionPhaseListener.java:78)
[seam-faces-3.1.0.Beta2.jar:]
at
org.jboss.seam.faces.transaction.TransactionPhaseListener.beforePhase(TransactionPhaseListener.java:64)
[seam-faces-3.1.0.Beta2.jar:]
at
org.jboss.seam.faces.event.DelegatingPhaseListener.beforePhase(DelegatingPhaseListener.java:43)
[seam-faces-3.1.0.Beta2.jar:]
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67)
[weld-core-1.1.2.Final.jar:2011-07-26 15:02]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
[prettyfaces-jsf2-3.3.0.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)
[jboss-as-web-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:388)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
[jboss-as-web-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
at
org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49)
[jboss-as-jpa-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)
[jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at java.lang.Thread.run(Thread.java:722) [:1.7.0]
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira