Calling Process Flow from Java code - JBPM6.3

662 views
Skip to first unread message

Abhijit Gupta

unread,
Nov 2, 2015, 5:55:56 AM11/2/15
to jBPM Development
Hi ,

Just a quick question regarding the jbpm6.3

I installed jbpm6.3 on Tomcat and was able to successfully create the process flow and start the instance from workbench. 

But trying it from the Java code, I am unable to start the process (same code works fine with jbpm6.2)

Java Code:

        
        RuntimeEngine engine = RemoteRuntimeEngineFactory.newRestBuilder()
        .addDeploymentId("test:Project1:1.0")
        .addUrl(url)
        .addUserName("ad...@test.com")
        .addPassword("Welcome1#")
        .addTimeout(5000)
        .build();
        
        
        ProcessInstance processInstance = engine.getKieSession().startProcess("Project1.Flow1");

Error (Eclipse Console) :
org.kie.remote.client.api.exception.RemoteCommunicationException: Unable to retrieve content from response!
at org.kie.services.client.api.command.AbstractRemoteCommandObject.executeRestCommand(AbstractRemoteCommandObject.java:427)
at org.kie.services.client.api.command.AbstractRemoteCommandObject.executeCommand(AbstractRemoteCommandObject.java:128)
at org.kie.services.client.api.command.KieSessionClientCommandObject.startProcess(KieSessionClientCommandObject.java:248)
at flowCall.StartFlow.main(StartFlow.java:25)
Caused by: org.kie.remote.common.rest.KieRemoteHttpRequestException: Unable to retrieve input stream of response
at org.kie.remote.common.rest.KieRemoteHttpRequest.responseStream(KieRemoteHttpRequest.java:1365)
at org.kie.remote.common.rest.KieRemoteHttpRequest.responseBuffer(KieRemoteHttpRequest.java:1383)
at org.kie.remote.common.rest.KieRemoteHttpRequest.responseBody(KieRemoteHttpRequest.java:1325)
at org.kie.remote.common.rest.KieRemoteHttpRequest.access$2100(KieRemoteHttpRequest.java:117)
at org.kie.remote.common.rest.KieRemoteHttpRequest$4.body(KieRemoteHttpRequest.java:1291)
at org.kie.services.client.api.command.AbstractRemoteCommandObject.executeRestCommand(AbstractRemoteCommandObject.java:405)
... 3 more
Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at org.kie.remote.common.rest.KieRemoteHttpRequest.responseCode(KieRemoteHttpRequest.java:1305)
at org.kie.remote.common.rest.KieRemoteHttpRequest.post(KieRemoteHttpRequest.java:719)
at org.kie.services.client.api.command.AbstractRemoteCommandObject.executeRestCommand(AbstractRemoteCommandObject.java:392)
... 3 more


Also attaching the log file (Shows lot error can refer the error came at the last)


Thanks,
Abhi
catalina.2015-11-02.log

Marco Rietveld

unread,
Nov 2, 2015, 10:36:31 AM11/2/15
to Abhijit Gupta, jBPM Development
Hi Abhijit,

in 6.4, we introduced security roles.

Please make sure to add the "rest-all" security role to your user in the tomcat configuration.

Thanks,
Marco

On 2015-11-02 11:55, Abhijit Gupta wrote:
> Hi ,
>
> Just a quick question regarding the jbpm6.3
>
> I installed jbpm6.3 on Tomcat and was able to successfully create the process flow and start the instance from workbench.
>
> But trying it from the Java code, I am unable to start the process (same code works fine with jbpm6.2)
>
> Java Code:
>
> URL url = new URL("http://localhost:8080/jbpm-console/ <http://localhost:8080/jbpm-console/>");
> RuntimeEngine engine = RemoteRuntimeEngineFactory.newRestBuilder()
> .addDeploymentId("test:Project1:1.0")
> .addUrl(url)
> .addUserName("ad...@test.com <mailto:ad...@test.com>")
> --
> You received this message because you are subscribed to the Google Groups "jBPM Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-developme...@googlegroups.com
> <mailto:jbpm-developme...@googlegroups.com>.
> To post to this group, send email to jbpm-dev...@googlegroups.com <mailto:jbpm-dev...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jbpm-development/71e1cff4-a979-468b-a41a-d4e04f9629ea%40googlegroups.com
> <https://groups.google.com/d/msgid/jbpm-development/71e1cff4-a979-468b-a41a-d4e04f9629ea%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

mrie...@redhat.com

unread,
Nov 2, 2015, 11:36:11 AM11/2/15
to jBPM Development, infoab...@gmail.com
Abhijit,

Please always make sure to post to the list. Other people could also benefit from the answers, right?

Abhijit wrote:
| Thanks for reply, I am facing the issue for 6.3 so are you referring 6.3 or 6.4

Both.

| And exactly where do we have to add this, i am picking the user and role from mySQL DB. So do i have to add the role rest-all for the specific user in DB.

You should add this in the tomcat-users.xml file.

Here is a list of all of the roles that have been added ;

All operations:                    rest-all
project/repo operations:           rest-project
deployment operations:             rest-deployment
process operations:                rest-process
only read process ops:             rest-process-read-only
task operations:                   rest-task
only read task ops:                rest-task-read-only
Query operations:                  rest-query
Only the Java remote client ops:   rest-client

Thanks,
Marco

Abhijit Gupta

unread,
Nov 2, 2015, 12:00:19 PM11/2/15
to jBPM Development, infoab...@gmail.com
Hi Marco,

Yes right will be carefull and reply in list so others can also take benefit.

I addded the security role for the user "ad...@test.com" as "rest-all" in DB as I changed the Tomcat DataSourceRealm and pointing to DB instead of tomcat-users.properties

But still I am getting same error as before.

Thanks,
Abhijit 

Auxee Ashraph

unread,
May 27, 2016, 2:24:53 PM5/27/16
to jBPM Development

Hi everyone,

I get the following error when i try to make a post

14:04:26,451 INFO  [stdout] (http-localhost/127.0.0.1:8080-2) 14:04:26.451 [http-localhost/127.0.0.1:8080-2] ERROR c.t.c.c.j.b.impl.RemoteBRMConnector - Error was found to send command to rule engine

14:04:26,451 INFO  [stdout] (http-localhost/127.0.0.1:8080-2) org.kie.remote.common.rest.KieRemoteHttpRequestException: Unable to retrieve input stream of response

i can deploy the files without anyerror. Can anyone help?
Reply all
Reply to author
Forward
0 new messages