JBoss Community

HibernateException: Dialect class not found in HBM2DDL ant task

created by Saemmy - in JBoss Tools - View the full discussion

Hi,

 

I am using <hbm2ddl> ant task for exporting DDL schema. My ant script worked fine for Hibernate 3.6 and Hibernate Tools 3.x.

 

After upgading to Hibernate 4 and Hibernate Tools 4 I get the following exception:

 

[hibernatetool] 2012-10-09 15:54:32,327 INFO  [Version.<clinit>(15)] : Hibernate Tools 4.0.0

[hibernatetool] 2012-10-09 15:54:32,390 WARN  [ConnectionProviderInitiator.initiateService(143)] : HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections

[hibernatetool] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)

[hibernatetool] To get the full stack trace run ant with -verbose

[hibernatetool] org.hibernate.HibernateException: Dialect class not found: com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect

[hibernatetool] org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect]

[hibernatetool] java.lang.ClassNotFoundException: Could not load requested class : com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect

[hibernatetool] A class were not found in the classpath of the Ant task.

[hibernatetool] Ensure that the classpath contains the classes needed for Hibernate and your code are in the classpath.

 

BUILD FAILED

C:\Projekte\MyProduct\workspace-sts-trunk\MyProductWeb-dev\build.xml:143: org.hibernate.HibernateException: Dialect class not found: com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect

    at org.hibernate.tool.ant.HibernateToolTask.reportException(HibernateToolTask.java:226)

    at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:189)

    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)

    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:597)

    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

    at org.apache.tools.ant.Task.perform(Task.java:348)

    at org.apache.tools.ant.Target.execute(Target.java:392)

    at org.apache.tools.ant.Target.performTasks(Target.java:413)

    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)

    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)

    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)

    at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)

    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)

    at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)

    at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)

Caused by: org.hibernate.HibernateException: Dialect class not found: com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect

    at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:76)

    at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:64)

    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:174)

    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)

    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)

    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)

    at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:113)

    at org.hibernate.tool.hbm2x.Hbm2DDLExporter.doStart(Hbm2DDLExporter.java:164)

    at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)

    at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)

    at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)

    ... 15 more

Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect]

    at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141)

    at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:73)

    ... 25 more

Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect

    at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl$1.findClass(ClassLoaderServiceImpl.java:99)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

    at java.lang.Class.forName0(Native Method)

    at java.lang.Class.forName(Class.java:247)

    at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:138)

    ... 26 more

 

Here is the part of my ant script:

 

<target name="schemaexport" depends="clean, compile">

        <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="build.classpath" />

        <mkdir dir="${target.dir}/sql"/>

       

        <hibernatetool destdir="${target.dir}/sql">

            <classpath>

                <path location="${build.dir}"/>

            </classpath>

            <configuration configurationfile="${build.dir}/hibernate.cfg.xml"/>

            <hbm2ddl

                export="false"

                drop="true"

                outputfilename="DB-create.sql"

                delimiter=";"

                format="true"

            />

        </hibernatetool>

    </target>

 

The build.dir includes all class files, including the Oracle 10 dialect.

Did something change in the configuration of hbm2dll in Hibernate Tools 4? Or is this a bug in Hibernate Tools 4?

Reply to this message by going to Community

Start a new discussion in JBoss Tools at Community