2 Replies Latest reply on Sep 13, 2008 3:38 PM by francesco franzè

    error data source client JBPM

    francesco franzè Newbie

      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