hibernateTool not working


(Rohit Kumar Singh) #1

I’m trying to create a task to convert cfg to sql and I’m using hibernate 3.

My ant task for same looks like this -

ant {
taskdef(name: ‘hibernateTool’,
classname: ‘org.hibernate.tool.ant.HibernateToolTask’,
classpath: configurations.hibernatetool.asPath
hibernateTool(destdir: ‘resources/b2c/hibernate/schema’) {
annotationconfiguration(configurationfile: ‘resources/b2c/hibernate/hibernate.b2c.cfg.xml’)
hbm2ddl(export: true, outputfilename: ‘db-b2c-update-ddl.sql’)
classpath {
pathelement(path: ‘classes’)
fileset(dir: ‘…/intl_lib’) {
include(name: ‘**/*.jar’)

I have added the following dependencies for the same -

hibernatetool group: ‘org.hibernate’, name: ‘hibernate-tools’, version: '3.2.4.GA
hibernatetool group: ‘org.hibernate’, name: ‘hibernate-entitymanager’, version: ‘3.6.10.Final’

Applied plugin -

id “org.hibernate.gradle.tools” version “1.2.3”

Set configuration as -

configurations {

I’m getting the following error while running the task -

[ant:hibernateTool] SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
[ant:hibernateTool] SLF4J: Defaulting to no-operation (NOP) logger implementation
[ant:hibernateTool] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Here is the stack trace for the same -
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1366)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1315)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1068)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 165 more

Any leads on this is appreciated.


(Pepper Lebeck-Jobe) #2

Hi Rohit,

I haven’t been able to find someone with expertise on using the hibernate plugin.
Is it the one developed here: https://plugins.gradle.org/plugin/org.hibernate.gradle.tools
Maybe you could contact the main contributor to that project on GitHub?


P.S. Requests for help like this one where you don’t have clear evidence of a bug belong on the Help/Discuss topic.

(Mownathi Manigundan) #3

Adding the following dependencies should fix the mentioned issue related to slf4j.

hibernatetool group: ‘org.slf4j’, name: ‘slf4j-simple’, version: '1.6.6’
hibernatetool group: ‘org.slf4j’, name: ‘jcl-over-slf4j’, version: ‘1.6.6’

It would also be required to add this log4j dependency in order to fix java.lang.NoClassDefFoundError: org/apache/log4j/Priority this error.

hibernatetool group: ‘log4j’, name: ‘log4j’, version: ‘1.2.17’