我正在尝试创建一个使用 PicketLink JPA IDM 进行用户管理的简单企业应用程序。我的结构如下:
应用程序 EAR -- Web 应用程序 (WAR) -- EJB (JAR)
PicketLink 库在 JBoss EAP 6.1 上作为模块提供。
我试图简单地@Inject
,PartitionManager
但不断收到错误。我尝试将它注入 EJB 和 POJO,两者的结果相同。在我的 WAR 中,我有一个简单的动作类,如下所示:
@Named
public class TestAction {
@Inject
private PartitionManager partitionManager = null;
public void runTest() {
if (partitionManager == null) {
System.err.println("NULL");
} else {
System.out.println("NOT NULL");
}
}
}
但是,当我尝试部署此类时,出现以下错误:
[0m[31m21:15:47,527 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."MyTest.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."MyTest.ear".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_07]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [PartitionManager] with qualifiers [@Default] at injection point [[field] @Inject private net.test.web.servlets.TestAction.partitionManager]
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:311)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:280)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:143)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:163)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:382)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:367)
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:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
... 3 more
我已经尝试@Inject
了 thePartitionManager
和 the IdentityManager
,两者都导致相同的结果。谁能解释为什么会发生这个错误?我还需要做些什么来创建PartitionManager
orIdentityManager
吗?