getTasksAssignedAsPotentialOwner empty with RemoteJmsRuntimeEngineFactory
guyr Mar 16, 2014 3:12 AMFollowing the examples in the Chapter 17 of the documentation, I started out with RemoteRestRuntimeFactory. I got that working well: getTasksAssignedAsPotentialOwner() returned the correct set of tasks, and I was able to claim, start and complete tasks. However, our code uses Jersey to provide REST services to other applications. I discovered when I tried to deploy our code using RemoteRestRuntimeFactory that it does not work. RestEasy and Jersey cannot co-exist; the app gets this runtime error:
java.lang.ClassCastException: com.sun.jersey.server.impl.provider.RuntimeDelegateImpl cannot be cast to org.jboss.resteasy.spi.ResteasyProviderFactory
So, I tried switching to RemoteJmsRuntimeEngineFactory. This is more difficult to configure than RemoteRestRuntimeFactory. You need to run add-user.bat in JBoss 7 to the ApplicationRealm for the userName you use to establish the JMS connection. Then you need to update standalone-full.xml to add each role you are querying to security-settings. So, now the test app is working with JMS, but taskService.getTasksAssignedAsPotentialOwner is returning no tasks. I'm not seeing any errors in the JBoss log. I know I'm connecting because getTaskService().getTasksByProcessInstanceId(1) *does* work. But we really need getTasksAssignedAsPotentialOwner.
Any ideas? I searched this forum looking for JMS and found very few posts. Has anyone actually used the RemoteJmsRuntimeEngineFactory successfully?
Here is the codeI use to toggle between REST and JMS:
if (fRest) | |
{ | |
RemoteRestRuntimeFactory restRuntimeFactory = new RemoteRestRuntimeFactory(JBPM_DEPLOYMENT_ID, JBPM_BASE_URL, JBPM_USER, JBPM_PASSWORD); |
engine = restRuntimeFactory.newRuntimeEngine(); | |
} | |
else | |
{ | |
java.util.Hashtable<String, String> env = new java.util.Hashtable<String, String>(); |
env.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); | |
env.put(InitialContext.PROVIDER_URL, "remote://localhost:4447"); | |
// env.put( InitialContext.URL_PKG_PREFIXES, "org.jboss.naming" ); | |
env.put(InitialContext.SECURITY_PRINCIPAL, "salaboy"); // salaboy | |
env.put(InitialContext.SECURITY_CREDENTIALS, "salaboypw"); |
InitialContext remoteInitialContext = null; | |
try | |
{ | |
remoteInitialContext = new InitialContext(env); | |
} | |
catch (NamingException e) | |
{ | |
e.printStackTrace(); | |
} |
RemoteJmsRuntimeEngineFactory jmsRuntimeFactory = new RemoteJmsRuntimeEngineFactory(JBPM_DEPLOYMENT_ID, remoteInitialContext, JBPM_USER, JBPM_PASSWORD); |
engine = jmsRuntimeFactory.newRuntimeEngine(); |
} |
KieSession ksession = engine.getKieSession(); |
TaskService taskService = engine.getTaskService(); |
AuditLogService auditLogService = engine.getAuditLogService(); |