3 Replies Latest reply on Feb 21, 2006 4:07 AM by Purvi Shah

    At time of DEPLOYMENT-Connection could not open error.

    Purvi Shah Newbie

      I tried to deploy one process(First Process) through TestClass.
      I am working on Eclipse,I have installed Startupkit 3.0.2.

      I got following error at time of running FirstTest class with Junit.

      *********************************Process Name:First Process
      ***************************JBPM SESSION***********org.jbpm.db.JbpmSession@c272bc
      11:38:38,516 WARN JDBCExceptionReporter : SQL Error: 0, SQLState: null
      11:38:38,516 ERROR JDBCExceptionReporter : com.mchange.v2.c3p0.PoolBackedDataSource@1bde4 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@1478a43 [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 1, maxIdleTime -> 0, maxPoolSize -> 3, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@ba5bdb [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:hsqldb:hsql://localhost:1701, properties -> {user=******, password=******} ] , preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ] , factoryClassLocation -> null, numHelperThreads -> 3, poolOwnerIdentityToken -> 1bde4 ] has been closed() -- you can no longer use it.
      11:38:38,516 ERROR JbpmSession : org.hibernate.exception.GenericJDBCException: Cannot open connection

      First Test class code mentioned below.

      package com.First;

      import java.io.IOException;
      import java.io.InputStream;
      import java.util.Iterator;
      import java.util.Properties;

      import junit.framework.TestCase;

      import org.jbpm.db.JbpmSession;
      import org.jbpm.db.JbpmSessionFactory;
      import org.jbpm.graph.def.ProcessDefinition;
      import org.jbpm.graph.exe.ProcessInstance;
      import org.jbpm.instantiation.ClassLoaderUtil;
      import org.jbpm.jpdl.xml.*;
      import org.hibernate.Transaction;
      import org.hibernate.cfg.Configuration;
      public class FirstTest extends TestCase {
      /*static JbpmSessionFactory jbpmSessionFactory =

      public void testProcess()throws Exception{
      try {
      Configuration configuration = getTestConfiguration();

      JbpmSessionFactory jbpmSessionFactory = JbpmSessionFactory.buildJbpmSessionFactory(configuration);

      ProcessDefinition definition =
      assertNotNull("Definition should not be null", definition);

      System.out.println("*********************************Process Name:"+definition.getName());

      // Let's open a new persistence session
      JbpmSession jbpmSession = jbpmSessionFactory.openJbpmSession();
      System.out.println("***************************JBPM SESSION***********"+jbpmSession);
      // ... and begin a transaction on the persistence session
      // jbpmSession.getJbpmSessionFactory()

      // Transaction tx =jbpmSession.getTransaction();
      // Save the process definition in the database

      //System.out.println("Process definition:"+jbpmSession.getGraphSession().findLatestProcessDefinition("First.par/processdefinition.xml"));

      // Commit the transaction

      System.out.println("Process definition:After Proces definition***********"+jbpmSession.getGraphSession().findLatestProcessDefinition("First Process"));

      // And close the jbpmSession.

      JbpmSession jbpmSession1 = jbpmSessionFactory.openJbpmSession();
      // ... and begin a transaction on the persistence session.

      // Now we can query the database for the process definition that we
      // deployed above.
      ProcessDefinition definition1 =
      .findLatestProcessDefinition("First Process");
      // Create an instance of the process definition.
      ProcessInstance instance = new ProcessInstance(definition1);
      "Instance is in start state",
      "Message variable should not exist yet",

      // Move the process instance from its start state to the first state.
      // The configured action should execute and the appropriate message
      // should appear in the message process variable.
      "Instance is in first state",

      // Move the process instance to the end state. The configured action
      // should execute again. The message variable contains a new value.
      "Instance is in end state",
      assertTrue("Instance has ended", instance.hasEnded());
      } catch (RuntimeException e) {


      public void firstActionHandler() throws Exception{

      ProcessDefinition definition =
      ProcessInstance instance = new ProcessInstance(definition);
      assertNull("The greeting varible does not exist.",instance.getContextInstance().getVariable("greeting"));
      assertEquals("The greeting variable is created.",instance.getContextInstance().getVariable("greeting"),"Heelo from Action Handler");

      private static Configuration getTestConfiguration() {
      Configuration configuration = JbpmSessionFactory.createConfiguration();
      InputStream is = ClassLoaderUtil.getStream("hibernate.properties");
      if (is!=null) {
      Properties properties = new Properties();

      try {
      System.out.println("############################ "+properties);
      } catch (IOException e) {
      throw new RuntimeException("couldn't load jbpm.dbtest.hibernate.properties", e);
      Iterator iter = properties.keySet().iterator();
      while (iter.hasNext()) {
      String key = (String) iter.next();
      String value = properties.getProperty(key);
      System.out.println("#############################################overwriting jbpm.test.hibernate.properties: "+key+"="+value);
      configuration.setProperty(key, value);
      return configuration;

      Hibernate configuration file has been mentioned below.



        • 1. Re: At time of DEPLOYMENT-Connection could not open error.
          Alejandro Guizar Master

          Hypersonic comes with a database management tool that you can run as a Java application with the following command:

          java -cp hsqldb.jar org.hsqldb.DatabaseManager

          Do you get connectivity with this tool when you use the connection properties you specify? In particular, I think you are missing a database name in the connection URL:

          • 2. Re: At time of DEPLOYMENT-Connection could not open error.
            Alejandro Guizar Master

            Oops, the database manager class is org.hsqldb.util.DatabaseManager. Hypersonic also offers an alternate version based on Swing instead of AWT: org.hsqldb.util.DatabaseManagerSwing

            • 3. Re: At time of DEPLOYMENT-Connection could not open error.
              Purvi Shah Newbie

              Hi Alex,
              Thanks for response.
              Now I able to connect to HSQL Datamanager ,the way you mentioend.
              I could not find my schema.
              When I add Database name in Hibernate.config file, I got error
              Database not found.
              BUt server\data folder localDb(My database name-i have not achanged anything-it come by defalut) is exist.

              Now I tried to run First Test class,without db name in hibernate config file.
              I* got successful message.
              I found process instance started message in console.
              BUt though I am not able to find this process with version 1 on webconsole.
              I found Process with version -1 on webconsole(jBPM).

              For WebSale process I am able to start process instance form webconsole an d task list also appeared on webconsole,.
              Sameway I also want to do for My process.
              BUt I am not able to start process instance from webconsole.

              I am new to jBPM.
              I do not know If anything is missing for display on webconsole.

              Can you share any basic mateirla on jBPM other than user guide and gettign started docuemnt.
              I read hat but I could not find comprehensive.

              Thank you.