Error creating session factory

Suddenly í’m having an urgent problem creating a session factory without there having been any program changes. Even when I put back older versions of the application, this problem occurs. The error message thrown is:

SessionFactory creation failed:org.hibernate.InvalidMappingException: Could not parse mapping document from resource jesscloud.hbm.xml.

This leads me to think that the address from which the hibernate configuration file is fetched, has been changed. Below please find the Hibernate config file I’m using and the code concerning creation of the session factory. Processing stops at config.configure( configFile );

Since users can’t login because of this problem, this needs to be resolved as soon as possible.

=================================================================

import org.hibernate.SessionFactory;

import org.hibernate.cfg.Configuration;

public class HibernateSessionUtil {

private SessionFactory sessionFactory;

static String configFile = null ;

private static SessionFactory buildSessionFactory(String db) {

try {

Configuration config = new Configuration();

TransactionServiceImpl. logMessage (“h1”);

config.setProperty(“hibernate.connection.url”, “jdbc:mysql://localhost/” + db );

TransactionServiceImpl. logMessage (“h2”);

config.configure( configFile );

TransactionServiceImpl. logMessage (“h3”);

return config.buildSessionFactory();

}

catch (Throwable ex) {

TransactionServiceImpl. logMessage ("Error in HibernateSessionUtl.java - config: " + configFile + " " + db);

TransactionServiceImpl. logMessage (“Error in HibernateSessionUtl.java - SessionFactory creation failed:” + ex);

throw new ExceptionInInitializerError(ex);

}

}

@SuppressWarnings(“static-access”)

public SessionFactory getSessionFactory(Boolean firstTime, String db, String configFile) {

TransactionServiceImpl. logMessage ("**Session fact: " + db + " " + configFile);

this . configFile = configFile;

if (firstTime){

sessionFactory = buildSessionFactory (db);

}

if (!firstTime)

if (sessionFactory.isClosed()){

sessionFactory = buildSessionFactory (db);

TransactionServiceImpl. logMessage ("***sessionfactory restarted: " + db );

}

return sessionFactory;

}

}

===============================================
1.<?xml version="1.0" encoding="UTF-8"?>
2.

5.
6.
7.
8. com.mysql.jdbc.Driver
9.
10. root
11. marj12345
12.
13. 25

  1. 50

  2. 50

  3. 50

  4. org.hibernate.dialect.MySQLDialect

  5. thread

  6. org.hibernate.cache.NoCacheProvider

  7. true

We’re experiencing the same issue, as of a tomcat restart on 6/28 (no changes on our end to any source or processes). Any ideas on this?

Hi Tim,

Thanks for you email. I think that it has to do with the update of the hibernate.cfg.xml file on 6/28. I don’t know how to notify the hibernate organization so they can take quick action. Maybe you have some ideas.

Lets keep each other posted.

We have resolved the same problem.

We change to <!DOCTYPE hibernate-mapping SYSTEM

“your_local_path/hibernate-mapping-3.0.dtd”>