7 Replies Latest reply: Jun 11, 2012 2:21 AM by chandrasachin16 RSS

    Problem with Rest Interface in JBPM 5.2

    chandrasachin16 Newbie

      Hi All,

       

      I am using JBPM 5.2 .I studied the online documentation and tried to use the REST interface for interacting with Processes in the JBPM engine

      I tried with the following url :

       

      http://localhost:8080/gwt-console-server/rs/process/definition/{id}/new_instance

       

      In place of {id} I gave the id of my JBPM process which is (com.sample.evaluation).So the complete url was something like this which is given below

       

       

      http://localhost:8080/gwt-console-server/rs/process/definition/{com.sample.evaluation}/new_instance.But after putting this url and hitting enter

       

      a login window appeared as "BPM" console.I entered user and password as (krisv/krisv) but after this a blank screen appeared.

       

      I then logged in into the jbpm console to see if the process was started or not ,but I couldn't see any process instance started.

       

      My first question is about the login window.

      1.Which users should interact with BPM console and what is the purpose of BPM console

      2.Why did the blank screen appeared.Is it that I am going the wrong way.

       

      Can any one please tell me that whether the REST interface works fine in JBPM 5.2 or not

       

      Any help would be valuable to me.

        • 1. Re: Problem with Rest Interface in JBPM 5.2
          Dirk Meyer Newbie

          you are trying to access a POST service with a GET call. You have to write some code. The are some other topics on how to to this but it is not a trivial issue. 

           

          Have a look at some of these

          http://community.jboss.org/message/605467 ., http://community.jboss.org/message/601387

           

          The REST Interface work fine - I have just completed my own User test application to test the REST service ( GWT ).

          There are some cross platform security issues to consider when implementing the rest services, but  I have  verified most of the rest service in 5.2 -

          I am still learning to understand the responses  from some of the calls, as the responses will depend on the workflow you instances use to test. 

          I am still unsure of some of the rest calls, but I will investigate the console-server code when I think I need to use these.

           

          The JBPM console is just a basic platform console, if you are planning any commercial work then you still have a lot more to do to make the workflow solutions adaptable for business users. You also have to consider how you will deal with fine grain permission and user rights as this impact the designs and executions of your workflow's directly. It is also the area where I have not yet seen any vendor with appropriate solution.

           

          In my case I have my own identity platform integrated into the JBoss portal architecture. I am currently simplifying this components for use with the jboss application server and the human task manager service for small client base deployments.

           

          For commercial solutions you will still need to use the direct api's , but the rest approach do simplify some of the  coding and management activities.

           

          Regards

          • 2. Re: Problem with Rest Interface in JBPM 5.2
            chandrasachin16 Newbie

            Hi Dirk,

             

            Thanks for replying.I will try with this solution.

            • 3. Re: Problem with Rest Interface in JBPM 5.2
              chandrasachin16 Newbie

              Hi Dirk ,

               

              I tried with the solution given in the link as suggested by you. I tried with Http Client 4.2. I created a web service in which I wrote two methods (authenticate and requestPostService).The code is written as follows

               

              public class RestInt {

                 

                  public static String KEY_USERNAME="j_username";

                  public static String KEY_PASSWORD="j_password";

                  private static HttpClient httpclient = new DefaultHttpClient();

                  private static final String PROCESS_INSTANCE="http://localhost:8080/gwt-console-server/rs/process/definition/{com.sample.evaluation}/new_instance";

                  public String MyService(String name) throws ClientProtocolException, IOException{

                      String response=authenticate("krisv","krisv");

                      System.out.println("Authentication------------------------"+response);

                      response=requestPostService(PROCESS_INSTANCE,null,false);

                      System.out.println("Process Instance------------------------"+response);

                      return  response;

                      }

                 

                  public static String authenticate(String username,String password){

                      String responseString="";

                      List<NameValuePair> formsParam=new ArrayList<NameValuePair>();

                      formsParam.add(new BasicNameValuePair(KEY_USERNAME, username));

                      formsParam.add(new BasicNameValuePair(KEY_PASSWORD, password));

                      HttpPost httpPost=new HttpPost("http://localhost:8080/gwt-console-server/rs/process/j_security_check");

                      InputStreamReader inputStreamReader=null;

                      BufferedReader bufferedReader=null;

                      try{

                         

                          UrlEncodedFormEntity entity=new UrlEncodedFormEntity(formsParam, "UTF-8");

                          httpPost.setEntity(entity);

                          HttpResponse response=httpclient.execute(httpPost);

                          InputStream inputStream=response.getEntity().getContent();

                          inputStreamReader=new InputStreamReader(inputStream);

                          bufferedReader=new BufferedReader(inputStreamReader);

                          StringBuilder builder =new StringBuilder();

                          String line=bufferedReader.readLine();

                          while(line!=null){

                              builder.append(line);

                              System.out.println("line--------------------------------"+line);

                              line=bufferedReader.readLine();

                          }

                          responseString=builder.toString();

                      }catch(Exception ex){

                          throw new RuntimeException(ex);

                      }finally{

                          if(inputStreamReader!=null){

                              try{

                                  inputStreamReader.close();

                              }catch(Exception ex){

                                  throw new RuntimeException(ex);

                              }

                          }if(bufferedReader!=null){

                              try{

                                  bufferedReader.close();

                              }catch(Exception ex){

                                  throw new RuntimeException(ex);

                              }

                          }

                      }

                      return responseString;

                  }

                  public static String requestPostService(String url,Map<String,Object> parameters,boolean multipart) throws ClientProtocolException, IOException{

                      String responseString="";

                      MultipartEntity multiPartEntity=new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);

                      List<NameValuePair> formsParam=new ArrayList<NameValuePair>();

                      if(parameters==null){

                          parameters=new HashMap<String, Object>();

                      }

                      Set<String> keys =parameters.keySet();

                      for(Iterator<String> keysIterator=keys.iterator();keysIterator.hasNext();){

                          String keyString=keysIterator.next();

                          String value=parameters.get(keyString).toString();

                          formsParam.add(new BasicNameValuePair(keyString, value));

                          if(multipart){

                              try{

                                StringBody body=new StringBody(value,"text/plain",Charset.forName("UTF-8"));

                                multiPartEntity.addPart(keyString, (ContentBody)body);

                              }catch(Exception ex){

                                  throw new RuntimeException(ex);

                              }

                             

                          }

                      }

                      HttpPost httpPost=new HttpPost(url);

                      InputStreamReader inputStreamReader=null;

                      BufferedReader bufferedReader=null;

                      try{

                      if(multipart){

                          httpPost.setEntity(multiPartEntity);

                      }else{

                          UrlEncodedFormEntity entity=new UrlEncodedFormEntity(formsParam, "UTF-8");

                          httpPost.setEntity(entity);

                      }

                      HttpResponse response=httpclient.execute(httpPost);

                      InputStream inputStream=response.getEntity().getContent();

                      inputStreamReader=new InputStreamReader(inputStream);

                      bufferedReader=new BufferedReader(inputStreamReader);

                      StringBuilder builder =new StringBuilder();

                      String line=bufferedReader.readLine();

                      while(line!=null){

                          builder.append(line);

                          System.out.println("line--------------------------------"+line);

                          line=bufferedReader.readLine();

                      }

                      responseString=builder.toString();

                      }catch(Exception ex){

                          throw new RuntimeException(ex);

                      }finally{

                          if(inputStreamReader!=null){

                              try{

                                  inputStreamReader.close();

                              }catch(Exception ex){

                                  throw new RuntimeException(ex);

                              }

                          }if(bufferedReader!=null){

                              try{

                                  bufferedReader.close();

                              }catch(Exception ex){

                                  throw new RuntimeException(ex);

                              }

                          }

                      }

                      return responseString;

                  }

              }

               

               

              However when I tried to run this I got an error "The client did not produce a request within the time that the server was prepared to wait".It looks like this is a problem with timeout.Also another error occurs while accessing invoking the web service.In the code I am trying to invoke the web service using a JSP ,but I get exception: java.lang.IllegalArgumentException which occurs at line

              response=requestPostService(PROCESS_INSTANCE,null,false); // since we are passing null for the second argument.My queries why we are passing  a null value or has it got some purpose to serve ?

              The errror log in Jboss's server log is as given below.

               

               

              22:43:30,172 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-1) Initializing Mojarra 2.1.3 (SNAPSHOT 20110825) for context '/drools-guvnor'

              22:43:33,610 INFO  [org.hibernate.validator.util.Version] (MSC service thread 1-1) Hibernate Validator 4.2.0.Final

              22:43:33,794 INFO  [org.jboss.web] (MSC service thread 1-1) registering web context: /drools-guvnor

              22:43:33,796 INFO  [org.jboss.as] (MSC service thread 1-2) JBoss AS 7.0.2.Final "Arc" started in 208029ms - Started 430 of 497 services (67 services are passive or on-demand)

              22:43:33,860 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "JBPMRestClient.war"

              22:43:33,861 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "JBPMRest.war"

              22:43:33,861 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "jbpm-gwt-console.war"

              22:43:33,861 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "jbpm-gwt-console-server.war"

              22:43:33,861 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "drools-guvnor.war"

              22:43:33,861 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "designer.war"

              23:22:48,542 INFO  [stdout] (http-localhost-127.0.0.1-8080-4) line--------------------------------<html><head><title>JBoss Web/7.0.1.Final - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 408 - The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser</u></p><p><b>description</b> <u>The client did not produce a request within the time that the server was prepared to wait (The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser).</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.1.Final</h3></body></html>

               

              23:22:48,543 INFO  [stdout] (http-localhost-127.0.0.1-8080-4) Authentication------------------------<html><head><title>JBoss Web/7.0.1.Final - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 408 - The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser</u></p><p><b>description</b> <u>The client did not produce a request within the time that the server was prepared to wait (The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser).</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.1.Final</h3></body></html>

               

              Can you please throw some light on this .

               

              Regards

              Sachin

              • 4. Re: Problem with Rest Interface in JBPM 5.2
                Dirk Meyer Newbie

                I am sorry to see that you have problems, I never had the same problem you described here, so I am not sure how to help,

                I did have some issues with teh stricter crosssite rules for HTTPClient 4.2

                I overcome that by doing sone specific setting to prepare my HttpClient .

                screen capture jbpm.PNG

                my workflow manager, a work in progress - GWT Interface

                 

                I created my redirect strategy. a bit of research won't do you any harm so you have to play arround with the HrrpClient setup and how to string the calls fo post and get together.

                 

                 

                public

                class BrowserRedirectStrategy extends

                DefaultRedirectStrategy { .....}

                 

                 

                in your class define

                 

                 

                 

                private DefaultHttpClient httpClient = new  DefaultHttpClient(); //you have done this

                 

                The process I follow is

                     if Get make GetCall

                          if j_security in content call authenticate

                                    if  405 Method Not Allowed

                 

                 

                .                         call Get again normally with a positive result

                   if Post make post call

                          if j_security in content call authenticate

                               if 405 Method Not Allowed

                                    call Get again to page without aparameters for post normally with a good result

                 

                Here is how I setup the HttpClient -

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                httpClient.getParams().setParameter(AllClientPNames.HANDLE_REDIRECTS, true );

                 

                httpClient.setRedirectStrategy(new BrowserRedirectStrategy());

                HttpHost targetHost = new HttpHost("localhost", 8080, "http"

                ); //todo replace with lookup

                 

                String content = ""

                ;

                 

                httpClient.getCredentialsProvider().setCredentials(new
                AuthScope(targetHost.getHostName(), targetHost.getPort()),

                                                                                           new

                UsernamePasswordCredentials(userId, password));

                 

                // Generate BASIC scheme object and add it to the local

                 

                // auth cache

                BasicScheme basicAuth = new  BasicScheme();

                AuthCache authCache = new BasicAuthCache();

                 

                authCache.put(targetHost, basicAuth);

                 

                 

                // Add AuthCache to the execution context

                BasicHttpContext localcontext =

                new BasicHttpContext();

                 

                 

                 

                );

                 

                 

                 

                here is a example trace of the resulted call -

                 

                 

                See that I call my redirect strategy

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                21:51:59,300 INFO [server] isRedirected -----start-------

                21:51:59,311 INFO [server] isRedirected status line ->HTTP/1.1 200 OK

                21:51:59,312 INFO [server] isRedirected Header ->no loaction

                21:51:59,312 INFO [server] isRedirected Headers

                21:51:59,312 INFO [server] Server = [Apache-Coyote/1.1]

                21:51:59,312 INFO [server] isRedirected Header Elements

                21:51:59,312 INFO [server] Apache-Coyote/1.1 = []

                21:51:59,312 INFO [server] Pragma = [No-cache]

                21:51:59,312 INFO [server] isRedirected Header Elements

                21:51:59,312 INFO [server] No-cache = []

                21:51:59,312 INFO [server] Cache-Control = [no-cache]

                21:51:59,312 INFO [server] isRedirected Header Elements

                21:51:59,312 INFO [server] no-cache = []

                21:51:59,312 INFO [server] Expires = [Thu, 01 Jan 1970 10:00:00 EST]

                21:51:59,312 INFO [server] isRedirected Header Elements

                21:51:59,312 INFO [server] Thu = []

                21:51:59,312 INFO [server] 01 Jan 1970 10:00:00 EST = []

                21:51:59,312 INFO [server] Set-Cookie = [JSESSIONID=2607867399457D13348FAE3E857B72FA; Path=/gwt-console-server]

                21:51:59,312 INFO [server] isRedirected Header Elements

                21:51:59,313 INFO [server] JSESSIONID = [2607867399457D13348FAE3E857B72FA]

                21:51:59,313 INFO [server] Accept-Ranges = [bytes]

                21:51:59,313 INFO [server] isRedirected Header Elements

                21:51:59,313 INFO [server] bytes = []

                21:51:59,313 INFO [server] ETag = [W/"621-1323388266000"]

                21:51:59,313 INFO [server] isRedirected Header Elements

                21:51:59,313 INFO [server] W/"621-1323388266000" = []

                21:51:59,313 INFO [server] Last-Modified = [Thu, 08 Dec 2011 23:51:06 GMT]

                21:51:59,313 INFO [server] isRedirected Header Elements

                21:51:59,313 INFO [server] Thu = []

                21:51:59,313 INFO [server] 08 Dec 2011 23:51:06 GMT = []

                21:51:59,313 INFO [server] Content-Type = [text/html]

                21:51:59,313 INFO [server] isRedirected Header Elements

                21:51:59,313 INFO [server] text/html = []

                21:51:59,313 INFO [server] Content-Length = [621]

                21:51:59,313 INFO [server] isRedirected Header Elements

                21:51:59,313 INFO [server] 621 = []

                21:51:59,313 INFO [server] Date = [Mon, 04 Jun 2012 11:51:58 GMT]

                21:51:59,313 INFO [server] isRedirected Header Elements

                21:51:59,313 INFO [server] Mon = []

                21:51:59,313 INFO [server] 04 Jun 2012 11:51:58 GMT = []

                21:51:59,313 INFO [server] isRedirected ------------

                21:51:59,313 INFO [server] isRedirected return 4=false

                21:51:59,316 INFO [server] Raw Response 1HTTP/1.1 200 OK [Server: Apache-Coyote/1.1, Pragma: No-cache, Cache-Control: no-cache, Expires: Thu, 01 Jan 1970 10:00:00 EST, Set-Cookie: JSESSIONID=2607867399457D13348FAE3E857B72FA; Path=/gwt-console-server, Accept-Ranges: bytes, ETag: W/"621-1323388266000", Last-Modified: Thu, 08 Dec 2011 23:51:06 GMT, Content-Type: text/html, Content-Length: 621, Date: Mon, 04 Jun 2012 11:51:58 GMT]

                21:51:59,316 INFO [server] start process1:------><html><head> <title>HTTP 401</title> <!-- Do not remove --></head><body><form method="POST" action="j_security_check"> <center/> <br><br> <div style="font-family:sans-serif;border:1px solid black; width:270;padding:15px;"> <h2>BPM Console Server</h2> <table with=250> <tr> <td>Username:</td> <td><input type="text" name="j_username"></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="j_password"></td> </tr> <tr> <td></td> <td align=right><input type="submit"/></td> </tr> </table> </div></form></body></html>

                 

                  

                  

                  

                21:51:59,316 INFO [server] start sec url:------>http://localhost:8080/gwt-console-server/rs/process/j_security_check

                 

                  

                  

                  

                21:51:59,319 INFO [server] Next call execute sec

                21:51:59,345 INFO [server] isRedirected -----start-------

                21:51:59,345 INFO [server] isRedirected status line ->HTTP/1.1 302 Moved Temporarily

                21:51:59,345 INFO [server] isRedirected Header ->Location: http://localhost:8080/gwt-console-server/rs/process/definitions

                21:51:59,345 INFO [server] isRedirected Headers

                21:51:59,345 INFO [server] Server = [Apache-Coyote/1.1]

                21:51:59,345 INFO [server] isRedirected Header Elements

                21:51:59,345 INFO [server] Apache-Coyote/1.1 = []

                21:51:59,345 INFO [server] Location = [http://localhost:8080/gwt-console-server/rs/process/definitions]

                21:51:59,345 INFO [server] isRedirected Header Elements

                21:51:59,345 INFO [server] http://localhost:8080/gwt-console-server/rs/process/definitions = []

                21:51:59,345 INFO [server] Content-Length = [0]

                21:51:59,345 INFO [server] isRedirected Header Elements

                21:51:59,345 INFO [server] 0 = []

                21:51:59,345 INFO [server] Date = [Mon, 04 Jun 2012 11:51:58 GMT]

                21:51:59,345 INFO [server] isRedirected Header Elements

                21:51:59,345 INFO [server] Mon = []

                21:51:59,345 INFO [server] 04 Jun 2012 11:51:58 GMT = []

                21:51:59,345 INFO [server] isRedirected ------------

                21:51:59,345 INFO [server] isRedirectable call ->POST

                21:51:59,345 INFO [server] isRedirectable call TRUE for->POST

                21:51:59,346 INFO [server] isRedirected return 1=true

                21:52:01,385 INFO [STDOUT] INFO 04-06 21:52:01,369 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:03,200 INFO [STDOUT] INFO 04-06 21:52:03,200 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (

                RepositoryServlet.java:allowUser:113

                ) admin authenticated for rest api

                21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (

                PackageDeploymentServlet.java:execute:134

                ) PackageName: defaultPackage

                21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (

                PackageDeploymentServlet.java:execute:135

                ) PackageVersion: LATEST

                21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (

                PackageDeploymentServlet.java:execute:136

                ) PackageIsLatest: true

                21:52:05,713 INFO [STDOUT] INFO 04-06 21:52:05,713 (

                PackageDeploymentServlet.java:execute:137

                ) PackageIsSource: false

                21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (

                RepositoryServlet.java:allowUser:113

                ) admin authenticated for rest api

                21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (

                PackageDeploymentServlet.java:execute:134

                ) PackageName: s4testing

                21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (

                PackageDeploymentServlet.java:execute:135

                ) PackageVersion: LATEST

                21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (

                PackageDeploymentServlet.java:execute:136

                ) PackageIsLatest: true

                21:52:05,886 INFO [STDOUT] INFO 04-06 21:52:05,886 (

                PackageDeploymentServlet.java:execute:137

                ) PackageIsSource: false

                21:52:05,917 ERROR [CommandDelegate] jbpm.console.directory property not found

                21:52:05,964 INFO [Configuration] Reading mappings from resource : META-INF/JBPMorm.xml

                21:52:05,979 INFO [QueryBinder] Binding Named query: ProcessInstancesWaitingForEvent => select processInstanceInfo.processInstanceId from ProcessInstanceInfo processInstanceInfo join processInstanceInfo.eventTypes eventTypes where eventTypes = :type

                21:52:05,979 INFO [AnnotationBinder] Binding entity from annotated class: org.jbpm.persistence.processinstance.ProcessInstanceInfo

                21:52:05,979 INFO [EntityBinder] Bind entity org.jbpm.persistence.processinstance.ProcessInstanceInfo on table ProcessInstanceInfo

                21:52:05,979 INFO [AnnotationBinder] Binding entity from annotated class: org.drools.persistence.info.SessionInfo

                21:52:05,979 INFO [EntityBinder] Bind entity org.drools.persistence.info.SessionInfo on table SessionInfo

                21:52:05,979 INFO [AnnotationBinder] Binding entity from annotated class: org.drools.persistence.info.WorkItemInfo

                21:52:05,979 INFO [EntityBinder] Bind entity org.drools.persistence.info.WorkItemInfo on table WorkItemInfo

                21:52:05,995 INFO [HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.

                21:52:05,995 INFO [NamingHelper] JNDI InitialContext properties:{}

                21:52:05,995 INFO [DatasourceConnectionProvider] Using datasource: java:jdbc/jbpmDS

                21:52:05,995 INFO [SettingsFactory] RDBMS: PostgreSQL, version: 8.3.5

                21:52:05,995 INFO [SettingsFactory] JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.3devel JDBC4 with SSL (build 601)

                21:52:05,995 INFO [Dialect] Using dialect: org.hibernate.dialect.PostgreSQLDialect

                21:52:05,995 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory

                21:52:05,995 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup

                21:52:05,995 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup

                21:52:05,995 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled

                21:52:05,995 INFO [SettingsFactory] Automatic session close at end of transaction: disabled

                21:52:05,995 INFO [SettingsFactory] JDBC batch size: 15

                21:52:05,995 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled

                21:52:05,995 INFO [SettingsFactory] Scrollable result sets: enabled

                21:52:05,995 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled

                21:52:05,995 INFO [SettingsFactory] Connection release mode: auto

                21:52:05,995 INFO [SettingsFactory] Maximum outer join fetch depth: 3

                21:52:05,995 INFO [SettingsFactory] Default batch fetch size: 1

                21:52:05,995 INFO [SettingsFactory] Generate SQL with comments: disabled

                21:52:05,995 INFO [SettingsFactory] Order SQL updates by primary key: disabled

                21:52:05,995 INFO [SettingsFactory] Order SQL inserts for batching: disabled

                21:52:05,995 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory

                21:52:05,995 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory

                21:52:05,995 INFO [SettingsFactory] Query language substitutions: {}

                21:52:05,995 INFO [SettingsFactory] JPA-QL strict compliance: enabled

                21:52:05,995 INFO [SettingsFactory] Second-level cache: enabled

                21:52:05,995 INFO [SettingsFactory] Query cache: disabled

                21:52:05,995 INFO [SettingsFactory] Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory

                21:52:05,995 INFO [SettingsFactory] Optimize cache for minimal puts: disabled

                21:52:05,995 INFO [SettingsFactory] Structured second-level cache entries: disabled

                21:52:05,995 INFO [SettingsFactory] Statistics: disabled

                21:52:05,995 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled

                21:52:05,995 INFO [SettingsFactory] Default entity-mode: pojo

                21:52:05,995 INFO [SettingsFactory] Named query checking : enabled

                21:52:06,010 INFO [SessionFactoryImpl] building session factory

                21:52:06,010 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured

                21:52:06,010 INFO [SchemaUpdate] Running hbm2ddl schema update

                21:52:06,010 INFO [SchemaUpdate] fetching database metadata

                21:52:06,010 INFO [SchemaUpdate] updating schema

                21:52:06,057 INFO [TableMetadata] table found: public.eventtypes

                21:52:06,057 INFO [TableMetadata] columns: [element, instanceid]

                21:52:06,057 INFO [TableMetadata] foreign keys: [fkb0e5621f7665489a]

                21:52:06,057 INFO [TableMetadata] indexes: []

                21:52:06,088 INFO [TableMetadata] table found: public.processinstanceinfo

                21:52:06,088 INFO [TableMetadata] columns: [startdate, lastreaddate, state, processinstancebytearray, optlock, instanceid, processid, lastmodificationdate]

                21:52:06,088 INFO [TableMetadata] foreign keys: []

                21:52:06,088 INFO [TableMetadata] indexes: [processinstanceinfo_pkey]

                21:52:06,135 INFO [TableMetadata] table found: public.sessioninfo

                21:52:06,135 INFO [TableMetadata] columns: [rulesbytearray, id, startdate, optlock, lastmodificationdate]

                21:52:06,135 INFO [TableMetadata] foreign keys: []

                21:52:06,135 INFO [TableMetadata] indexes: [sessioninfo_pkey]

                21:52:06,166 INFO [TableMetadata] table found: public.workiteminfo

                21:52:06,166 INFO [TableMetadata] columns: [workitembytearray, name, workitemid, state, optlock, creationdate, processinstanceid]

                21:52:06,166 INFO [TableMetadata] foreign keys: []

                21:52:06,166 INFO [TableMetadata] indexes: [workiteminfo_pkey]

                21:52:06,166 INFO [SchemaUpdate] schema update complete

                21:52:06,166 INFO [NamingHelper] JNDI InitialContext properties:{}

                21:52:06,229 INFO [CommandDelegate] Loading session data ...

                21:52:07,992 INFO [PluginMgr] Successfully loaded plugin 'org.jboss.bpm.console.server.plugin.FormDispatcherPlugin': class org.jbpm.integration.console.forms.FormDispatcherComposite

                21:52:08,007 INFO [STDOUT] INFO 04-06 21:52:08,007 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,039 INFO [STDOUT] INFO 04-06 21:52:08,039 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,102 INFO [STDOUT] INFO 04-06 21:52:08,102 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,117 INFO [STDOUT] INFO 04-06 21:52:08,117 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,180 INFO [STDOUT] INFO 04-06 21:52:08,180 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,242 INFO [STDOUT] INFO 04-06 21:52:08,242 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,258 INFO [STDOUT] INFO 04-06 21:52:08,258 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (

                RepositoryServlet.java:allowUser:113

                ) admin authenticated for rest api

                21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (

                PackageDeploymentServlet.java:execute:134

                ) PackageName: s4testing

                21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (

                PackageDeploymentServlet.java:execute:135

                ) PackageVersion: LATEST

                21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (

                PackageDeploymentServlet.java:execute:136

                ) PackageIsLatest: true

                21:52:08,305 INFO [STDOUT] INFO 04-06 21:52:08,305 (

                PackageDeploymentServlet.java:execute:137

                ) PackageIsSource: true

                21:52:08,367 INFO [PluginMgr] Successfully loaded plugin 'org.jboss.bpm.console.server.plugin.GraphViewerPlugin': class org.jbpm.integration.console.graph.GraphViewerPluginImpl

                21:52:08,367 INFO [STDOUT] INFO 04-06 21:52:08,367 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,429 INFO [STDOUT] INFO 04-06 21:52:08,429 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,476 INFO [STDOUT] INFO 04-06 21:52:08,476 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,570 INFO [STDOUT] INFO 04-06 21:52:08,570 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,648 INFO [STDOUT] INFO 04-06 21:52:08,632 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,679 INFO [STDOUT] INFO 04-06 21:52:08,679 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,710 INFO [STDOUT] INFO 04-06 21:52:08,710 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,757 INFO [STDOUT] INFO 04-06 21:52:08,757 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,804 INFO [STDOUT] INFO 04-06 21:52:08,804 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,851 INFO [STDOUT] INFO 04-06 21:52:08,851 (

                NilAuthenticator.java:authenticate:35

                ) All users are guests.

                21:52:08,975 INFO [server] isRedirected -----start-------

                21:52:08,975 INFO [server] isRedirected status line ->HTTP/1.1 200 OK

                21:52:08,975 INFO [server] isRedirected -----start-------

                21:52:08,975 INFO [server] isRedirected status line ->HTTP/1.1 200 OK

                21:52:08,975 INFO [server] isRedirected Header ->no loaction

                21:52:08,975 INFO [server] isRedirected Headers

                21:52:08,975 INFO [server] Server = [Apache-Coyote/1.1]

                21:52:08,975 INFO [server] isRedirected Header Elements

                21:52:08,975 INFO [server] Apache-Coyote/1.1 = []

                21:52:08,975 INFO [server] Pragma = [No-cache]

                21:52:08,975 INFO [server] isRedirected Header Elements

                21:52:08,975 INFO [server] No-cache = []

                21:52:08,975 INFO [server] Cache-Control = [no-cache]

                21:52:08,975 INFO [server] isRedirected Header Elements

                21:52:08,975 INFO [server] no-cache = []

                21:52:08,975 INFO [server] Expires = [Thu, 01 Jan 1970 10:00:00 EST]

                21:52:08,975 INFO [server] isRedirected Header Elements

                21:52:08,975 INFO [server] Thu = []

                21:52:08,975 INFO [server] 01 Jan 1970 10:00:00 EST = []

                21:52:08,975 INFO [server] X-Powered-By = [Servlet 2.5; JBoss-5.0/JBossWeb-2.1]

                21:52:08,975 INFO [server] isRedirected Header Elements

                21:52:08,975 INFO [server] Servlet 2.5 = []

                21:52:08,975 INFO [server] Content-Type = [application/json]

                21:52:08,975 INFO [server] isRedirected Header Elements

                21:52:08,975 INFO [server] application/json = []

                21:52:08,975 INFO [server] Transfer-Encoding = [chunked]

                21:52:08,975 INFO [server] isRedirected Header Elements

                21:52:08,975 INFO [server] chunked = []

                21:52:08,975 INFO [server] Date = [Mon, 04 Jun 2012 11:52:08 GMT]

                21:52:08,975 INFO [server] isRedirected Header Elements

                21:52:08,975 INFO [server] Mon = []

                21:52:08,975 INFO [server] 04 Jun 2012 11:52:08 GMT = []

                21:52:08,975 INFO [server] isRedirected ------------

                21:52:08,975 INFO [server] isRedirected return 4=false

                21:52:08,975 INFO [server] Raw Response secHTTP/1.1 200 OK [Server: Apache-Coyote/1.1, Pragma: No-cache, Cache-Control: no-cache, Expires: Thu, 01 Jan 1970 10:00:00 EST, X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1, Content-Type: application/json, Transfer-Encoding: chunked, Date: Mon, 04 Jun 2012 11:52:08 GMT]

                21:52:08,975 INFO [server] start after sec:------>{"definitions":[{"id":"au.com.s4.cert","name":"User Registration","version":1,"packageName":"s4testing","deploymentId":"N/A","suspended":false,"formUrl":"http://localhost:8080/gwt-console-server/rs/form/process/au.com.s4.cert/render","diagramUrl":"http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/s4testing/LATEST/au.com.s4.cert-image.png"},{"id":"com.sample.evaluation","name":"Evaluation","version":0,"packageName":"defaultPackage","deploymentId":"N/A","suspended":false,"formUrl":"http://localhost:8080/gwt-console-server/rs/form/process/com.sample.evaluation/render","diagramUrl":http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/com.sample.evaluation-image.png}]}

                 

                 

                ull, falsecontent = requestPostService( targetHost, localcontext, serviceType, _callUrl,

                localcontext.setAttribute(ClientContext.AUTH_CACHE , authCache);

                • 5. Re: Problem with Rest Interface in JBPM 5.2
                  chandrasachin16 Newbie

                  Hi ,

                   

                  I have few questions.Which version of JBPM  are you using ? In my previous discussion I had discussed about error related to time out. I tried to investigate and found few things which I would like to put down.

                  My JBPM version is 5.2 and the url by which I was trying to authenticate was->         http://localhost:8080/gwt-console-server/rs/process/j_security_check

                  I checked the list of url available which are exposed by REST interface by using the url ->      http://localhost:8080/gwt-console-server/rs/server/resources/jbpm

                  The list is as given below:

                   

                  // List of url's ----------------------------------------------------------------------------- //

                  Server Info

                  General REST server information

                  GET    /gwt-console-server/rs/server/status        */*    application/json

                  GET    /gwt-console-server/rs/server/resources/{project}        */*    text/html

                   

                  Process Management

                  Process related data.

                  POST    /gwt-console-server/rs/process/definition/{id}/new_instance        */*    application/json

                  POST    /gwt-console-server/rs/process/instance/{id}/state/{next}        */*    application/json

                  GET    /gwt-console-server/rs/process/definition/{id}/image        */*    image/*

                  GET    /gwt-console-server/rs/process/instance/{id}/activeNodeInfo        */*    application/json

                  GET    /gwt-console-server/rs/process/definition/history/{id}/nodeInfo        */*    application/json

                  GET    /gwt-console-server/rs/process/definitions        */*    application/json

                  POST    /gwt-console-server/rs/process/definition/{id}/remove        */*    application/json

                  GET    /gwt-console-server/rs/process/definition/{id}/instances        */*    application/json

                  GET    /gwt-console-server/rs/process/instance/{id}/dataset        */*    text/xml

                  POST    /gwt-console-server/rs/process/instance/{id}/end/{result}        */*    application/json

                  POST    /gwt-console-server/rs/process/instance/{id}/delete        */*    application/json

                  POST    /gwt-console-server/rs/process/tokens/{id}/transition        */*    application/json

                  POST    /gwt-console-server/rs/process/tokens/{id}/transition/default        */*    application/json

                  GET    /gwt-console-server/rs/process/definition/{id}/image/{instance}        */*    image/*

                   

                  Task Lists

                  Access task lists

                  GET    /gwt-console-server/rs/tasks/{idRef}        */*    application/json

                  GET    /gwt-console-server/rs/tasks/{idRef}/participation        */*    application/json

                   

                  Task Management

                  Manage task instances

                  POST    /gwt-console-server/rs/task/{taskId}/assign/{ifRef}        */*    application/json

                  POST    /gwt-console-server/rs/task/{taskId}/release        */*    application/json

                  POST    /gwt-console-server/rs/task/{taskId}/close        */*    application/json

                  POST    /gwt-console-server/rs/task/{taskId}/close/{outcome}        */*    application/json

                   

                  User management

                  Manage user and groups

                  POST    /gwt-console-server/rs/identity/sid/invalidate        */*    text/plain

                  GET    /gwt-console-server/rs/identity/sid        */*    text/plain

                  GET    /gwt-console-server/rs/identity/secure/sid        */*    text/plain

                  GET    /gwt-console-server/rs/identity/user/roles        */*    application/json

                  GET    /gwt-console-server/rs/identity/user/{actorId}/groups/        */*    application/json

                  GET    /gwt-console-server/rs/identity/group/{groupName}/members        */*    application/json

                  GET    /gwt-console-server/rs/identity/user/{actorId}/actors        */*    application/json

                   

                  Process Engine

                  Process runtime state

                  GET    /gwt-console-server/rs/engine/deployments        */*    application/json

                  POST    /gwt-console-server/rs/engine/deployment/{id}/delete        */*    application/json

                  POST    /gwt-console-server/rs/engine/deployment/{id}/suspend        */*    application/json

                  GET    /gwt-console-server/rs/engine/jobs        */*    application/json

                  POST    /gwt-console-server/rs/engine/job/{id}/execute        */*    application/json

                  POST    /gwt-console-server/rs/engine/deployment/{id}/resume        */*    application/json

                   

                  Form Processing

                  Web based form processing

                  GET    /gwt-console-server/rs/form/task/{id}/render        */*    text/html

                  GET    /gwt-console-server/rs/form/process/{id}/render        */*    text/html

                  POST    /gwt-console-server/rs/form/task/{id}/complete        multipart/form-data    text/html

                  POST    /gwt-console-server/rs/form/process/{id}/complete        multipart/form-data    text/html

                  // End of list -----------------------------------//

                   

                  As per my understanding this list will also include the url for authentication but the  url    http://localhost:8080/gwt-console-server/rs/process/j_security_check

                  is not in the list given above.Correct me if I am wrong if this url is not listed in the list it is bound to give me a time out error(a url which does not exist).I saw the solution given by Jeff where he had used url some thing like

                  http://localhost:8080/gwt-console-server/rs/identity/secure/j_security_check".Both are different.

                  I did a simple thing I replaced my authentication url http://localhost:8080/gwt-console-server/rs/process/j_security_check

                  with the url ->    http://localhost:8080/gwt-console-server/rs/identity/secure/sid  and it did not gave any time out error ,but the response was a blank string which was the same as in case of the code which Chris showed .

                  My biggest query is how and from where do I confirm which is the correct url for form authentication and secondly once form authentication is successfull what should be the response string .In Chris code it was a blank string and following was the output---------------------

                   

                  start process1:------><html><head>  <title>HTTP 401</title> <!-- Do not remove --></head><body><form method="POST" action="j_security_check">  <center/>  <br><br>  <div style="font-family:sans-serif;border:1px solid black; width:270;padding:15px;">    <h2>BPM Console Server</h2>        <table with=250>    <tr>      <td>Username:</td>      <td><input type="text" name="j_username"></td>    </tr>    <tr>      <td>Password:</td>      <td><input type="password" name="j_password"></td>    </tr>    <tr>      <td></td>      <td align=right><input type="submit"/></td>    </tr>  </table>  </div></form></body></html>

                   

                  authentication2:------>

                   

                  start  process2:------>{"id":"104","definitionId":"yourProcessName","startDate":"2011-06-03  12:43:45","suspended":false,"rootToken":{"id":"1","name":"","currentNodeName":"","children":[],"availableSignals":[],"canBeSignaled":false}}

                   

                  start  process3:------>{"id":"105","definitionId":"yourProcessName","startDate":"2011-06-03  12:43:45","suspended":false,"rootToken":{"id":"2","name":"","currentNodeName":"","children":[],"availableSignals":[],"canBeSignaled":false}}

                   

                  start  process4:------>{"id":"106","definitionId":"yourProcessName","startDate":"2011-06-03  12:43:45","suspended":false,"rootToken":{"id":"3","name":"","currentNodeName":"","children":[],"availableSignals":[],"canBeSignaled":false}}

                   

                  I am struggling which url is the right one and why am I not able to see it in the list of url's in JBPM 5.2. Can you please help me out .

                  • 6. Re: Problem with Rest Interface in JBPM 5.2
                    Dirk Meyer Newbie

                    Here is some web sites for you to read - http://docs.oracle.com/javaee/1.4/tutorial/doc/Security5.html and http://docs.jboss.org/jbossas/jboss4guide/r5/html/ch8.chapter.html

                     

                    Basically in the gwt-console-server the rest services is expost and use form base authentications - so what happen is that you have called a secure web pages, and are redirected to a page to ask you your user credentials -

                    The authentication screen ask you to do a http "Post" on the submit to the j_security_check ( with the post you are forced to pass the j_username and j_password variables as parameters - in a get the call would habe looked something like this

                      http://localhost:8080/gwt-console-server/rs/process/j_security_check?j_username=admin&j_password=admin

                    you have to do this with on the same httpclient otherwise you will get a timeout.

                    So all Form base pages will have this behaviour..

                     

                     

                    in my code it look something like this

                     

                     

                    String secUrl = _jbpmRest+"/process/j_security_check";

                     

                     

                    logger.info("start sec url:------>"+secUrl+"\n\n\n\n");

                    content = authenticate(secUrl, _userId , _password);

                    _jbpmRest is the offset to http://localhost:8080/gwt-consoel-server/rs - this is not hard coded for obvious reasons

                    Basically if you are autheticated in a httpclient session then that authentication will be valid for the life of the session

                    _userid, and _password is the authentication credential for the user I am logged in as....

                    I know that you want to get started and build some workflows, but I can suggest that get a good grounding in j2ee web applications and there are a range of free internet resources available  to get started like the pages I suggest earlier. Or you can join Safari online and enjoy some of the online books they have available

                    I hope this help. .      

                    • 7. Re: Problem with Rest Interface in JBPM 5.2
                      chandrasachin16 Newbie

                      Hi ,

                       

                      Thanks for the valuable suggestion. Finally I managed to trigger my process.

                       

                      Regards

                      Sachin