java hibernate 4 org.hibernate.HibernateException: Dialect class not found: org.hibernate.dialect.MY


I'm learning Java EE and Hibernate, and I've run into the following problem:

I've created a Dynamic Web Project in Eclipse, I've converted it into a MAVEN project, added the mysql-connector-java and the hibernate-core dependencies to the pom.xml. I've added a servlet, and in the doGet method, I've tried to initialize the sessionfactory to create the tables. I'm using tomcat.

When I'm making a request to the servlet I'm getting the following exception:

org.hibernate.HibernateException: Dialect class not found: org.hibernate.dialect.MYSQLDialect org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:77) org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:65) org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:146) org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:76) org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:160) org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:132) org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1818) org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1776) hu.adamsan.testhibernate.TestHibernate.doGet(TestHibernate.java:74)


dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.26</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.2.6.Final</version> </dependency> </dependencies>

I've tried to look into the Maven Dependencies, org.hibernate.dialect.MySQLDialect.class is in there, in the location: getServletContext().getRealPath(".") ->E:\eclips_jee\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\TestHibernateWeb\ , in the WEB-INF\lib directory, there is hibernate-core-4.2.6.Final.jar, when I opened it with 7zip, I could find inside the org/hibernate/dialect/MySQL5Dialect.class.

What am I missing? I really have no idea.

doGet method:

PrintWriter w = response.getWriter(); w.println("Testing hibernate<br/>"); w.println(getServletContext().getRealPath(".")+"<br/>"); Configuration config; ServiceRegistry registry; SessionFactory factory; config = new Configuration().addAnnotatedClass(Modell.class); Properties props = getProperties(); props.setProperty(Environment.HBM2DDL_AUTO, "create"); config.setProperties(props); registry = new ServiceRegistryBuilder().applySettings(props).buildServiceRegistry(); factory = config.buildSessionFactory(registry); factory.close();


The answer is in the question. You've found MySQLDialect and MySQL5Dialect in your jar files, but your configuration file tries to use MYSQLDialect. Java is case-sensitive.


  • gevent fails to install in a python virtual environment on OS X Capitan
  • Compile ffmpeg as stand alone binary
  • socket.io with node.js not working as expected
  • Boot EBS volume from Bamboo instance
  • Ignoring a field without modifying the POJO class with Jackson
  • FFMpeg: CFLAGS=-D__STDC_CONSTANT_MACROS ./configure where?
  • memcache won't store key/value because the value is too big
  • Error when creating android project in eclipse
  • Run cakephp app in apache alias
  • Python : How to center Label in tkinter window
  • Displaying iOS iAds only to supported countries
  • How to debug office add-in for mac?
  • using pinentry-tty in a bash script (like read)
  • Wcf NHibernate Session management
  • hibernate exception: Batch update returned unexpected row count from update [0]; actual row count: 0
  • Using nodejs server with request package and function pipe()?
  • How can I configure a Tkinter widget from a separate class?
  • How to Use Two Different PHP Versions on One Server
  • Visual Studio 2005 Setup Wizard - creating desktop shortcuts for all users
  • SQL Server Nvarchar and Java prepared statement
  • Is there a limit on how long a cfquery with cfqueryparam can get?
  • missing pie chart and other elements when display serenity report from jenkins
  • CakePHP 3: change order in dateWidget
  • SIP Makefile fail (gnuwin and mingw)
  • Maven use Encrypted passwords in POM
  • JPA/Hibernate - Entity name seems to be important. If I rename to “Bob” works fine
  • How to generate an asynchronous reset verilog always blocks with chisel
  • insert a picture into database(sqlite) with java code. what should i do?
  • What does certain JVM do after loading ByteCode into memory?
  • What is the undocumented SessionIdInterface in PHP 5.5?
  • SIP API media codecs
  • Configure Spring's MappingJacksonHttpMessageConverter
  • How do I retrieve the user information of a user authenticated with Apache's mod_ldap?
  • aapt.exe'' finished with non-zero exit value 1
  • Android app gives error “BatteryStatsImpl: reading network stats”
  • How do I configure context broker accept post requests from my remote sensor?
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • SignalR .NET Client Invoke throws an exception
  • swift auto completion not working in Xcode6-Beta
  • How to get NHibernate ISession to cache entity not retrieved by primary key