<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    HibernateException: Dialect class not found in HBM2DDL ant task
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/saemmy2011">Saemmy -</a> in <i>JBoss Tools</i> - <a href="https://community.jboss.org/message/763934#763934">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am using &lt;hbm2ddl&gt; ant task for exporting DDL schema. My ant script worked fine for Hibernate 3.6 and Hibernate Tools 3.x.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>After upgading to Hibernate 4 and Hibernate Tools 4 I get the following exception:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>[hibernatetool] 2012-10-09 15:54:32,327 INFO&#160; [Version.&lt;clinit&gt;(15)] : Hibernate Tools 4.0.0</p><p>[hibernatetool] 2012-10-09 15:54:32,390 WARN&#160; [ConnectionProviderInitiator.initiateService(143)] : HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections</p><p>[hibernatetool] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)</p><p>[hibernatetool] To get the full stack trace run ant with -verbose</p><p>[hibernatetool] org.hibernate.HibernateException: Dialect class not found: com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect</p><p>[hibernatetool] org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect]</p><p>[hibernatetool] java.lang.ClassNotFoundException: Could not load requested class : com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect</p><p>[hibernatetool] A class were not found in the classpath of the Ant task.</p><p>[hibernatetool] Ensure that the classpath contains the classes needed for Hibernate and your code are in the classpath.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>BUILD FAILED</p><p>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</p><p>&#160;&#160;&#160; at org.hibernate.tool.ant.HibernateToolTask.reportException(HibernateToolTask.java:226)</p><p>&#160;&#160;&#160; at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:189)</p><p>&#160;&#160;&#160; at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)</p><p>&#160;&#160;&#160; at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)</p><p>&#160;&#160;&#160; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p>&#160;&#160;&#160; at java.lang.reflect.Method.invoke(Method.java:597)</p><p>&#160;&#160;&#160; at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)</p><p>&#160;&#160;&#160; at org.apache.tools.ant.Task.perform(Task.java:348)</p><p>&#160;&#160;&#160; at org.apache.tools.ant.Target.execute(Target.java:392)</p><p>&#160;&#160;&#160; at org.apache.tools.ant.Target.performTasks(Target.java:413)</p><p>&#160;&#160;&#160; at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)</p><p>&#160;&#160;&#160; at org.apache.tools.ant.Project.executeTarget(Project.java:1368)</p><p>&#160;&#160;&#160; at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)</p><p>&#160;&#160;&#160; at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)</p><p>&#160;&#160;&#160; at org.apache.tools.ant.Project.executeTargets(Project.java:1251)</p><p>&#160;&#160;&#160; at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)</p><p>&#160;&#160;&#160; at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)</p><p>Caused by: org.hibernate.HibernateException: Dialect class not found: com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect</p><p>&#160;&#160;&#160; at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:76)</p><p>&#160;&#160;&#160; at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:64)</p><p>&#160;&#160;&#160; at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:174)</p><p>&#160;&#160;&#160; at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)</p><p>&#160;&#160;&#160; at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)</p><p>&#160;&#160;&#160; at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)</p><p>&#160;&#160;&#160; at org.hibernate.tool.hbm2ddl.SchemaExport.&lt;init&gt;(SchemaExport.java:113)</p><p>&#160;&#160;&#160; at org.hibernate.tool.hbm2x.Hbm2DDLExporter.doStart(Hbm2DDLExporter.java:164)</p><p>&#160;&#160;&#160; at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)</p><p>&#160;&#160;&#160; at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)</p><p>&#160;&#160;&#160; at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)</p><p>&#160;&#160;&#160; ... 15 more</p><p>Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect]</p><p>&#160;&#160;&#160; at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141)</p><p>&#160;&#160;&#160; at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:73)</p><p>&#160;&#160;&#160; ... 25 more</p><p>Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mycompany.myproduct.integration.dao.hibernate.Oracle10nDialect</p><p>&#160;&#160;&#160; at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl$1.findClass(ClassLoaderServiceImpl.java:99)</p><p>&#160;&#160;&#160; at java.lang.ClassLoader.loadClass(ClassLoader.java:306)</p><p>&#160;&#160;&#160; at java.lang.ClassLoader.loadClass(ClassLoader.java:247)</p><p>&#160;&#160;&#160; at java.lang.Class.forName0(Native Method)</p><p>&#160;&#160;&#160; at java.lang.Class.forName(Class.java:247)</p><p>&#160;&#160;&#160; at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:138)</p><p>&#160;&#160;&#160; ... 26 more</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>Here is the part of my ant script:</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;target name="schemaexport" depends="clean, compile"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="build.classpath" /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;mkdir dir="${target.dir}/sql"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;hibernatetool destdir="${target.dir}/sql"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;classpath&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;path location="${build.dir}"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/classpath&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;configuration configurationfile="${build.dir}/hibernate.cfg.xml"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;hbm2ddl</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; export="false"</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; drop="true"</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; outputfilename="DB-create.sql"</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; delimiter=";"</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; format="true"</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/hibernatetool&gt;</p><p>&#160;&#160;&#160; &lt;/target&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The build.dir includes all class files, including the Oracle 10 dialect.</p><p>Did something change in the configuration of hbm2dll in Hibernate Tools 4? Or is this a bug in Hibernate Tools 4?</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/763934#763934">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Tools at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>