[JBoss jBPM] - Pattern 14 (ForEachActionHandler) and process-state
by starbuxman
Hi all
I'm trying to create an iterated subprocess (basically, pattern 14
http://www.workflowpatterns.com/patterns/control/multiple_instance/wcp14.php ). I found http://wiki.jboss.org/wiki/attach?page=ForEachForkActionHandler%2FForEach...
which provides the ability to, on a node, specify that all leaving transitions are looped 'for each' item in a list. This works as expected with a simple node that as some script. i havent checked how it fares for task-nodes (which, invariably) is what i want.
What im trying to do is spawn a sub process for each item in the list.
I have the leaving transition wired to a process-state node which and that fails as the ForEachActionHandler.java gets to calling leave().
Simple nodes: fine
Process-state nodes: not so good.
Below are my 2 process definitions.
|
| <process-definition name="foreach2">
|
| <start-state name="start">
| <transition to="foreachfork" />
| </start-state>
|
| <node name="foreachfork">
| <action class="com.my.test.workflow.util.ForEachActionHandler"
| config-type="bean">
| <listVariable>assets</listVariable>
| <as>asset</as>
| </action>
| <transition name="foreach2_sub" to="foreach2_sub"/>
| </node>
|
| <process-state name="foreach2_sub">
| <sub-process name="foreach2_sub" />
| <variable name="asset" access="read,write" mapped-name="asset" />
| <transition to="joinforeach" />
| </process-state>
|
| <join name="joinforeach">
| <transition to="end"/>
| </join>
|
| <end-state name="end"/>
|
|
| </process-definition>
|
| <process-definition name="foreach2_sub">
| <start-state name="start">
| <transition to="one" />
| </start-state>
|
| <node name="one">
| <script>
| System.out.println("foreach2_sub one: " + asset);
| </script>
| <transition to="two"/>
| </node>
| <node name="two">
| <script>
| System.out.println("foreach2_sub two: " + asset);
| </script>
| <transition to="end"/>
| </node>
|
| <end-state name="end"/>
| </process-definition>
|
Thank you for any help,
Josh Long
Sun Certified Java Programmer
http://www.joshlong.com
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4092285#4092285
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4092285
18Â years, 6Â months
[JBoss Seam] - Re-working EJB Extended Context To Use SMPC - Need Help
by curtney
I have a read number of posts that indicates it is possible to have the following architecture listed below, however, putting @Name on the abstract class throws an IllegalArgumentException. If I remove @Name annotation from the abstract class, then my entityManager is null; it does not get injected.
@Name("genericdao");
| public abstract MyBase <T, ID extends Serializable> implements mybaseInterface <T, ID> {
|
| @In
| protected EntityManager entityManager;
| }
|
|
| @Stateless
| @TransactionAttribute (TransactionAttributeType.REQUIRED)
| @Name ("bean1")
| public class Bean1 extends MyBase <Entity, ID> implements Bean1Interface {
|
| //do some dao acess here
| }
|
| @Stateful
| @Name ("bean2")
| public class Bean2 implements Bean2Interface {
|
| //I have commented this in and out, does not make a difference.
| @In private EntityManager entityManager;
|
| @In
| Bean1 bean1
|
| //use bean1 to do dao stuff, persist, remove, refresh, etc.
|
| }
component.xml has the following:
<persistence:managed-persistence-context name="entityManager" auto-create="true"
| persistence-unit-jndi-name="java:/myEntityManagerFactory"/>
persistence.xml has the following:
....
| <persistence-unit name="myDatabase">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/DefaultDS</jta-data-source>
| <jar-file>../my-common.jar</jar-file>
| <jar-file>../my-party.jar</jar-file>
| <jar-file>../my-security.jar</jar-file>
| ......
| <properties>
| .....
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/myEntityManagerFactory"/>
| ....
| </persistence-unit>
| ....
I am trying to re-work my EJB style extended persistence context to use SMPC. Where
I had @PersistenceContext to inject entityManager and @EJB to inject the beans. However swithching to @In to inject entityManager and my beans does not work.
Please help, I have being reading old posts all knight long, and unable to get this to work. I am sure I am missing something obvious.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4092277#4092277
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4092277
18Â years, 6Â months
[EJB 3.0] - Problem with TimerService
by hasc
Hi,
i posted this question already in the seam forum, but i was told I should post the question here again...
I wrote a simple stateless bean to test the TimerService. i am using jboss 4.2.0GA
bean using the TimerService:
| @Stateless
| @Name("listener")
| public class DBChangeListenerService implements DBChangeListener {
|
| @Resource TimerService timerservice;
|
| @Logger Log log;
|
| public DBChangeListenerService() {}
|
| public void initTimer() {
| log.info("initTimer");
| timerservice.createTimer(2*60*1000, 2*60*1000,"DBChangeListener");
| }
|
| @Timeout
| public void queryState(Timer timer) {
| log.info("query db state");
| }
| }
|
and the bean calling the initTimer() method:
| @Stateless
| @AutoCreate
| @Name("objectcache")
| public class ObjectCacheService implements ObjectCache{
|
|
| @In(create=true)
| DBChangeListenerService listener;
|
| public void init() {
| listener.initTimer();
| }
| }
When the init() method is called the following exception is trhrown:
2007-10-02 14:56:55,437 ERROR [org.jboss.ejb.txtimer.TimerServiceImpl] Cannot create txtimer
| java.lang.IllegalStateException: Unable to persist timer
| at org.jboss.ejb.txtimer.DatabasePersistencePolicy.insertTimer(DatabasePersistencePolicy.java:124)
| 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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| ...
| ...
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
| at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
| at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:381)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: org.jboss.util.NestedSQLException: Could not enlist in transaction on entering meta-aware
| object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to en
| list resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fdff:555:47023fba:53 status: ActionStatus.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceException: Could not enlist in transaction o
| n entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Thr
| owable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fdff:555:47023fba:53 status: ActionStatus.ABORT_ONLY >))
| at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
| at org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin.insertTimer(GeneralPurposeDatabase
| PersistencePlugin.java:199)
| at org.jboss.ejb.txtimer.DatabasePersistencePolicy.insertTimer(DatabasePersistencePolicy.java:120)
| ... 317 more
| Caused by: org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering me
| ta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabl
| ed to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fdff:555:47023fba:53 status: ActionStatus.ABORT_ONLY >)
| at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnecti
| onManager.java:343)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnectManagedConnection(BaseConne
| ctionManager2.java:518)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionMan
| ager2.java:399)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConne
| ction(BaseConnectionManager2.java:842)
| at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
| ... 319 more
| Caused by: javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see t
| he previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fdff:555:47023fba:53 status: ActionStatus.ABORT_ONLY >
| at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$TransactionSy
| nchronization.checkEnlisted(TxConnectionManager.java:744)
| at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConn
| ectionManager.java:577)
| at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnecti
| onManager.java:337)
| ... 323 mor
any tips would be great.
Thanks and regards,
hasc
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4092272#4092272
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4092272
18Â years, 6Â months
[Clustering/JBoss] - Re: NameNotFound Exception on switching over
by bstansberryï¼ jboss.com
To briefly go through the cases:
1) A client running outside of JBoss AS. You need to code the retry mechanism that's laid out in detail on the wiki page.
2) A non-MDB client running inside JBoss AS. Use java:JmsXA.
3) An MDB deployed normally, i.e. not deploy-hasingleton. When the HA-JMS server fails over, there is no deploy/undeploy going on with the MDB. The existing MDBs will automatically keep trying to reacquire the HA-JMS server, and when it starts on the new master, they'll find it. This should all be transparent to other JMS clients, other than there may be a temporary delay in processing messages.
4) An MDB deployed in deploy-hasingleton. Here there will be a deployment of the MDB on the new master. Against, this should be transparent to other JMS clients. Note that there is no requirement whatsoever to deploy MDBs in deploy-hasingleton in order to have HA-JMS work properly. You'd only deploy them in deploy-hasingleton if for some reason you wanted them only running on one server in the cluster.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4092271#4092271
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4092271
18Â years, 6Â months