gpt4 book ai didi

java - UserGroupCallback 类型的依赖关系不满足 : while deploying my application

转载 作者:行者123 更新时间:2023-12-02 06:45:14 30 4
gpt4 key购买 nike

使用与 zkoss 和 EJB 集成的 Jbpm 部署应用程序时出现以下错误。有人可以帮忙吗???我使用的是 JBoss 7.1.1 Final。

错误:

Unsatisfied dependencies for type [UserGroupCallback] with qualifiers [@Default] at injection point [[field] @Inject private org.jbpm.services.task.identity.AbstractUserGroupCallbackDecorator.userGroupCallback]

这是堆栈跟踪:

   15:36:06,393 INFO  [org.jboss.solder.exception.control.extension] (MSC service thread 1-2) Adding handler Qualifiers: [@javax.enterprise.inject.Any()] TraversalMode: BREADTH_FIRST Handles Type: class java.lang.Throwable Precedence: -100 [method] public org.jboss.seam.transaction.SimpleTransactionExceptionHandler.markTransactionRollback(CaughtException<Throwable>) to known handlers
15:36:06,704 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."NewJbpm2MavenProject-1.0.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."NewJbpm2MavenProject-1.0.war".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [UserGroupCallback] with qualifiers [@Default] at injection point [[field] @Inject private org.jbpm.services.task.identity.AbstractUserGroupCallbackDecorator.userGroupCallback]
at org.jboss.as.weld.services.WeldService.start(WeldService.java:83)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [UserGroupCallback] with qualifiers [@Default] at injection point [[field] @Inject private org.jbpm.services.task.identity.AbstractUserGroupCallbackDecorator.userGroupCallback]
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.validateDecorators(Validator.java:391)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:329)
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)
... 5 more

15:36:06,914 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "NewJbpm2MavenProject-1.0.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"NewJbpm2MavenProject-1.0.war\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"NewJbpm2MavenProject-1.0.war\".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [UserGroupCallback] with qualifiers [@Default] at injection point [[field] @Inject private org.jbpm.services.task.identity.AbstractUserGroupCallbackDecorator.userGroupCallback]"}}
15:36:06,922 INFO [org.jboss.as.jpa] (MSC service thread 1-4) JBAS011403: Stopping Persistence Unit Service 'NewJbpm2MavenProject-1.0.war#PersonDEMO-PU'
15:36:06,992 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment NewJbpm2MavenProject-1.0.war in 78ms
15:36:06,994 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."NewJbpm2MavenProject-1.0.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."NewJbpm2MavenProject-1.0.war".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [UserGroupCallback] with qualifiers [@Default] at injection point [[field] @Inject private org.jbpm.services.task.identity.AbstractUserGroupCallbackDecorator.userGroupCallback]

15:36:06,995 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"NewJbpm2MavenProject-1.0.war\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"NewJbpm2MavenProject-1.0.war\".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [UserGroupCallback] with qualifiers [@Default] at injection point [[field] @Inject private org.jbpm.services.task.identity.AbstractUserGroupCallbackDecorator.userGroupCallback]"}}}}

最佳答案

您必须实现自己的 UserGroupCallback 类...如下所示:

import java.util.ArrayList;
import java.util.List;

import javax.enterprise.inject.Alternative;

import org.kie.internal.task.api.UserGroupCallback;


@Alternative
public class MyUserGroupCallback implements UserGroupCallback {

public boolean existsGroup(String groupId) {
return true;
}

public boolean existsUser(String userId) {
return true;
}

public List<String> getGroupsForUser(String userId, List<String> groupIds, List<String> allExistingGroupIds) {
List<String> l = new ArrayList<String>();
return l;
}

}

然后提供您的实现的生产者:

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.PersistenceUnit;

import org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder;
import org.jbpm.runtime.manager.impl.cdi.InjectableRegisterableItemsFactory;
import org.kie.api.io.ResourceType;
import org.kie.internal.io.ResourceFactory;
import org.kie.internal.runtime.manager.RuntimeEnvironment;
import org.kie.internal.runtime.manager.cdi.qualifier.PerProcessInstance;
import org.kie.internal.runtime.manager.cdi.qualifier.PerRequest;
import org.kie.internal.runtime.manager.cdi.qualifier.Singleton;
import org.kie.internal.task.api.UserGroupCallback;

@ApplicationScoped
public class SimpleProcessRuntimeProducer {
@SuppressWarnings("cdi-ambiguous-dependency")
@Inject
private InjectableRegisterableItemsFactory factory;

@Inject
private UserGroupCallback usergroupCallback;

@Produces
public UserGroupCallback produceUserGroupCallback() {
return usergroupCallback;
}

@PersistenceUnit(unitName = "unitname")
private EntityManagerFactory emf;

@Produces
public EntityManagerFactory produceEntityManagerFactory() {
if (this.emf == null) {
this.emf = Persistence
.createEntityManagerFactory("unitname");
}
return this.emf;
}

@Produces
@Singleton
@PerProcessInstance
@PerRequest
public RuntimeEnvironment produceEnvironment(EntityManagerFactory emf) {

RuntimeEnvironment environment = RuntimeEnvironmentBuilder
.getDefault()
.entityManagerFactory(emf)
.userGroupCallback(usergroupCallback)
.registerableItemsFactory(factory)
.addAsset(ResourceFactory.newClassPathResource("process.bpmn"),ResourceType.BPMN2)
.get();
return environment;
}
}

希望这有帮助

关于java - UserGroupCallback 类型的依赖关系不满足 : while deploying my application,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18716361/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com