Bonjour,
je tente d'écrire un Web service afin de communiquer avec jBPM. J'arrive a créer le service, et à lancer une instance de jBPM. Cependant, je n'arrive pas à faire marcher la persistance (sauvegarde de l'état du token dans la BDD).
Je mesuis pourtant largement inspiré d'un tuto, voici ma classe :
Dans mon log, j'ai :
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149 package ****; import java.util.List; import org.jbpm.JbpmConfiguration; import org.jbpm.JbpmContext; import org.jbpm.db.GraphSession; import org.jbpm.graph.def.ProcessDefinition; import org.jbpm.graph.exe.ProcessInstance; import org.jbpm.graph.exe.Token; public class JbpmDb { static JbpmConfiguration jbpmConfiguration = null; static { jbpmConfiguration = JbpmConfiguration.parseResource("config/jbpm.cfg.xml"); } public void setUp() { jbpmConfiguration.createSchema(); } public void tearDown() { jbpmConfiguration.dropSchema(); } public void testSimplePersistence() { deployProcessDefinition(); System.out.println("Process definition finished !"); processInstanceIsCreatedWhenUserSubmitsWebappForm(); theProcessInstanceContinuesWhenAnAsyncMessageIsReceived(); tearDown(); } public void deployProcessDefinition() { System.out.println("Deploying Process definition..."); ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("simple/processdefinition.xml"); System.out.println("Parse XML done !"); JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); System.out.println("jBPM context created !"); try { // Deploy the process definition in the database jbpmContext.deployProcessDefinition(processDefinition); System.out.println("Process definition deployed..."); } finally { jbpmContext.close(); System.out.println("jBPM context closed..."); } } public void processInstanceIsCreatedWhenUserSubmitsWebappForm() { System.out.println("Entering processInstanceIsCreatedWhenUserSubmitsWebappForm..."); JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); System.out.println("jBPM context created !"); try { GraphSession graphSession = jbpmContext.getGraphSession(); System.out.println("got the graphsession !"); ProcessDefinition processDefinition = graphSession.findLatestProcessDefinition("hello world"); System.out.println("Process definition found 'hello world'"); ProcessInstance processInstance = new ProcessInstance(processDefinition); System.out.println("process instance created"); Token token = processInstance.getRootToken(); System.out.println("nom du token actif : "+token.getNode().getName()); token.signal(); System.out.println("nom du token actif : "+token.getNode().getName()); jbpmContext.save(processInstance); } finally { // Tear down the pojo persistence context. jbpmContext.close(); } } public void theProcessInstanceContinuesWhenAnAsyncMessageIsReceived() { System.out.println("Entering theProcessInstanceContinuesWhenAnAsyncMessageIsReceived..."); JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { GraphSession graphSession = jbpmContext.getGraphSession(); ProcessDefinition processDefinition = graphSession.findLatestProcessDefinition("hello world"); List processInstances = graphSession.findProcessInstances(processDefinition.getId()); ProcessInstance processInstance = (ProcessInstance) processInstances.get(0); Token token = processInstance.getRootToken(); processInstance.signal(); System.out.println("nom du token actif : "+token.getNode().getName()); jbpmContext.save(processInstance); } finally { jbpmContext.close(); } } }
Et là ça bloque, ça ne va pas plus loin
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 Deploying Process definition... 23 févr. 2009 10:59:00 org.jbpm.JbpmConfiguration getInstance INFO: using jbpm configuration resource 'jbpm.cfg.xml' Parse XML done ! jBPM context created ! jBPM context closed...
Une idée ?
Partager