[JBoss jBPM] - Automate Workflow Steps
by ashishc
Hi All,
I have create a simple workflow which has 2 nodes, a start state and an end state. Here is the source...
<?xml version="1.0" encoding="UTF-8"?>
|
| <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="http-demo-process">
| <swimlane name="initiator">
| <assignment actor-id="manager" />
| </swimlane>
|
| <start-state name="start">
| <transition to="call action"></transition>
| </start-state>
|
| <node name="call action">
| <action class="com.sample.action.MessageActionHandler">
| <message>First Message</message>
| </action>
| <transition to="post data"></transition>
| </node>
| <node name="post data">
| <action class="com.sample.action.PostActionHandler">
| <message>First Message</message>
| </action>
| <transition to="end"></transition>
| </node>
| <end-state name="end"></end-state>
| </process-definition>
Now after I deploy, in the jbpm-console, I have to click to start the workflow and then at every step I have to click start-end to finally reach the end of the workflow.
Is there someway I can automate the entire process??
Here is the action class for the node above:
package com.sample.action;
|
| import org.jbpm.graph.def.ActionHandler;
| import org.jbpm.graph.exe.ExecutionContext;
| import org.apache.commons.logging.Log;
| import org.apache.commons.logging.LogFactory;
|
| public class MessageActionHandler implements ActionHandler {
|
| Log log = LogFactory.getLog(this.getClass());
| private static final long serialVersionUID = 1L;
|
| /**
| * The message member gets its value from the configuration in the
| * process definition. The value is injected directly by the engine.
| */
| String message;
|
| /**
| * A message process variable is assigned the value of the message
| * member. The process variable is created if it doesn't exist yet.
| */
| public void execute(ExecutionContext context) throws Exception {
| context.getContextInstance().setVariable("message", message);
| log.info("Printing Message at end: " + message);
| //context.leaveNode();
| String taskName = context.getTaskInstance().getName();
| log.info("taask name " + taskName);
|
| }
|
| }
What I want to do is start the workflow and then it goes through all the steps and reaches end.
Also whats the best way to pass data (or values) from one step to another in the jbpm Workflow.
Please advise.
Thanks
Ashish
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4162932#4162932
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4162932
17 years, 9 months
[JBoss Portal] - JSF Portlet not rendering view - Jsf portletbridge bridge no
by SreeniJakka
Hello
I am trying to get a JSF/Facelets/RichFaces Portlet working in JBoss Portal using the PortletBridge.
I finally get an empty portlet but no view content. I see the following errors in the log file:
2008-07-07 14:46:56,794 DEBUG [org.jboss.portletbridge.context.FacesContextFactoryImpl] Servlet request - create HttpServlet version of the ExternalContext
2008-07-07 14:46:56,882 DEBUG [org.ajax4jsf.event.AjaxPhaseListener] Process before phase RESTORE_VIEW 1
2008-07-07 14:46:56,882 DEBUG [org.ajax4jsf.event.InitPhaseListener] Perform additional framework initialization on first request
2008-07-07 14:46:56,882 DEBUG [org.ajax4jsf.application.ViewHandlerWrapper] Create new instance of alternate handler class org.jboss.portletbridge.application.FaceletPortletViewHandler
2008-07-07 14:46:57,039 DEBUG [org.ajax4jsf.event.InitPhaseListener] Remove init phase listener from factories
2008-07-07 14:46:57,040 DEBUG [org.ajax4jsf.event.AjaxPhaseListener] Process after phase RESTORE_VIEW 1
2008-07-07 14:46:57,050 WARN [javax.enterprise.resource.webcontainer.jsf.lifecycle] phase(RENDER_RESPONSE 6,org.jboss.portletbridge.context.FacesContextImpl@154e317) threw exception: javax.portlet.faces.BridgeException: Jsf portletbridge bridge not initialised Jsf portletbridge bridge not initialised
org.jboss.portletbridge.application.PortletStateHolder.getInstance(PortletStateHolder.java:125)
org.jboss.portletbridge.lifecycle.PortalPhaseListener.beforePhase(PortalPhaseListener.java:108)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
org.jboss.portal.portlet.impl.jsr168.api.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:86)
com.cypress.portal.BillingSummary.doView(BillingSummary.java:27)
javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133)
javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:244)
javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.invokeRender(PortletContainerImpl.java:483)
Here is what I have in my libs:
Rich Faces 3.2.0.GA jars
jboss-portletbridge-1.0.0.B2 jars
jsf-facelets.jar
my faces-config.xml ---->
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
<view-handler>
org.jboss.portletbridge.application.PortletViewHandler
</view-handler>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
<faces-context-factory>
org.jboss.portletbridge.context.FacesContextFactoryImpl
</faces-context-factory>
<managed-bean id="billingSummaryBean">
<managed-bean-name>billingSummaryBean</managed-bean-name>
<managed-bean-class>
com.cypress.beans.BillingSummaryBean
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<render-kit>
<component-family>javax.faces.ViewRoot</component-family>
<renderer-type>javax.faces.ViewRoot</renderer-type>
<renderer-class>
org.jboss.portletbridge.renderkit.portlet.PortletAjaxViewRootRenderer
</renderer-class>
</render-kit>
</faces-config>
Here is my web.xml --->
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>
org.jboss.portletbridge.application.FaceletPortletViewHandler
</param-value>
</context-param>
<context-param>
<param-name>javax.portlet.faces.renderPolicy</param-name>
<param-value>ALWAYS_DELEGATE</param-value>
</context-param>
<context-param>
<param-name>
javax.portlet.faces.preserveActionParams
</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
<param-value></param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>NONE</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>NONE</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<!-- JSF -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<display-name>Ajax4jsf Filter</display-name>
<filter-name>ajax4jsf</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
<init-param>
<param-name>forceparser</param-name>
<param-value>false</param-value>
</init-param>
<filter-mapping>
<filter-name>ajax4jsf</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
REQUEST
FORWARD
INCLUDE
</filter-mapping>
<filter-mapping>
<filter-name>ajax4jsf</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/rfRes/*</url-pattern>
REQUEST
FORWARD
INCLUDE
</filter-mapping>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/xhtml/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>10</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>/xhtml/BillingSummary_view.jsf</welcome-file>
</welcome-file-list>
</web-app>
Portal version is JBoss Portal 2.6.4
JBoss 4.2.2.GA
Obviously I am missing something, can anyone suggest what could be going wrong here?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4162930#4162930
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4162930
17 years, 9 months
[JBoss Portal] - Jboss Portal 2.6.5 + JBoss AS 4.2.2 (Clustered)
by fbrubbo
Hi all,
I didn't find the bundle with Jboss Portal 2.6.5 + JBoss AS 4.2.2 (Clustered) in download section. So I decided to downloaded JBoss AS 4.2.2 and JBoss Portal 2.6.5 separately, and then follow the "Chapter 2. Installation" from reference guide.
At the first time we start it up everything is fine. At any other start up we got the following exception.
15:05:01,000 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2] TwoPhaseCoordinator.be
foreCompletion - failed for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@e441ee
java.lang.RuntimeException:
at org.jboss.cache.interceptors.TxInterceptor$LocalSynchronizationHandler.beforeCompletion(TxInterceptor.ja
va:1182)
at org.jboss.cache.interceptors.OrderedSynchronizationHandler.beforeCompletion(OrderedSynchronizationHandle
r.java:75)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationIm
ple.java:114)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:247)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
...
Caused by: org.jboss.cache.lock.TimeoutException: write lock for / could not be acquired after 15000 ms. Locks: Rea
d lock owners: []
Write lock owner: GlobalTransaction:<192.168.10.1:2857>:321
(caller=GlobalTransaction:<192.168.10.1:2857>:345, lock info: write owner=GlobalTransaction:<192.168.10.1:2857>:32
1 (activeReaders=0, activeWriter=Thread[main,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0))
at org.jboss.cache.lock.IdentityLock.acquireWriteLock(IdentityLock.java:206)
at org.jboss.cache.Node.acquireWriteLock(Node.java:529)
at org.jboss.cache.Node.acquire(Node.java:476)
any idea?
Thanks,
Fernando
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4162924#4162924
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4162924
17 years, 9 months
[JBoss Messaging] - Re: Queue MaxSize Not Obeyed When Using Transacted Sessions
by vishalrao
Hello Andy,
The test for the first case involves using HermesJMS to look at the queue
and make sure it is empty. And then running the following code:
|
|
| import java.util.Date;
| import java.util.Properties;
|
|
| import java.io.IOException;
|
| import javax.jms.Connection;
| import javax.jms.DeliveryMode;
| import javax.jms.Destination;
| import javax.jms.MessageProducer;
| import javax.jms.Session;
| import javax.jms.TextMessage;
| import javax.naming.Context;
| import javax.naming.InitialContext;
|
| /**
| * A simple tool for publishing messages
| *
| * @version $Revision: 1.2 $
| */
|
| public class ProducerJBM
| {
|
| private Destination destination;
| private int messageCount;
| private long sleepTime;
| private boolean verbose = true;
| private int messageSize;
| private long timeToLive;
| private String queueName;
| private String providerURL;
| private String connectionFactoryBinding;
| private boolean transacted;
|
|
| /**************************************************************************/
| public static void main(String[] args)
| {
| ProducerJBM producer = new ProducerJBM();
| producer.run();
| }
| /**************************************************************************/
| public ProducerJBM()
| {
| Properties props = new Properties();
| try
| {
| props.load(this.getClass().getClassLoader().getResourceAsStream("jbm.properties"));
| }
| catch (IOException ioe)
| {
| System.err.println("Error loading jbm.properties.");
| ioe.printStackTrace(System.err);
| System.exit(-1);
| }
|
| providerURL = props.getProperty("provider_url");
| messageCount = Integer.parseInt(props.getProperty("num_messages_to_send"));
| if (messageCount == -1)
| messageCount = Integer.MAX_VALUE;
| queueName = props.getProperty("queue_name");
| messageSize = Integer.parseInt(props.getProperty("message_size"));
| sleepTime = Long.parseLong(props.getProperty("producer.sleep_time_ms"));
| connectionFactoryBinding = props.getProperty("connection_factory_binding");
| transacted = Boolean.parseBoolean(props.getProperty("producer.transacted").trim());
| }
| /**************************************************************************/
| public void run()
| {
| Connection connection = null;
|
| try
| {
| // System.out.println("Connecting to URL: " + url);
| System.out.println("Publishing a Message with size "
| + messageSize + " to queue" + ": "
| + queueName);
| System.out.println("Sleeping between publish " + sleepTime + " ms");
| if (timeToLive != 0) {
| System.out.println("Messages time to live " + timeToLive + " ms");
| }
|
| Properties props = new Properties();
| props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
| props.setProperty(Context.PROVIDER_URL, providerURL);
| props.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
|
|
| javax.naming.Context ctx = new InitialContext(props);
|
| javax.jms.ConnectionFactory factory =
| (javax.jms.ConnectionFactory)ctx.lookup(connectionFactoryBinding);
|
| connection = factory.createConnection();
|
| connection.start();
|
| // Create the session
| Session session = connection.createSession(
| transacted,
| Session.AUTO_ACKNOWLEDGE);
| System.err.println("Session transaction mode: " + transacted);
|
| destination = session.createQueue(queueName);
|
| // Create the producer.
| MessageProducer producer = session.createProducer(destination);
| producer.setDeliveryMode(DeliveryMode.PERSISTENT);
|
| if (timeToLive != 0) {
| producer.setTimeToLive(timeToLive);
| }
|
| // Start sending messages
| sendLoop(session, producer);
|
| if (transacted)
| {
| System.err.println("About to commit the session.");
| session.commit();
| System.err.println("Finished commiting the session.");
| }
| System.out.println("Done.");
|
| }
| catch (Exception e)
| {
| System.out.println("Caught: " + e);
| e.printStackTrace();
| }
| finally
| {
| System.err.println();
| System.err.println("We have reached the finally block.");
| try
| {
| System.err.println("About to close JMS connection.");
| connection.close();
| System.err.println("Finished closing the JMS connection.");
| }
| catch (Throwable ignore)
| {
| }
| }
| }
| /**************************************************************************/
| protected void sendLoop(Session session, MessageProducer producer)
| throws Exception
| {
|
| for (int i = 0; i < messageCount || messageCount == 0; i++)
| {
| /*if (i == 20)
| throw new Exception("This is an intentionl test exception thrown by Vishal");*/
| TextMessage message = session.createTextMessage(i+"");
|
| String msg = message.getText();
| System.out.println("Sending message: " + msg);
| message.setJMSMessageID("ID:"+messageCount);
| message.setJMSCorrelationID("JMS CID:"+messageCount);
| producer.send(message);
|
|
| Thread.sleep(sleepTime);
|
| }
| }
| /**************************************************************************/
| }
|
|
|
|
Here is my jbm.properties file. It's used by a few different
client programs, but I post it here in its entirety for the sake
of not smudging the evidence ;) For the sake of the current
issue we are discussing, I am only running the above client
program.
| provider_url = jnp://162.10.170.78:1399
|
| connection_factory_binding = ConnectionFactory
|
| queue_name = FR.SYNC.RESPONSE
| num_messages_to_send = 200
| message_size = 255
|
|
| producer.sleep_time_ms = 10
|
|
| consumer.sleep_time_ms = 100
|
|
| producer.transacted = true
| consumer.transacted = true
|
|
| consumer.even.num_threads = 4
| consumer.even.sleep_time_ms = 1000
|
| consumer.odd.num_threads = 4
| consumer.odd.sleep_time_ms = 1000
|
|
I run the program, notice that it has completed successfully
(no exception) and then notice in HermesJMS that 200 messages
show up.
All this time, I have confirmed that MaxSize==20 in JBoss JMX
MBean page for the queue.
Thanks,
Vishal
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4162920#4162920
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4162920
17 years, 9 months