4 Replies Latest reply on Feb 22, 2006 3:01 PM by dharraj

    JBPM Configuration

    dharraj

      Hello,

      I am trying to understand how JBPM configuration works in the 3.1 (beta2). I am using the parseInputStream method passing it jbpm.cfg.xml which has

      <string name="resource.hibernate.cfg.xml" value="/home/myhome/hibernate.cfg.xml" />
      

      in it. However, I am getting the following exception:

      org.hibernate.HibernateException: /home/myhome/hibernate.cfg.xml not found
       at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
       at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1265)
       at org.hibernate.cfg.Configuration.configure(Configuration.java:1287)
       at org.jbpm.db.hibernate.HibernateHelper.createConfiguration(HibernateHelper.java:89)
       at org.jbpm.persistence.db.DbPersistenceServiceFactory.getConfiguration(DbPersistenceServiceFactory.java:68)
       at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:93)
       at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:75)
       at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:79)
       at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:182)
       at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:422)
       at org.jbpm.JbpmContext.deployProcessDefinition(JbpmContext.java:165)
       at jpl.mipl.pgs.test.HelloWorldDbTest.saveInDB(HelloWorldDbTest.java:143)
       at jpl.mipl.pgs.test.HelloWorldDbTest.run(HelloWorldDbTest.java:96)
       at jpl.mipl.pgs.test.HelloWorldDbTest.<init>(HelloWorldDbTest.java:75)
       at jpl.mipl.pgs.test.HelloWorldDbTest.main(HelloWorldDbTest.java:271)
      

      The file exists and it has right permissions set. Please tell me what I am doing wrong.

      Thanks
      Raj

        • 1. Re: JBPM Configuration
          ralfoeldi

          Hi Raj,

          org.hibernate.util.ConfigHelper.getResourceAsStream


          would indicate that Hibernate is looking on the class path and I don't assume you have a file '/home/myhome/hibernate.cfg.xml' on your class path.

          Greetings

          • 2. Re: JBPM Configuration
            dharraj

            Thanks for the reply. So, do you know if it is possible to configure hibernate with a configuration file that is not bundled into a jar file? I glanced over the hibernate documentation but didn't see any thing that tells otherwise. Would you recommend using the hibernate Configuration object instead of a configuration file?

            Thanks
            Raj

            • 3. Re: JBPM Configuration
              aguizar

              The classpath can have directories as well as jars. You could add a directory, say /home/myhome, to your classpath (before your libraries, so that the directory takes precedence over any bundled file). Afterwards, specify the path to the configuration file in relation to that directory: /hibernate.cfg.xml. Note that the initial slash in this path means "classpath root" rather than "filesystem root".

              • 4. Re: JBPM Configuration
                dharraj

                Hello Alex,

                Sorry I got side traced on to another problem. I can get it to work as you mentioned when I run it from command line. I have ./ in my class path and have hibernate.cfg.xml in the working directory. This works. However, I cannot get it to work if say I put the hibernate.cfg.xml in my.jar and place my.jar in /home/raj and have /home/raj/my.jar as first thing in my classpath. Actually I am trying to get it to work in Eclipse.

                Thanks
                Raj