[JBoss jBPM] - Probleme with update field
by turpin_vincent
hi,
I'm using JBPM in seam 2.1.1
I' trying to update value in a datatable from an input text, but i've got a probleme. In fact i've got an entity called "sinstre" witch is scoped like that:
@In(scope = ScopeType.BUSINESS_PROCESS, required = false)
| @Out(scope = ScopeType.BUSINESS_PROCESS, required = false)
| private Sinistre sinistre;
In my XHTML page, ive got a Form:
| <h:form id="InfosVoiture">
|
| <h:outputText value="Il n'y a pas de sinistre a renseigner pour le moment" rendered="#{empty taskInstancePriorityList}"/>
|
| <rich:panel>
| <f:facet name="header">Lsite des sinistre comportant une partie materiel </f:facet>
| <h:dataTable value="#{taskInstancePriorityList}"
| var="task" rendered="#{not empty taskInstancePriorityList}"
| bgcolor="#F1F1F1" border="10">
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="Creation"/>
| </f:facet>
| <h:outputText value="#{task.taskMgmtInstance.processInstance.start}">
| <s:convertDateTime type="date"/>
| </h:outputText>
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="Employe"/>
| </f:facet>
| <h:outputText value="#{task.actorId}"/> <br />
| </h:column> $
| <h:column>
| <f:facet name="header">
| <h:outputText value="task"/>
| </f:facet>
| <h:outputText value="#{task.name}"/> <br />
| </h:column>
| <h:column>
| <f:facet name="header">
| <h:outputText value="Id du sinistre" />
| </f:facet>
| <h:outputText value="#{task.variables['sinistre'].idSinistre}" /> <br />
| </h:column>
| <h:column>
| <f:facet name="header">
| <h:outputText value="Nom du client"/>
| </f:facet>
| <h:outputText value="#{task.variables['sinistre'].nomClient}" /> <br />
| </h:column>
| <h:column>
| <f:facet name="header">
| <h:outputText value="Prenom du client"/>
| </f:facet>
| <h:outputText value="#{task.variables['sinistre'].prenomClient}"/> <br />
| </h:column>
| <h:column>
| <f:facet name="header">
| <h:outputText value="Corporel"/>
| </f:facet>
| <h:outputText value="#{task.variables['sinistre'].sinistreCorporel}"/> <br />
| </h:column>
| <h:column>
| <f:facet name="header">
| <h:outputText value="Materiel"/>
| </f:facet>
| <h:outputText value="#{task.variables['sinistre'].sinistreMateriel}"/> <br />
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="Voiture task"/>
| </f:facet>
| <h:outputText value="#{task.variables['sinistre'].typeVoiture}"/> <br />
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="Voiture"/>
| </f:facet>
| <h:outputText value="#{Saisie_1.sinistre.typeVoiture}"/> <br />
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="type de Voiture"/>
| </f:facet>
| <h:inputText id="typeVoiture" value="#{Saisie_1.sinistre.typeVoiture}"/>
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="type de Voiture task"/>
| </f:facet>
| <h:inputText id="typeVoitureTask" value="#{task.variables['sinistre'].typeVoiture}"/>
| </h:column>
|
| <h:column>
| <s:button action="#{Saisie_1.test}" taskInstance="#{task}" value="autoriser modif" />
| </h:column>
|
| <h:column>
| <s:button action="updated" taskInstance="#{task}" value="update" />
| </h:column>
|
| <h:column>
| <s:button value="ajouter" taskInstance="#{task}" action="#{Saisie_1.Ajout_Mat(Saisie_1.sinistre.typeVoiture)}">
| </s:button>
| </h:column>
| <h:column>
| <s:button value="afficher" taskInstance="#{task}" action="#{Saisie_1.AfficherVariables}">
| </s:button>
| </h:column>
|
| </h:dataTable>
| <div>
| <h:commandButton value="Mise a jour des champs" action="update" rendered="#{not empty taskInstanceList}"/>
| </div>
I tried many way to update a value in my entity from an input text in the datatable. the only way i find (with done what i want) is starting a task with a button, then use a <h:commandButton value="Mise a jour des champs" action="update" rendered="#{not empty taskInstanceList}"/> and then use an other button to end the task (and merge the value in an other database but that's not the actual probleme).But it's a very ugly way.
So can someone tell me how can i do that in a better way and if i sould use a s:button or something like that.
BTW, i know that in my XHTML file there is many useless field but i use it in order test some ways and see many thing.
thx by advance
In addition i would like to know how i can start a task automatically when it's created, i try with:
<task-node name="Saisie_materiel">
| <task name="RemplirMat">
| <event type="task-create">
| <action>Saisir_1.test</action>
| </event>
| <assignment actor-id="#{actor.id}"/>
| </task>
| <transition to="join" name="toJoin2"></transition>
| </task-node>
but it dont seem to work
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221287#4221287
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221287
17 years
[JBoss jBPM] - Problems with JBPM Ttimer EJB from a simple Web App
by Toriton
Hi all i have a strange problem to navigate a process from a servlet.
The servlet is simple , it get as input the id of the process, and the name of transition where it have to go for the next token or node.
The names transitions's are sended with radio buttons and the values inside them come from iterating the Map : mynode.getLeavingTransitionsMap().
Now the problem is this exception:
| 2009-03-26 11:42:05,463 DEBUG [org.jbpm.graph.def.GraphElement] executing action 'action[MailSender]'
| 2009-03-26 11:42:05,463 DEBUG [org.jbpm.graph.exe.Token] token[12252] is locked by token[12252]
| 2009-03-26 11:42:05,463 DEBUG [org.hibernate.impl.SessionImpl] initializing proxy: [org.jbpm.graph.node.State#11131]
| 2009-03-26 11:42:05,463 DEBUG [org.jbpm.graph.def.GraphElement] event 'timer-create' on 'State(inagenzia)' for 'Token(/)'
| 2009-03-26 11:42:05,463 DEBUG [org.jbpm.graph.exe.Token] token[12252] is unlocked by token[12252]
| 2009-03-26 11:42:05,463 ERROR [org.jbpm.graph.def.GraphElement] action threw exception: ejb timer entity lookup problem
| org.jbpm.JbpmException: ejb timer entity lookup problem
| at org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory.getTimerEntityHome(EntitySchedulerServiceFactory.java:45)
| at org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory.openService(EntitySchedulerServiceFactory.java:62)
| at org.jbpm.svc.Services.getService(Services.java:177)
| at org.jbpm.svc.Services.getCurrentService(Services.java:98)
| at org.jbpm.svc.Services.getCurrentService(Services.java:89)
| at org.jbpm.scheduler.def.CreateTimerAction.execute(CreateTimerAction.java:79)
| at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:284)
| at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:241)
| at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:213)
| at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:196)
| at org.jbpm.graph.def.Node.enter(Node.java:371)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
| at org.jbpm.graph.def.Node_$$_javassist_49.enter(Node_$$_javassist_49.java)
| at org.jbpm.graph.def.Transition.take(Transition.java:167)
| at org.jbpm.graph.def.Node.leave(Node.java:479)
| at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:155)
| at org.jbpm.graph.node.Decision.execute(Decision.java:194)
| at org.jbpm.graph.def.Node.enter(Node.java:390)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
| at org.jbpm.graph.def.Node_$$_javassist_49.enter(Node_$$_javassist_49.java)
| at org.jbpm.graph.def.Transition.take(Transition.java:167)
| at org.jbpm.graph.def.Node.leave(Node.java:479)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
| at org.jbpm.graph.def.Node_$$_javassist_49.leave(Node_$$_javassist_49.java)
| at org.jbpm.graph.exe.Token.signal(Token.java:223)
| at org.jbpm.graph.exe.Token.signal(Token.java:180)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
| at org.jbpm.graph.exe.Token_$$_javassist_65.signal(Token_$$_javassist_65.java)
| at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:319)
| at it.test.servlet.CallserServlet.doGet(CallserServlet.java:63)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: javax.naming.NameNotFoundException: ejb not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:774)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory.lookup(EntitySchedulerServiceFactory.java:54)
| at org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory.getTimerEntityHome(EntitySchedulerServiceFactory.java:43)
| ... 65 more
|
I tried retrieving the process instance with:
| JbpmContext.getProcessInstance(long);
| JbpmContext.getProcessInstanceForUpdate(long);
| JbpmContext.loadProcessInstance(long);
|
The exception is thrown in any case, but if i use the console for the same transition, the exception is not thrown. And after that i used the console , i can use the servlet as well and no more exceptions will be thrown, using the signal() o signal(transitionName).
I don't know how, but seem that there is something not initialized by me in the Servlet , instead the console of JBPM create something that i'm missing.
here part of the code of the servlet :
| JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
| JbpmContext ctx = jbpmConfiguration.createJbpmContext();
| ProcessInstance pInst = ctx.getProcessInstanceForUpdate(Long.parseLong(id));
| pInst.signal(transitionName);
|
could anyone help please?.
Thanks in advance.
T.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221229#4221229
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221229
17 years
[JBoss jBPM] - Re: JEE AS / jBPM / Exception when Oracle DB is restarted
by gchanteb
Hi, thx for your answer but i have configured my EJB-timers to use the same DB than jBPM (Oracle XA).
I solved my problem at test 3- using new thin drivers for Oracle: ojdbc5.jar insted of ojdbc14.jar in my JEE AS. They are able to reconnect to DB.
I have a new problem: When I have an exception using timers (When my jBPM Oracle DB is down, process cannot be updated, so there is an exception), they doesn't work any more, even if i put a repeat attribute.
So:
t=0 sec: I launch my process with a timer action at 60 seconds and a repeat of 60 seconds...
t=20 sec: I shutdown my DB.
t=60 sec: There is an exception of my timer because my DB is down, logic.
t=80 sec: I restart my DB. Reconnection is OK.
t=120 sec: My timer doesn't repeat itself.
The behaviour is the same even if i don't restart my DB...
(If my DB is started, the repeat works, don't worry i checked this ;-))
So, my problem is: Why the timer doesn't repeat itself? Note that if i restart my AS, the timer "re-works". If i restart my timer-service under JMX console of JBoss, the timer "re-works" too.
I would that they works without doing one of these things...
Thx.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221228#4221228
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221228
17 years
[JBoss jBPM] - Re: Recommended way to purge finished process instances
by bradsdavis
Hello. I have created a POJO JMX MBean that uses the jBPM API to do something similar.
Compiling this will produce a JAR. Put that JAR into the deploy directory of the server, where the jBPM libraries are also on the server's classpath. If you bring up the JMX management console, you should find the JbpmManagementBean. There, you will find some convenience method to cleanup old processes and process instances.
Cheers.
See below:
| package com.amentra.support.jmx.jbpm.management;
| import java.math.BigDecimal;
| import java.util.Calendar;
| import java.util.Date;
| import java.util.List;
|
| import org.apache.commons.logging.Log;
| import org.apache.commons.logging.LogFactory;
| import org.hibernate.Query;
| import org.hibernate.Session;
| import org.jboss.annotation.ejb.Management;
| import org.jboss.annotation.ejb.Service;
| import org.jbpm.JbpmConfiguration;
| import org.jbpm.JbpmContext;
| import org.jbpm.graph.def.ProcessDefinition;
| import org.jbpm.graph.exe.ProcessInstance;
|
| @Service
| @Management(JbpmManagement.class)
| public class JbpmManagementBean implements JbpmManagement {
| private static final Log log = LogFactory.getLog(JbpmManagementBean.class);
| JbpmConfiguration configuration = null;
|
| /* (non-Javadoc)
| * @see com.ccna.jmx.jbpm.management.JbpmManagement#removeAllProcessesBefore(java.util.Date)
| */
| public void removeAllProcessesBefore(Date date)
| {
| if (log.isDebugEnabled()) {
| log.debug("Removing all processes before: "+date);
| }
|
| if(configuration==null)
| {
| configuration = JbpmConfiguration.getInstance();
| }
| JbpmContext context = configuration.createJbpmContext();
|
| try{
| Session hibernateSession = context.getSession();
| Query processQuery = hibernateSession.createQuery("from org.jbpm.graph.exe.ProcessInstance pi where pi.start < :removalDate");
| processQuery.setParameter("removalDate", date);
|
| List<ProcessInstance> instances = processQuery.list();
|
| if(instances!=null&&instances.size()>0)
| {
| if (log.isDebugEnabled()) {
| log.debug("Total number of processes to remove: "+instances.size());
| }
| for(ProcessInstance instance : instances)
| {
| if (log.isDebugEnabled()) {
| log.debug("Removing process instance: "+instance.getId());
| }
| //Loop over the instances and remove them.
| context.getGraphSession().deleteProcessInstance(instance);
| }
| }
| else
| {
| log.debug("No instances found to remove.");
| }
| }
| finally {
| context.close();
| }
|
| log.debug("Completed removal process.");
|
| }
|
| /* (non-Javadoc)
| * @see com.ccna.jmx.jbpm.management.JbpmManagement#create()
| */
| public void create() throws Exception {
| log.debug("Creating Jbpm Management JMX bean.");
| }
|
| /* (non-Javadoc)
| * @see com.ccna.jmx.jbpm.management.JbpmManagement#destroy()
| */
| public void destroy() {
| log.debug("Destroying Jbpm Manangement JMX bean.");
| }
|
| public void removeAllProcessesThreeYearsOld() {
| //Get todays date.
| Calendar c = Calendar.getInstance();
| c.setTime(new Date());
| c.add(Calendar.YEAR, -3);
|
| Date threeYearsAgoFromToday = c.getTime();
|
| removeAllProcessesBefore(threeYearsAgoFromToday);
|
| }
|
| @Override
| public void removeAllProcessesBeforeToday() {
| //Get todays date.
| Calendar c = Calendar.getInstance();
| c.setTime(new Date());
| c.add(Calendar.DAY_OF_MONTH, -1);
|
| Date threeYearsAgoFromToday = c.getTime();
|
| removeAllProcessesBefore(threeYearsAgoFromToday);
| }
|
| @Override
| public void removeAllOldProcessDefinitions() {
| if (log.isDebugEnabled()) {
| log.debug("Removing all old versionned process definitions. Cascading.");
| }
|
| if(configuration==null)
| {
| configuration = JbpmConfiguration.getInstance();
| }
| JbpmContext context = configuration.createJbpmContext();
|
| try{
| Session hibernateSession = context.getSession();
|
| Query query = hibernateSession.createSQLQuery("select q2.id_ from (select name_,max(version_) as max_version from jbpm_processdefinition group by name_) q1, "+
| "(select id_,name_,version_ from jbpm_processdefinition) q2 "+
| "where q2.name_ = q1.name_ AND q2.version_ <> q1.max_version");
|
| List<BigDecimal> definitions = query.list();
|
| if(definitions!=null)
| {
| if (log.isDebugEnabled()) {
| log.debug("Found "+definitions.size()+" definitions to remove.");
|
| for(BigDecimal definitionId : definitions)
| {
| if (log.isDebugEnabled()) {
| log.debug("Removing definition: "+definitionId);
| }
| ProcessDefinition definition = context.getGraphSession().getProcessDefinition(definitionId.longValue());
|
| if (log.isDebugEnabled()) {
| log.debug(" + Definition Name: "+definition.getName()+", Version: "+definition.getVersion());
| }
|
| context.getGraphSession().deleteProcessDefinition(definition);
| }
| }
| }
| else
| {
| log.debug("No old process definitions found to remove.");
|
| }
|
| }
| finally {
| context.close();
| }
|
| log.debug("Completed removal process.");
|
| }
|
| }
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221078#4221078
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221078
17 years