Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: JBoss AS Containers
    • Labels:
      None

      Description

      Short Description

      You can't use a custom dialect because you'll get a HibernateException:

      org.hibernate.HibernateException: Unable to construct requested dialect [com.mycompany.hibernate.MySQLBitBooleanDialect]
      	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172) [wildfly-jpa-8.1.0.Final.jar:8.1.0.Final]
      	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117) [wildfly-jpa-8.1.0.Final.jar:8.1.0.Final]
      	at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_67]
      	at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:474) [wildfly-security-manager-1.0.0.Final.jar:1.0.0.Final]
      	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182) [wildfly-jpa-8.1.0.Final.jar:8.1.0.Final]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
      	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
      	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final.jar:2.1.1.Final]
      Caused by: org.hibernate.HibernateException: Unable to construct requested dialect [com.mycompany.hibernate.MySQLBitBooleanDialect]
      	at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:88) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      	at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:68) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      	at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:165) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      	at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      	at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      	at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      	at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]
      	at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:397) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]
      	at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) [jipijapa-hibernate4-3-1.0.1.Final.jar:]
      	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154) [wildfly-jpa-8.1.0.Final.jar:8.1.0.Final]
      	... 8 more
      Caused by: java.lang.ClassCastException: com.mycompany.hibernate.MySQLBitBooleanDialect cannot be cast to org.hibernate.dialect.Dialect
      	at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:78) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
      	... 21 more
      
      

      My WAG is that it's a classloader issue.

      Longer Version

      Some more info is in server.log:

      2014-10-18 18:26:58,736 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 17) MSC000001: Failed to start service jboss.persistenceunit."test.war#myproject_db-pu-web": org.jboss.msc.service.StartException in service jboss.persistenceunit."test.war#myproject_db-pu-web": org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [com.mycompany.hibernate.MySQLBitBooleanDialect] as strategy [org.hibernate.dialect.Dialect]
              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172) [wildfly-jpa-8.1.0.Final.jar:8.1.0.Final]
              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117) [wildfly-jpa-8.1.0.Final.jar:8.1.0.Final]
              at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_67]
              at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:474)
              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182) [wildfly-jpa-8.1.0.Final.jar:8.1.0.Final]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
              at org.jboss.threads.JBossThread.run(JBossThread.java:122)
      Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [com.mycompany.hibernate.MySQLBitBooleanDialect] as strategy [org.hibernate.dialect.Dialect]
              at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:128) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveDefaultableStrategy(StrategySelectorImpl.java:155) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveStrategy(StrategySelectorImpl.java:136) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:78) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:68) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:165) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:397) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
              at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) [hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]
              at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) [jipijapa-hibernate4-3-1.0.1.Final.jar:]
              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154) [wildfly-jpa-8.1.0.Final.jar:8.1.0.Final]
              ... 8 more
      

      Files

      persistence.xml
      ?xml version="1.0" encoding="UTF-8"?>
      <persistence
          version="2.1"
          xmlns="http://xmlns.jcp.org/xml/ns/persistence"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
          
        <persistence-unit name="maars_db-pu" transaction-type="JTA">
          <jta-data-source>java:jboss/datasources/mycompany-ds</jta-data-source>
          <exclude-unlisted-classes>false</exclude-unlisted-classes>
          <properties>
               <property name="hibernate.dialect" value="com.mycompany.hibernate.MySQLBitBooleanDialect" />
           	 <property name="hibernate.hbm2ddl.auto" value="validate" />
               <property name="hibernate.show_sql" value="false" />
               <property name="hibernate.format_sql" value="false" />
          </properties>
        </persistence-unit>
      </persistence>
      

      Related Issues

      I thought this was because of https://hibernate.atlassian.net/browse/HHH-7084, but it looks like this was resolved a while ago.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                the_alchemist The Alchemist
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: