[jboss-user] [JBoss jBPM] - About loading of hibernate configuration in HibernateHelper.
QuePasa
do-not-reply at jboss.com
Thu Oct 18 03:57:59 EDT 2007
First, i want to sorry for my very intermediate english :)
So... in jBPM config-file (jbpm.cfg.xml) exists a string
when i try to execute this code
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| try {
| jbpmContext.deployProcessDefinition(processDefinition);
| } finally {
| jbpmContext.close();
| }
|
there exception throws with message Exception in thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml not found.
now see the full stack trace:
Exception in thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml not found
| at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
| at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1405)
| at org.hibernate.cfg.Configuration.configure(Configuration.java:1427)
| at org.jbpm.db.hibernate.HibernateHelper.createConfiguration(HibernateHelper.java:91)
| at org.jbpm.persistence.db.DbPersistenceServiceFactory.getConfiguration(DbPersistenceServiceFactory.java:69)
| 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.deployProcessDefinition(JbpmContext.java:173)
| at ru.emd.escom3.core.CoreTest.main(CoreTest.java:52)
and the cause of this exception is that the HibernateHelper.java trying to use specified hibernate's config-file like a resource in the class path. Look here:
| public abstract class HibernateHelper {
| ...
| public static Configuration createConfiguration(String cfgXmlResource, String propertiesResource) {
| ....
| // if a special hibernate configuration xml file is specified,
| if (cfgXmlResource!=null) {
| // use the configured file name
| log.debug("creating hibernate configuration resource '"+cfgXmlResource+"'");
| configuration.configure(cfgXmlResource);
| } else {
| log.debug("using default hibernate configuration resource (hibernate.cfg.xml)");
| configuration.configure();
| }
| ....
| }
| }
|
here we can see, that configuration.configure(cfgXmlResource); is called when config-file is a xml-file (it's my case).
And the configuration is the instance of Configuration class (it is in hibernate source code), and method configure() of this class trying to load transmitted file-name like a resource.
BUT MY hibernate.cfg.xml IS NOT A RESOURCE.
It is an ordinary file on file system, and i have a question: how to use such hibernate's config-file in this case ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4096401#4096401
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4096401
More information about the jboss-user
mailing list