cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti with persistent database (bug using mysql?)

pfeard
Champ in-the-making
Champ in-the-making
Hi,

I've tried everything now. My goal is to have one database for the activiti explorer and the activiti rest API, so that if I change something via rest I also could see it in the activiti explorer. I already tried two attempts:

1. I tried to run the h2 database in server mode. Therefore I gave the command
java -cp h2-1.3.171.jar org.h2.tools.Server -tcpPort 2962
and and replaced the jdbc url:
jdbc.url=jdbc:h2:tcp://localhost:2962/~/test
like described in this post: http://forums.activiti.org/content/how-configure-activiti-explorer-and-rest-use-same-database

But I always got the message that the class
org.h2.tools.Server
could not be found.

2. I created a persistent database in mysql using phpMyAdmin and the following code in both db.properties files:

db=mysql
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/activiti?autoReconnect=true
jdbc.username=root
jdbc.password=

The database works fine and with this attempt I reached my goal that I can use both, the activiti explorer and the rest API.
but unfortunately now the resource URLs don't work anymore. For Example if I list the process definitions, I get several entries like this:

{
            "id": "createTimersProcess:1:37",
            "url": "http://localhost:8080/activiti-rest/service/repository/process-definitions/createTimersProcess%3A1%3...",
            "key": "createTimersProcess",
            "version": 1,
            "name": "Create timers process",
            "description": "Test process to create a number of timers.",
            "deploymentId": "23",
            "deploymentUrl": "http://localhost:8080/activiti-rest/service/repository/deployments/23",
            "resource": "http://localhost:8080/activiti-rest/service/repository/deployments/23/resources/org%2Factiviti%2Fexp...",
            "diagramResource": null,
            "category": "Examples",
            "graphicalNotationDefined": false,
            "suspended": false,
            "startFormDefined": false
        }

But the resource URL
http://localhost:8080/activiti-rest/service/repository/deployments/23/resources/org%2Factiviti%2Fexp...
only responds with an Status 400 Bad Request.
If I compare the same behavior with an h2 database (only used by rest API and not by activiti explorer as described above), I get a resource URL like
http://localhost:8080/activiti-rest/service/repository/deployments/20/resources/VacationRequest.bpmn...
which works perfectly as far as I have a h2 database.

I would appreciate any help of this issue, or is this even a bug in combination with mysql?
13 REPLIES 13

jbarrez
Star Contributor
Star Contributor
How did you get both Explorer and Rest together?

The url seems to indicate

org%2Factiviti%2Fexplorer%2Fdemo%2Fprocess%2FcreateTimersProcess.bpmn20.xml

That somehow explorer is interfering with your REST install? Are these two separate wars?

MySQL doesnt have any influence on those urls whatsoever.

pfeard
Champ in-the-making
Champ in-the-making
You might be right, but how can I solve that?
I just copied and pasted the two wars <code>activiti-explorer.war</code> and <code>activiti-rest.war</code> in the webapps directory of my tomcat server.

I got a little further with my first attempt so that explorer and REST are using the same h2 database on a server. That means if I post e.g. a process instance via REST I see it on the explorer. But now the same issue occurs as if I use one MySQL Database. It's somehow interfering and I get those not working resource URLs.

Or does that mean, that I can't use REST and explorer with the same database without errors?

pfeard
Champ in-the-making
Champ in-the-making
Or is there a way to only have one *.war file which includes both, REST and explorer?

jbarrez
Star Contributor
Star Contributor
> Or does that mean, that I can't use REST and explorer with the same database without errors?

No, that works for sure.

> Or is there a way to only have one *.war file which includes both, REST and explorer?

Yes, but it shouldn't be. It should work out of the box.

What is in your database? More specifically the ACT_GE_BYTEARRAY and ACT_RE_DEPLOYMENT ?

pfeard
Champ in-the-making
Champ in-the-making
In ACT_GE_BYTEARRAY the NAME_ column looks good, like <code>org/activiti/explorer/demo/process/VacationRequest.bpmn20.xml</code> and in ACT_RE_DEPLOYMENT I have two entries: Demo processes and Demo reports. But still I get the not working resource URLs via REST with the %2F…

