类型[PartitionManager]与限定符[@Default]的不满意依赖关系?

时间:2013-09-23 01:23:02

标签: java java-ee jpa jboss cdi

我正在尝试创建一个简单的企业应用程序,该应用程序使用PicketLink JPA IDM进行用户管理。我的结构如下:

申请EAR    - 网络应用程序(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同时PartitionManagerIdentityManager,两者都会产生相同的结果。谁能解释为什么会出现这种错误?我需要做些什么来创建PartitionManagerIdentityManager

1 个答案:

答案 0 :(得分:0)

这似乎是PicketLink安装程序创建的PicketLink模块的问题。有一个小错误导致它无法在JBoss EAP 6.1中正确配置。将JAR打包在EAR文件中没有问题。