Bonjour,
Je suis entrain de faire quelques petits exemples pour découvrir jBPM pour une utilisation future. Je m'attaque pour l'instant à la partie persitence des données en me basant sur les exemples fournis... Mais là, problème lorsque je veux déployer un ProcessDefinition... J'obtient l'exception no jbpm tx service configured. Exception que je n'ai pas quand j'utilise la version 3.1.3 de jBPM. Quelqu'un aurait-il déjà eu (et/ou solutionné) ce problème en 3.4? ou est-ce vraiment du à un problème de la 3.4 ?
Le schéma est bien créé dans la db donc j'imagine que tout ce qui est hibernate doit fonctionner.
Le "code" :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 public class TestPersistence { static JbpmConfiguration jbpmConfiguration = null; static { // An example configuration file such as this can be found in // 'src/config.files'. Typically the configuration information is in the // resource file 'jbpm.cfg.xml', but here we pass in the configuration // information as an XML string. // First we create a JbpmConfiguration statically. One JbpmConfiguration // can be used for all threads in the system, that is why we can safely // make it static. jbpmConfiguration = JbpmConfiguration.parseXmlString( "<jbpm-configuration>" + // A jbpm-context mechanism separates the jbpm core // engine from the services that jbpm uses from // the environment. " <jbpm-context>" + " <service name='persistence' " + " factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" + " </jbpm-context>" + // Also all the resource files that are used by jbpm are // referenced from the jbpm.cfg.xml " <string name='resource.hibernate.cfg.xml' value='hibernate.cfg.xml' />" + "</jbpm-configuration>" ); } public TestPersistence(){ jbpmConfiguration.createSchema(); deployProcessDefinition(); } public void deployProcessDefinition() { DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration .getServiceFactory(Services.SERVICENAME_PERSISTENCE); if(dbPersistenceServiceFactory == null){ System.out.println("DB FACTORY IS NULL"); } // This test shows a process definition and one execution // of the process definition. The process definition has // 3 nodes: an unnamed start-state, a state 's' and an // end-state named 'end'. ProcessDefinition processDefinition = ProcessDefinition .parseXmlString("<process-definition name='hello world'>" + " <start-state name='start'>" + " <transition to='s' />" + " </start-state>" + " <state name='s'>" + " <transition to='end' />" + " </state>" + " <end-state name='end' />" + "</process-definition>"); // Lookup the pojo persistence context-builder that is configured above JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { // Deploy the process definition in the database jbpmContext.deployProcessDefinition(processDefinition); } finally { // Tear down the pojo persistence context. // This includes flush the SQL for inserting the process definition // to the database. jbpmContext.close(); } } public static void main (String ... args ){ new TestPersistence(); System.out.println("DONE"); }
Les traces :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 ... 11:35:55,093 [main] DEBUG JbpmContext : creating org.jbpm.JbpmContext@116318b 11:35:55,093 [main] DEBUG DbPersistenceServiceFactory : creating persistence service 11:35:55,093 [main] DEBUG DbPersistenceService : creating hibernate session 11:35:55,140 [main] DEBUG DbPersistenceService : beginning hibernate transaction 11:35:55,249 [main] DEBUG JbpmContext : closing JbpmContext 11:35:55,249 [main] DEBUG Services : closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@ac06d4 org.jbpm.JbpmException: no jbpm tx service configured at org.jbpm.persistence.db.DbPersistenceService.isRollbackOnly(DbPersistenceService.java:388) at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:210) at org.jbpm.svc.Services.close(Services.java:222) at org.jbpm.JbpmContext.close(JbpmContext.java:139) at mytests.TestPersistence.deployProcessDefinition(TestPersistence.java:87) at mytests.TestPersistence.<init>(TestPersistence.java:50) at mytests.TestPersistence.main(TestPersistence.java:94) 11:35:55,280 [main] ERROR Services : problem closing service 'persistence' org.jbpm.JbpmException: no jbpm tx service configured at org.jbpm.persistence.db.DbPersistenceService.isRollbackOnly(DbPersistenceService.java:388) at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:210) at org.jbpm.svc.Services.close(Services.java:222) at org.jbpm.JbpmContext.close(JbpmContext.java:139) at mytests.TestPersistence.deployProcessDefinition(TestPersistence.java:87) at mytests.TestPersistence.<init>(TestPersistence.java:50) at mytests.TestPersistence.main(TestPersistence.java:94) Exception in thread "main" org.jbpm.JbpmException: problem closing services {persistence=org.jbpm.JbpmException: no jbpm tx service configured} at org.jbpm.svc.Services.close(Services.java:235) at org.jbpm.JbpmContext.close(JbpmContext.java:139) at mytests.TestPersistence.deployProcessDefinition(TestPersistence.java:87) at mytests.TestPersistence.<init>(TestPersistence.java:50) at mytests.TestPersistence.main(TestPersistence.java:94) Caused by: org.jbpm.JbpmException: no jbpm tx service configured at org.jbpm.persistence.db.DbPersistenceService.isRollbackOnly(DbPersistenceService.java:388) at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:210) at org.jbpm.svc.Services.close(Services.java:222) ... 4 more
Partager