我有一个接口,有两个实现它的类。我尝试使用List来注入其中的所有实现。但我得到了一个WELD例外。
之前我使用javax.enterprise.inject.Instance
并且所有实现都已正确注入。
我只是想知道如果不存在javax.enterprise.inject.Instance
该怎么办?我怎么能解决我的问题所以我做了这个实验。
下面是堆栈跟踪
16:31:41,157 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."ejb-beginner-sessions-ear.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."ejb-beginner-sessions-ear.ear".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1936) [jboss-msc-1.1.5.Final-redhat-1-bz-1093654.jar:1.1.5.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [List<StudentService>] with qualifiers [@Default] at injection point [[field] @Inject private com.ejb.beginner.sessions.web.StudentController.studentServices]
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:315)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:284)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:147)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:167)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:386)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:371)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:64)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-msc-1.1.5.Final-redhat-1-bz-1093654.jar:1.1.5.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913) [jboss-msc-1.1.5.Final-redhat-1-bz-1093654.jar:1.1.5.Final]
... 3 more
16:31:41,189 INFO [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016009: Stopping weld service for deployment ejb-beginner-sessions-ear.ear
16:31:41,184 ERROR [org.jboss.as.server] (HttpManagementService-threads - 1) JBAS015870: Deploy of deployment "ejb-beginner-sessions-ear.ear" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"ejb-beginner-sessions-ear.ear\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"ejb-beginner-sessions-ear.ear\".WeldStartService: Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [List<StudentService>] with qualifiers [@Default] at injection point [[field] @Inject private com.ejb.beginner.sessions.web.StudentController.studentServices]"}}
16:31:41,215 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment null (runtime-name: ejb-beginner-sessions-impl.jar) in 31ms
16:31:41,219 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment null (runtime-name: restful-webservices-beginner.war) in 35ms
16:31:41,220 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment null (runtime-name: ejb-beginner-sessions-war.war) in 36ms
16:31:41,226 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment ejb-beginner-sessions-ear.ear (runtime-name: ejb-beginner-sessions-ear.ear) in 42ms
16:31:41,237 INFO [org.jboss.as.controller] (HttpManagementService-threads - 1) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".component.StudentServiceBean.CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".component.StudentServiceBean.START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".component.StudentServiceBean.START (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".deploymentCompleteService, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".moduleDeploymentRuntimeInformationStart]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".component.StudentServiceBean.VIEW."com.ejb.beginner.sessions.api.StudentService".LOCAL (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".component.StudentServiceBean.START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".component.StudentServiceBean.WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".component.StudentServiceBean.START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".deploymentCompleteService (missing) dependents: [service jboss.deployment.unit."ejb-beginner-sessions-ear.ear".deploymentCompleteService]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".jndiDependencyService (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".component.StudentServiceBean.START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".moduleDeploymentRuntimeInformation (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".moduleDeploymentRuntimeInformationStart, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".component.StudentServiceBean.START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.ejb.beginner.sessions.web.MyRestfulService".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.ejb.beginner.sessions.web.MyRestfulService".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.ejb.beginner.sessions.web.MyRestfulService".START (missing) dependents: [service jboss.web.deployment.default-host./ejb-beginner-sessions-war, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.ejb.beginner.sessions.web.MyRestfulService".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.ejb.beginner.sessions.web.MyRestfulService".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.ejb.beginner.sessions.web.StudentController".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.ejb.beginner.sessions.web.StudentController".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.ejb.beginner.sessions.web.StudentController".START (missing) dependents: [service jboss.web.deployment.default-host./ejb-beginner-sessions-war, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.ejb.beginner.sessions.web.StudentController".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.ejb.beginner.sessions.web.StudentController".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.sun.faces.config.ConfigureListener".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.sun.faces.config.ConfigureListener".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.sun.faces.config.ConfigureListener".START (missing) dependents: [service jboss.web.deployment.default-host./ejb-beginner-sessions-war, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.sun.faces.config.ConfigureListener".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.sun.faces.config.ConfigureListener".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.faces.webapp.FacetTag".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.faces.webapp.FacetTag".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.faces.webapp.FacetTag".START (missing) dependents: [service jboss.web.deployment.default-host./ejb-beginner-sessions-war, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.faces.webapp.FacetTag".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.faces.webapp.FacetTag".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START (missing) dependents: [service jboss.web.deployment.default-host./ejb-beginner-sessions-war, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START (missing) dependents: [service jboss.web.deployment.default-host./ejb-beginner-sessions-war, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.apache.catalina.servlets.DefaultServlet".START (missing) dependents: [service jboss.web.deployment.default-host./ejb-beginner-sessions-war, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.apache.catalina.servlets.DefaultServlet".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.apache.catalina.servlets.DefaultServlet".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.apache.jasper.servlet.JspServlet".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.apache.jasper.servlet.JspServlet".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.apache.jasper.servlet.JspServlet".START (missing) dependents: [service jboss.web.deployment.default-host./ejb-beginner-sessions-war, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.apache.jasper.servlet.JspServlet".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.apache.jasper.servlet.JspServlet".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.jboss.as.weld.webtier.jsp.JspInitializationListener".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.jboss.as.weld.webtier.jsp.JspInitializationListener".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.jboss.as.weld.webtier.jsp.JspInitializationListener".START (missing) dependents: [service jboss.web.deployment.default-host./ejb-beginner-sessions-war, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.jboss.as.weld.webtier.jsp.JspInitializationListener".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.jboss.as.weld.webtier.jsp.JspInitializationListener".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService (missing) dependents: [service jboss.deployment.unit."ejb-beginner-sessions-ear.ear".deploymentCompleteService]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".jndiDependencyService (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."com.ejb.beginner.sessions.web.StudentController".START, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."org.jboss.as.weld.webtier.jsp.JspInitializationListener".START, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".component."javax.faces.webapp.FacetTag".START, service jboss.web.deployment.default-host./ejb-beginner-sessions-war, JBAS014799: ... and 4 more ]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."com.sun.faces.config.ConfigureListener".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."com.sun.faces.config.ConfigureListener".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."com.sun.faces.config.ConfigureListener".START (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".deploymentCompleteService, service jboss.web.deployment.default-host./restful-webservices-beginner]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."com.sun.faces.config.ConfigureListener".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."com.sun.faces.config.ConfigureListener".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.faces.webapp.FacetTag".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.faces.webapp.FacetTag".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.faces.webapp.FacetTag".START (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".deploymentCompleteService, service jboss.web.deployment.default-host./restful-webservices-beginner]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.faces.webapp.FacetTag".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.faces.webapp.FacetTag".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".deploymentCompleteService, service jboss.web.deployment.default-host./restful-webservices-beginner]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".deploymentCompleteService, service jboss.web.deployment.default-host./restful-webservices-beginner]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.ws.rs.core.Application".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.ws.rs.core.Application".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.ws.rs.core.Application".START (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".deploymentCompleteService, service jboss.web.deployment.default-host./restful-webservices-beginner]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.ws.rs.core.Application".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."javax.ws.rs.core.Application".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.apache.catalina.servlets.DefaultServlet".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.apache.catalina.servlets.DefaultServlet".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.apache.catalina.servlets.DefaultServlet".START (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".deploymentCompleteService, service jboss.web.deployment.default-host./restful-webservices-beginner]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.apache.catalina.servlets.DefaultServlet".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.apache.catalina.servlets.DefaultServlet".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.apache.jasper.servlet.JspServlet".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.apache.jasper.servlet.JspServlet".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.apache.jasper.servlet.JspServlet".START (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".deploymentCompleteService, service jboss.web.deployment.default-host./restful-webservices-beginner]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.apache.jasper.servlet.JspServlet".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.apache.jasper.servlet.JspServlet".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.jboss.as.weld.webtier.jsp.JspInitializationListener".CREATE (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.jboss.as.weld.webtier.jsp.JspInitializationListener".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.jboss.as.weld.webtier.jsp.JspInitializationListener".START (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".deploymentCompleteService, service jboss.web.deployment.default-host./restful-webservices-beginner]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.jboss.as.weld.webtier.jsp.JspInitializationListener".WeldInstantiator (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".component."org.jboss.as.weld.webtier.jsp.JspInitializationListener".START]
service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".deploymentCompleteService (missing) dependents: [service jboss.deployment.unit."ejb-beginner-sessions-ear.ear".deploymentCompleteService]
service jboss.naming.context.java.comp.ejb-beginner-sessions-ear.ejb-beginner-sessions-impl.StudentServiceBean (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-impl.jar".component.StudentServiceBean.START]
service jboss.web.deployment.default-host./ejb-beginner-sessions-war (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService]
service jboss.web.deployment.default-host./ejb-beginner-sessions-war.realm (missing) dependents: [service jboss.web.deployment.default-host./ejb-beginner-sessions-war, service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."ejb-beginner-sessions-war.war".deploymentCompleteService]
service jboss.web.deployment.default-host./restful-webservices-beginner (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".deploymentCompleteService]
service jboss.web.deployment.default-host./restful-webservices-beginner.realm (missing) dependents: [service jboss.deployment.subunit."ejb-beginner-sessions-ear.ear"."restful-webservices-beginner.war".deploymentCompleteService, service jboss.web.deployment.default-host./restful-webservices-beginner]
JBAS014777: Services which failed to start: service jboss.deployment.unit."ejb-beginner-sessions-ear.ear".WeldStartService
我们对接口有不同的实现,在运行时我们想要解析使用哪一个。所以我们使用了javax.enterprise.inject.Instance
。我们将自定义注释传递给Instance的select方法并返回相应的实现。该实现使用自定义注释进行注释。这就是我们如何注入所有实例并使用适当的实例。以下是示例代码段
@Inject
@Any
private Instance<SoftwarePackageDescriptorProvider> descriptorProviders;
descriptorProviders.select(new PlatformQualifier(platformType)).get();
答案 0 :(得分:0)
不确定是否有办法获取所有实现类的动态列表,但您可以使用限定符来说明您想要的特定类:
@Inject
@Named("ClassB")
private ClassB impl;