WELD Injection problem on AS7
osnetwork Dec 3, 2011 3:58 PMHello everyone,
I'm trying to deploy a CometD application on JBoss AS7. I have added all the jetty required modules and now I have the following code which is causing some problems
import org.cometd.java.annotation.Service;
@Service
public class TestService {
private BayeuxServer server = new BayeuxServerImpl();
// @Inject
// private BayeuxServer server;
In fact, if I leave the code as it is it doesn't complain, but if I change the server property with the commented part annotated with @Inject I get this error message
21:44:37,854 INFO [org.jboss.weld] (MSC service thread 1-5) Starting weld service
21:44:38,672 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.unit."Test.ear".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."Test.ear".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [BayeuxServer] with qualifiers [@Default] at injection point [[field] @Inject private org.test.cometd.service.TestService.server]
at org.jboss.as.weld.services.WeldService.start(WeldService.java:96)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_27]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_27]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [BayeuxServer] with qualifiers [@Default] at injection point [[field] @Inject private org.test.cometd.service.TestService.server]
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:274)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:243)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:106)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:126)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:345)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:330)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82)
at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)
... 5 more
21:44:39,054 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Failed services" => {"jboss.deployment.unit.\"Test.ear\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"Test.ear\".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [BayeuxServer] with qualifiers [@Default] at injection point [[field] @Inject private org.test.cometd.service.TestService.server]"}}}}
What is the reason of this error? I think it is not related to the dependencies since instantiating the class with "new" seems to work.
thanks in advance.
LM