-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem using Ant to create a schemaexport
PostPosted: Mon Jun 25, 2007 2:58 pm 
Newbie

Joined: Mon Jun 25, 2007 12:08 pm
Posts: 8
Newbee....

Trying to following HelloWorld sample in Chapter 2.
Currently working on section 2.2.1 Using Hibernate Annotations...

Hibernate version:
Hibernate 3.2
Hibernate-annotations-3.3.0.GA

Ant Target code:
<target name="schemaexport" depends="compile, copymetafiles"
description="Exports a generated schema to DB and file">

<hibernatetool destdir="${basedir}">
<classpath>
<pathelement path="${build.dir}"/>
<pathelement location="lib/hibernate-commons-annotations.jar"/>
<pathelement location="lib/ejb3-persistence.jar"/>
</classpath>
<annotationconfiguration
configurationfile="${build.dir}/hibernate.cfg.xml" />
<hbm2ddl
drop="true"
create="true"
export="true"
outputfilename="helloworld-ddl.sql"
delimiter=";"
format="true"/>
</hibernatetool>

</target>

hibernate.cfg.xml:
<!DOCTYPE hibernate-configuration SYSTEM
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:microsoft:sqlserver://130.126.4.66:1433;databaseName=StevesTesting;SelectMethod=cursor</property>
<property name="hibernate.connection.username">snelliga</property>
<property name="hibernate.connection.password">smn-1812</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>

<!-- Use the C3P0 connection pool provider -->
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">300</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>

<!-- Show and print nice SQL on stdout -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>

<!-- List of XML mapping files -->
<mapping resource="hello/Message.hbm.xml"/>

</session-factory>
</hibernate-configuration>


Full stack trace of any exception that occurs:

Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
1. task: hbm2ddl (Generates database schema)
An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
To get the full stack trace run ant with -verbose
Problems in creating a AnnotationConfiguration. Have you remembered to add it to the classpath ?
java.lang.ClassNotFoundException: org.hibernate.cfg.AnnotationConfiguration
A class were not found in the classpath of the Ant task.
Ensure that the classpath contains the classes needed for Hibernate and your code are in the classpath.
C:\IDEAProjects\JavaPersistenceWithHibernateAnnotations\build.xml:70: Problems in creating a AnnotationConfiguration. Have you remembered to add it to the classpath ?
at org.hibernate.tool.ant.AnnotationConfigurationTask.createConfiguration(AnnotationConfigurationTask.java:30)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:287)
at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:171)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
...

_________________
Steve


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 26, 2007 8:45 am 
Newbie

Joined: Mon Jun 25, 2007 12:08 pm
Posts: 8
Found the problem.

I included the library hibernate-common-annotations.jar and not hibernate-annotations.jar. I find this library in the lib folder and thought that it was a typo in the book.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.