I'm trying to deploy a war into a JBoss AS 7.1.1 server and the deploy fails while trying to inject the EntityManager:
17:44:48,037 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."c3e.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."c3e.war".WeldService: org.jboss.weld.exceptions.DeploymentException: Exception List with 1 exception:
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [EntityManager] with qualifiers [@Default] at injection point [[field] @Inject xyz.beans.UploadImpl.em]
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:275)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:244)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:107)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:127)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:346)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:331)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83)
at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Normally I would expect that this would result from Weld being unable to find a suitable bean to be injected. However, I define a producer for the EntityManager thus:
@ApplicationScoped
public class Resources {
@PersistenceContext(unitName="myUnit", type=PersistenceContextType.EXTENDED)
private EntityManager entityManager;
@Produces
public EntityManager getEntityManager() {
return entityManager;
}
}
The injection-point about which it complains appears as follows:
@RequestScoped
@Named("upload")
public class UploadImpl implements Upload, Serializable {
private static final long serialVersionUID = 1L;
@Inject
EntityManager em;
}
In another project exactly the same setup worked just fine. Any ideas?