[JBoss jBPM] - client java application external application server jbpm
by magnumff
I have jbpm-jpdl-3.2.2 and use as a standard database.
I created a process (workflow) and I did deploy.
I did tests with http://localhost:8080/jbpm-console/sa/processes.jsf.
all ok.
I want to create a client (Java application) and I am using this code:
public static void main(String[] args) {
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try{
ProcessInstance processInstance = jbpmContext.newProcessInstance("xxxxxxx");
processInstance.signal();
jbpmContext.save(processInstance);
}catch (Exception e) {
jbpmContext.close();
System.out.println("---------------------------------ERROR => "+e.toString());
e.printStackTrace();
}
}
my error is
log4j:WARN No appenders could be found for logger (org.jbpm.JbpmConfiguration).
log4j:WARN Please initialize the log4j system properly.
---------------------------------ERROR => org.hibernate.HibernateException: hibernate.cfg.xml not found
org.hibernate.HibernateException: hibernate.cfg.xml not found
at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1405)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1427)
at org.jbpm.db.hibernate.HibernateHelper.createConfiguration(HibernateHelper.java:91)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getConfiguration(DbPersistenceServiceFactory.java:69)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:95)
at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
at org.jbpm.JbpmContext.getSession(JbpmContext.java:506)
at ProvaClient.main(ProvaClient.java:20)
use this hibernate.cfg.xml in my client:
<hibernate-configuration>
| <session-factory name="jbpmff">
| <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
| <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
| <property name="hibernate.connection.datasource">java:/jpdlDS</property>
| <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
|
| <property name="hibernate.transaction.manager_lookup_class">
| org.hibernate.transaction.JBossTransactionManagerLookup
| </property>
| </session-factory>
| </hibernate-configuration>
|
my error is
og4j:WARN No appenders could be found for logger (org.jbpm.JbpmConfiguration).
log4j:WARN Please initialize the log4j system properly.
---------------------------------ERROR => org.hibernate.HibernateException: Could not find datasource
org.hibernate.HibernateException: Could not find datasource
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:410)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:95)
at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
at org.jbpm.JbpmContext.getSession(JbpmContext.java:506)
at ProvaClient.main(ProvaClient.java:20)
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
... 11 more
I make other configuration files?
thank
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4176383#4176383
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4176383
17 years, 6 months
[JBoss jBPM] - Re: Persistenting Custom Objects
by salaboy21
That is an easy task.
You must look the jbpm.varmapping.xml and you find something like that:
| <!-- java.io.Serializable -->
| <jbpm-type>
| <matcher>
| <bean class="org.jbpm.context.exe.matcher.SerializableMatcher" />
| </matcher>
| <converter class="org.jbpm.context.exe.converter.SerializableToByteArrayConverter" />
| <variable-instance class="org.jbpm.context.exe.variableinstance.ByteArrayInstance" />
| </jbpm-type>
|
This means that you have a matcher (that look the type of your class that you want to persist)
And then when your object match with a matcher you must convert it with a converter to a VariableInstance (more precisely a sub class that you define).
For an easy use I recommend you to look at the next pair of matchers and converters:
| <!-- hibernatable long id types -->
| <jbpm-type>
| <matcher>
| <bean class="org.jbpm.context.exe.matcher.HibernateLongIdMatcher" />
| </matcher>
| <variable-instance class="org.jbpm.context.exe.variableinstance.HibernateLongInstance" />
| </jbpm-type>
|
| <!-- hibernatable string id types -->
| <jbpm-type>
| <matcher>
| <bean class="org.jbpm.context.exe.matcher.HibernateStringIdMatcher" />
| </matcher>
| <variable-instance class="org.jbpm.context.exe.variableinstance.HibernateStringInstance" />
| </jbpm-type>
|
This two matchers have the logic to search in your objects that have an hibernate mappings (defined in hbms files) but with a Long ID (HibernateLongInstance) or a
String ID (HibernateStringIdMatcher).
So, if your object does not have a Long or String ID, this two matchers wont work.
In this case you must implement your own matcher and your variable instance, following the same directions. (like HibernateStringInstance or HibernateLongInstance)
I hope it helps!!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4176347#4176347
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4176347
17 years, 6 months
[JBoss jBPM] - error data source client JBPM
by magnumff
hi
I am developing a client "Java Application" for jbmp. I imported all libraries and configured XML files :
hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE hibernate-configuration PUBLIC
| "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
| "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
| <hibernate-configuration>
| <session-factory name="jbpmff">
| <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
| <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
| <property name="hibernate.connection.datasource">java:comp/env/jdbc/JbpmDataSource</property>
| <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
| <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
| </session-factory>
| </hibernate-configuration>
jbpm.cfg.xml
<jbpm-configuration>
|
| <jbpm-context>
| <service name='persistence' factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />
| <service name='message' factory='org.jbpm.msg.db.DbMessageServiceFactory' />
| <service name='scheduler' factory='org.jbpm.scheduler.db.DbSchedulerServiceFactory' />
| <service name='logging' factory='org.jbpm.logging.db.DbLoggingServiceFactory' />
| <service name='authentication' factory='org.jbpm.security.authentication.DefaultAuthenticationService
| Factory' />
| </jbpm-context>
|
| <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
| <string name='resource.hibernate.cfg.xml' value='hibernate.cfg.xml' />
| <!-- <string name='resource.hibernate.properties' value='hibernate.properties' /> -->
| <string name='resource.business.calendar' value='org/jbpm/calendar/jbpm.business.calendar.properties'
| />
| <string name='resource.default.modules' value='org/jbpm/graph/def/jbpm.default.modules.properties' />
| <string name='resource.converter' value='org/jbpm/db/hibernate/jbpm.converter.properties' />
| <string name='resource.action.types' value='org/jbpm/graph/action/action.types.xml' />
| <string name='resource.node.types' value='org/jbpm/graph/node/node.types.xml' />
| <string name='resource.parsers' value='org/jbpm/jpdl/par/jbpm.parsers.xml' />
| <string name='resource.varmapping' value='org/jbpm/context/exe/jbpm.varmapping.xml' />
|
| <int name='jbpm.byte.block.size' value="1024" singleton="true" />
| <bean name='jbpm.task.instance.factory' class='org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl'
| singleton='true' />
| <bean name='jbpm.variable.resolver' class='org.jbpm.jpdl.el.impl.JbpmVariableResolver' singleton='tru
| e' />
|
| </jbpm-configuration>
My client
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.graph.exe.ProcessInstance;
public class ProvaClient {
private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
public static void main(String[] args) {
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try{
ProcessInstance processInstance = jbpmContext.newProcessInstance("bpm_xxxxx");
processInstance.signal();
jbpmContext.save(processInstance);
}catch (Exception e) {
jbpmContext.close();
System.out.println("---------------------------------ERROR => "+e.toString());
e.printStackTrace();
}
}
}
error is
log4j:WARN No appenders could be found for logger (org.jbpm.JbpmConfiguration).
log4j:WARN Please initialize the log4j system properly.
---------------------------------ERROR => org.hibernate.HibernateException: Could not find datasource
org.hibernate.HibernateException: Could not find datasource
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:410)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:95)
at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:341)
at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:571)
at org.jbpm.JbpmContext.newProcessInstance(JbpmContext.java:408)
at ProvaClient.main(ProvaClient.java:15)
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
... 13 more
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4176329#4176329
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4176329
17 years, 6 months
[JBoss jBPM] - Re: signaling to a forked sibling
by gnagy
I think I managed to fire a user-defined event, but i cannot see the effect on the observer branch (the "Firing mail-delivered" message does appear on the console). Does this make sense at all? Can such an event be seen in another branch?
(party branch)
[task-node name="waitingforL1"]
[task name="Waiting for L1" swimlane="ahstaff"][/task]
[transition to="waitingforsendingL2" name="gotL1"]
[script]System.out.println("Firing mail-delivered "); executionContext.getTransition().fireEvent("mail-delivered", executionContext);[/script]
[/transition]
[/task-node]
(observer branch)
[state name="waitingforallL1"]
[event type="mail-delivered"]
[action][script]System.out.println("mail-delivered event handled"); node.leave(executionContext);[/script][/action]
[/event]
[transition to="nextstep" name="gotallL1"][/transition]
[/state]
Thanks,
Greg
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4176327#4176327
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4176327
17 years, 6 months