[jboss-user] [JBoss jBPM] - Not able to connect to Database

Music123 do-not-reply at jboss.com
Wed Jul 30 01:30:56 EDT 2008


Hi,

I want to develop a struts application using JBPM workflow engine.I tried to implement login functionality from struts Action class.

I want to check the existence of username and password given by user in database. I passed jbpm.cfg.xml as string. Its giving message as "hibernate.properties" not found.

I gave the datasource name in hibernate.cfg.xml. but its not detecting and connection to database.

Please correct me if i am wrong somewhere and direct me on the correct path.

Thanks in Advance.

Here is my code:

		static JbpmConfiguration jbpmConfiguration = null; 
	static {

		jbpmConfiguration = JbpmConfiguration.parseXmlString(
		      "<jbpm-configuration>" +
		      
		      // A jbpm-context mechanism separates the jbpm core 
		      // engine from the services that jbpm uses from 
		      // the environment.  
		      
		      "  <jbpm-context>" +
		      "    <service name='persistence' " +
		      "             factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" + 
		      "  </jbpm-context>" +
		      
		      // Also all the resource files that are used by jbpm are 
		      // referenced from the jbpm.cfg.xml
		      
		      "  <string name='resource.hibernate.cfg.xml' " +
		      "          value='hibernate.cfg.xml' />" +
		      "  <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.varmapping' " +
		      "          value='org/jbpm/context/exe/jbpm.varmapping.xml' />" +
		      "</jbpm-configuration>"
		    );
		  }

JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();

IdentitySession iSession = new IdentitySession(jbpmContext.getSession());

final Object id = iSession.verify(username, password);
if (id == null) {
            	System.out.println(".............Invalid user name or password...............");
            	return mapping.findForward("invalidUser");
            }
            else if(id != null) {
            	System.out.println(".............User is valid...............");
return mapping.findForward("validUser");
}

Stacktrace:

INFO  [STDOUT] 14:08:02,890 INFO  [Environment] Hibernate 3.2.3
14:08:02,890 INFO  [STDOUT] 14:08:02,890 INFO  [Environment] hibernate.propertie
s not found
14:08:02,906 INFO  [STDOUT] 14:08:02,906 INFO  [Environment] Bytecode provider n
ame : javassist
14:08:02,921 INFO  [STDOUT] 14:08:02,921 INFO  [Environment] using JDK 1.4 java.
sql.Timestamp handling
14:08:03,281 INFO  [STDOUT] 14:08:03,281 INFO  [Configuration] configuring from
resource: hibernate.cfg.xml
14:08:03,281 INFO  [STDOUT] 14:08:03,281 INFO  [Configuration] Configuration res
ource: hibernate.cfg.xml



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>

    <!-- hibernate dialect -->
    org.hibernate.dialect.MySQLInnoDBDialect
       

    <!-- JDBC connection properties (begin) 
    org.hsqldb.jdbcDriver
    
    org.hibernate.cache.HashtableCacheProvider
    
    <!-- DataSource properties (begin) ===-->
    java:/jpdlDS
    <!--==== DataSource properties (end) -->
    
    <!-- JTA transaction properties (begin) ===
    org.hibernate.transaction.JTATransactionFactory
    org.hibernate.transaction.JBossTransactionManagerLookup
    ==== JTA transaction properties (end) -->

    <!-- CMT transaction properties (begin) ===
    org.hibernate.transaction.CMTTransactionFactory
    org.hibernate.transaction.JBossTransactionManagerLookup
    ==== CMT transaction properties (end) -->

    <!-- logging properties (begin) === -->
    true
    true
    <!--true
      ==== logging properties (end) -->
    
    <!-- ############################################ -->
    <!-- # mapping files with external dependencies # -->
    <!-- ############################################ -->

    <!-- following mapping file has a dependendy on   -->
    <!-- 'bsh-{version}.jar'.                         -->
    <!-- uncomment this if you don't have bsh on your -->
    <!-- classpath.  you won't be able to use the     -->
    <!-- script element in process definition files   -->
    

    <!-- following mapping files have a dependendy on  -->
    <!-- 'jbpm-identity.jar', mapping files            -->
    <!-- of the pluggable jbpm identity component.     -->
    <!-- Uncomment the following 3 lines if you        -->
    <!-- want to use the jBPM identity mgmgt           -->
    <!-- component.                                    -->
    <!-- identity mappings (begin) -->
    
    
    
    <!-- identity mappings (end) -->
    
    <!-- following mapping files have a dependendy on  -->
    <!-- the JCR API                                   -->
    <!-- jcr mappings (begin) ===
    
    ==== jcr mappings (end) -->


    <!-- ###################### -->
    <!-- # jbpm mapping files # -->
    <!-- ###################### -->

    <!-- hql queries and type defs -->
    

    <!-- graph.action mapping files -->
    
    
    <!-- graph.def mapping files -->
    
    
    
    
    
    
    
    

    <!-- graph.node mapping files -->
    
    
    
    
    
    
    
    
    

    <!-- context.def mapping files -->
    
    

    <!-- taskmgmt.def mapping files -->
    
    
    
    

    <!-- module.def mapping files -->
    

    <!-- bytes mapping files -->
    

    <!-- file.def mapping files -->
    

    <!-- scheduler.def mapping files -->
    
    

    <!-- graph.exe mapping files -->
    
    
    
    

    <!-- module.exe mapping files -->
    
        
    <!-- context.exe mapping files -->
    
    
    
    
    
    
    
    
    
    
    

    <!-- job mapping files -->
    
    
    
    

    <!-- taskmgmt.exe mapping files -->
    
    
    
    

    <!-- logging mapping files -->
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  </session-factory>
</hibernate-configuration>


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4167497#4167497

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4167497



More information about the jboss-user mailing list