0 Replies Latest reply on Sep 14, 2008 3:39 AM by francesco franzè

    create a client (Java application) outside jbpm

    francesco franzè Newbie

      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