HI 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 [EMAIL PROTECTED] 11:38:38,516 WARN JDBCExceptionReporter : SQL Error: 0, SQLState: null 11:38:38,516 ERROR JDBCExceptionReporter : [EMAIL PROTECTED] [ connectionPoolDataSource -> [EMAIL PROTECTED] [ 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 -> [EMAIL PROTECTED] [ 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 = JbpmSessionFactory.buildJbpmSessionFactory();*/ public void testProcess()throws Exception{ try { Configuration configuration = getTestConfiguration(); JbpmSessionFactory jbpmSessionFactory = JbpmSessionFactory.buildJbpmSessionFactory(configuration); ProcessDefinition definition = ProcessDefinition.parseXmlResource("First.par/processdefinition.xml"); 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); jbpmSession.beginTransaction(); // ... and begin a transaction on the persistence session // jbpmSession.getJbpmSessionFactory() // Transaction tx =jbpmSession.getTransaction(); // Save the process definition in the database jbpmSession.getGraphSession().saveProcessDefinition(definition); //System.out.println("Process definition:"+jbpmSession.getGraphSession().findLatestProcessDefinition("First.par/processdefinition.xml")); // Commit the transaction jbpmSession.commitTransaction(); System.out.println("Process definition:After Proces definition***********"+jbpmSession.getGraphSession().findLatestProcessDefinition("First Process")); // And close the jbpmSession. jbpmSession.close(); JbpmSession jbpmSession1 = jbpmSessionFactory.openJbpmSession(); // ... and begin a transaction on the persistence session. jbpmSession1.beginTransaction(); // Now we can query the database for the process definition that we // deployed above. ProcessDefinition definition1 = jbpmSession1 .getGraphSession() .findLatestProcessDefinition("First Process"); // Create an instance of the process definition. ProcessInstance instance = new ProcessInstance(definition1); assertEquals( "Instance is in start state", instance.getRootToken().getNode().getName(), "start"); assertNull( "Message variable should not exist yet", instance.getContextInstance().getVariable("message")); // 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.signal(); assertEquals( "Instance is in first state", instance.getRootToken().getNode().getName(), "auction"); // Move the process instance to the end state. The configured action // should execute again. The message variable contains a new value. instance.signal(); assertEquals( "Instance is in end state", instance.getRootToken().getNode().getName(), "end"); assertTrue("Instance has ended", instance.hasEnded()); } catch (RuntimeException e) { e.printStackTrace(); } } public void firstActionHandler() throws Exception{ ProcessDefinition definition = ProcessDefinition.parseXmlResource("First.par/processdefinition.xml"); ProcessInstance instance = new ProcessInstance(definition); assertNull("The greeting varible does not exist.",instance.getContextInstance().getVariable("greeting")); instance.signal(); 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 { properties.load(is); 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. hibernate.dialect=org.hibernate.dialect.HSQLDialect hibernate.connection.driver_class=org.hsqldb.jdbcDriver hibernate.connection.url=jdbc:hsqldb:hsql://localhost:1701 hibernate.connection.username=sa hibernate.connection.password= hibernate.show_sql=true hibernate.c3p0.min_size=1 hibernate.c3p0.max_size=3 hibernate.hbm2ddl.auto=update View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3924950#3924950 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3924950 ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user