I am using eclipse juno and hibernate 4.1.6, mysql connector 5.1.24, jboss 7.1.1.
I tried this and this(as a module).
I have the connector JAR in WEB-INF/lib
folder, and I also tried once without it. Everything failed. I don't know anymore how I can solve this problem. The whole stack trace:
18:35:44,284 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) Error creating Session: org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver class not found
The connector is an the class path, it's in the Maven Dependencies Library. I put it in the lib folder and in the System Library...nothing works.
public class HibernateUtil {
private static SessionFactory sessionFactory;
private static ServiceRegistry serviceRegistry;
static
{
try
{
Configuration configuration = new Configuration().configure("hibernate.cfg.xml");
serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
}
catch (HibernateException he)
{
System.err.println("Error creating Session: " + he);
throw new ExceptionInInitializerError(he);
}
}