jbarrez
Star Contributor
Star Contributor
OK, im officially really puzzled now. really don't have a clue :s

Could you post the REST http request you do to get the data here? Maybe there is something off there (although i dont think so)

alfheim
Champ in-the-making
Champ in-the-making
I've got the same problem.
Activiti version: 5.15.1
Tomcat version: 7.0.54

First I try with H2
http://192.168.56.150:8080/activiti-rest/service/repository/process-definitions

{
           "id": "fixSystemFailure:1:35",
           "url": "http://192.168.56.150:8080/activiti-rest/service/repository/process-definitions/fixSystemFailure%3A1...",
           "key": "fixSystemFailure",
           "version": 1,
           "name": "Fix system failure",
           "description": null,
           "deploymentId": "20",
           "deploymentUrl": "http://192.168.56.150:8080/activiti-rest/service/repository/deployments/20",
           "resource": "http://192.168.56.150:8080/activiti-rest/service/repository/deployments/20/resources/FixSystemFailur...",
           "diagramResource": "http://192.168.56.150:8080/activiti-rest/service/repository/deployments/20/resources/FixSystemFailur...",
           "category": "Examples",
           "graphicalNotationDefined": false,
           "suspended": false,
           "startFormDefined": false
       },
      
GET http://192.168.56.150:8080/activiti-rest/service/repository/deployments/20/resources/FixSystemFailur...


    {
       "id": "FixSystemFailureProcess.png",
       "url": "http://192.168.56.150:8080/activiti-rest/service/repository/deployments/20/resources/FixSystemFailur...",
       "contentUrl": "http://192.168.56.150:8080/activiti-rest/service/repository/deployments/20/resourcedata/FixSystemFai...",
       "mediaType": "image/png",
       "type": "resource"
    }

GET http://192.168.56.150:8080/activiti-rest/service/repository/deployments/20/resourcedata/FixSystemFai...
Image OK

Then I configure mysql db
lib: mysql-connector-java-5.1.31-bin.jar

file db.properties
db=mysql
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/activiti
jdbc.username=activiti
jdbc.password=Password1

cp /root/db.properties /usr/local/tomcat/webapps/activiti-explorer/WEB-INF/classes/
cp /root/db.properties /usr/local/tomcat/webapps/activiti-rest/WEB-INF/classes/

http://192.168.56.150:8080/activiti-rest/service/repository/process-definitions

{
           "id": "fixSystemFailure:1:35",
           "url": "http://192.168.56.150:8080/activiti-rest/service/repository/process-definitions/fixSystemFailure%3A1...",
           "key": "fixSystemFailure",
           "version": 1,
           "name": "Fix system failure",
           "description": null,
           "deploymentId": "23",
           "deploymentUrl": "http://192.168.56.150:8080/activiti-rest/service/repository/deployments/23",
           "resource": "http://192.168.56.150:8080/activiti-rest/service/repository/deployments/23/resources/org%2Factiviti%...",
           "diagramResource": "http://192.168.56.150:8080/activiti-rest/service/repository/deployments/23/resources/org%2Factiviti%...",
           "category": "Examples",
           "graphicalNotationDefined": false,
           "suspended": false,
           "startFormDefined": false
       },
      
GET http://192.168.56.150:8080/activiti-rest/service/repository/deployments/23/resources/org%2Factiviti%...


    Status Code: 400 Bad Request
    Connection: close
    Content-Length: 0
    Date: Thu, 03 Jul 2014 04:52:42 GMT
    Server: Apache-Coyote/1.1

Then I try to use the same url format as H2
GET http://192.168.56.150:8080/activiti-rest/service/repository/deployments/23/resources/FixSystemFailur...


    Status Code: 404 Not Found
    Accept-Ranges: bytes
    Content-Length: 78
    Content-Type: application/json;charset=UTF-8
    Date: Thu, 03 Jul 2014 04:54:14 GMT
    Server: Restlet-Framework/2.1.4
    Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept


Hope this helps

Cheers

Hi,

I do not have answer, but I ask more questions 🙂 :
1. Is there any stack trace?
2. Did you try to debug rest service?

Regards
Martin

No  stack trace, logs are clean

Can you tell me how to debug rest service?