-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: org.hibernate.tool.ant.HibernateToolTask : how to use it
PostPosted: Tue Aug 02, 2005 5:51 am 
Newbie

Joined: Mon Aug 30, 2004 6:25 am
Posts: 7
Hibernate version:

Hibernate - 3.0.5
Hibernate tools- 3.0.0.alpha4a

Project file tree:

$ find htest/
htest/
htest/hibernate.properties
htest/build.xml
htest/lib
htest/lib/hibernate3.jar
htest/lib/hibernate-tools.jar
htest/lib/commons-logging-1.0.4.jar
htest/src
htest/src/datamodel
htest/src/datamodel/People.hbm.xml

htest/hibernate.properties:

hibernate.dialect net.sf.hibernate.dialect.FirebirdDialect
hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
hibernate.connection.url jdbc:firebirdsql:localhost:test
hibernate.connection.username user
hibernate.connection.password password

htest/build.xml:

<project name="Hibernate Test Application" default="gen-classes" basedir=".">



<property name="application.name" value="htest"/>



<property name="src.home" value="${basedir}/src"/>

<property name="bin.home" value="${basedir}/bin"/>

<property name="lib.home" value="${basedir}/lib"/>



<path id="classpath">
<fileset dir="${lib.home}"><include name="*.jar"/></fileset>

</path>


<target name="gen-classes">

<taskdef

name="hibernatetool"

classname="org.hibernate.tool.ant.HibernateToolTask"

classpathref="classpath"/>

<hibernatetool destdir=".">

<classpath refid="classpath"/>

<configuration propertyFile="hibernate.properties">

<fileset id="hibernate.mapping.files" dir="${src.home}">

<include name="**/*.hbm.xml" />

</fileset>

</configuration>

<hbm2java/>

</hibernatetool>

</target>



</project>

htest/src/datamodel/People.hbm.xml:

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class name="datamodel.People" table="people">
<id name="id" column="id" type="integer" unsaved-value="null">
<generator class="native"/>
</id>
<property name="name" column="name" type="string" length="25" not-null="true"/>
</class>

</hibernate-mapping>

Build output:

$ ant
Buildfile: build.xml

gen-classes:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)

BUILD FAILED
java.lang.ExceptionInInitializerError

Total time: 1 second

What is wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 02, 2005 6:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
first thing is that you should use version 3 DTD's not version 2 DTD's for hibernate 3 mappings.

furthermore to debug ant, run ant with -debug or -verbose to get the full exception stacktrace.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 02, 2005 8:06 am 
Newbie

Joined: Mon Aug 30, 2004 6:25 am
Posts: 7
I have only this jars now in my classpath:

$ ls -l lib
total 1824
-rw-r--r-- 1 john john 38015 May 25 01:03 commons-logging-1.0.4.jar
-rw-r--r-- 1 john john 137589 Aug 2 11:04 hibernate-tools.jar
-rw-r--r-- 1 john john 1674454 May 25 01:00 hibernate3.jar

But I get this error:

$ ant -v

Apache Ant version 1.6.2 compiled on August 26 2004
Buildfile: build.xml
Detected Java version: 1.4 in: /usr/lib/j2se1.4-sun/jre
Detected OS: Linux
parsing buildfile /home/john/workspace/htest/build.xml with URI = file:///home/john/workspace/htest/build.xml
Project base dir set to: /home/john/workspace/htest
Build sequence for target `gen-classes' is [gen-classes]
Complete build sequence is [gen-classes, ]

gen-classes:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)

BUILD FAILED
java.lang.ExceptionInInitializerError
at org.apache.tools.ant.Project.executeTarget(Unknown Source)
at org.apache.tools.ant.Project.executeTargets(Unknown Source)
at org.apache.tools.ant.Main.runBuild(Unknown Source)
at org.apache.tools.ant.Main.startAnt(Unknown Source)
at org.apache.tools.ant.launch.Launcher.run(Unknown Source)
at org.apache.tools.ant.launch.Launcher.main(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
at org.hibernate.tool.ant.Hbm2JavaGeneratorTask.createExporter(Hbm2JavaGeneratorTask.java:44)
at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:32)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:115)
at org.apache.tools.ant.UnknownElement.execute(Unknown Source)
at org.apache.tools.ant.Task.perform(Unknown Source)
at org.apache.tools.ant.Target.execute(Unknown Source)
at org.apache.tools.ant.Target.performTasks(Unknown Source)
... 6 more
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.hibernate.tool.hbm2x.POJOExporter.<clinit>(POJOExporter.java:26)
... 13 more
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 17 more
Caused by: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385)
... 18 more
--- Nested Exception ---
java.lang.ExceptionInInitializerError
at org.hibernate.tool.ant.Hbm2JavaGeneratorTask.createExporter(Hbm2JavaGeneratorTask.java:44)
at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:32)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:115)
at org.apache.tools.ant.UnknownElement.execute(Unknown Source)
at org.apache.tools.ant.Task.perform(Unknown Source)
at org.apache.tools.ant.Target.execute(Unknown Source)
at org.apache.tools.ant.Target.performTasks(Unknown Source)
at org.apache.tools.ant.Project.executeTarget(Unknown Source)
at org.apache.tools.ant.Project.executeTargets(Unknown Source)
at org.apache.tools.ant.Main.runBuild(Unknown Source)
at org.apache.tools.ant.Main.startAnt(Unknown Source)
at org.apache.tools.ant.launch.Launcher.run(Unknown Source)
at org.apache.tools.ant.launch.Launcher.main(Unknown Source)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.hibernate.tool.hbm2x.POJOExporter.<clinit>(POJOExporter.java:26)
... 13 more
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 17 more
Caused by: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385)
... 18 more

Total time: 1 second


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 02, 2005 8:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
this logging stuff has been talked about before - search in the forum

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.