-->
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: Which JAR file for org.hibernate.tool.hbm2ddl.SchemaExport ?
PostPosted: Tue Feb 20, 2007 4:46 pm 
Newbie

Joined: Tue Feb 20, 2007 4:14 pm
Posts: 8
I'm working my way through Chapter 2 of Java Persistence with Hibernate and have run into a problem.

On page 65, there is an Ant taskdef for doing a schema export. However, when I run that Ant task, I get this error message:

    BUILD FAILED
    java.lang.NoSuchMethodError: org.hibernate.tool.hbm2ddl.SchemaExport.setHaltOnError(Z) Lorg/hibernate/tool/hbm2ddl/SchemaExport;

Presumably this indicates that I'm missing a jar file in my build path. (I'm using Eclipse.) However, I'm unable to figure out what is missing.

I have hibernate-tools.jar in there, but when I browse through that jar file, I see a package named org.hibernate.tool.hbm2x, but not one named org.hibernate.tool.hbm2ddl.

Am I missing a jar file? Here's what I have in my build path:
    antlr-2.7.6rc1.jar
    asm-attrs.jar
    asm.jar
    c3p0-0.9.0.jar
    cglib-2.1.3.jar
    commons-collections-3.1.jar
    commons-logging-1.0.4.jar
    dom4j-1.6.1.jar
    ehcache-1.1.jar
    hibernate-tools.jar
    hibernate3.jar
    jta.jar
    log4j-1.2.13.jar
    sqljdbc.jar

I'm using Java 1.5.0_10, Eclipse 3.2.1, Hibernate Core 3.2.2, Hibernate Tools 3.2.0 beta9, and Microsoft SQL Server on Windows XP.

Here's the full console output of the ant task:
    Buildfile: C:\Documents and Settings\epauser\My Documents\Eclipse Workspace\JPWH Hello World\build.xml
    clean:
    [delete] Deleting directory C:\Documents and Settings\epauser\My Documents\Eclipse Workspace\JPWH Hello World\classes
    [mkdir] Created dir: C:\Documents and Settings\epauser\My Documents\Eclipse Workspace\JPWH Hello World\classes
    compile:
    [javac] Compiling 3 source files to C:\Documents and Settings\epauser\My Documents\Eclipse Workspace\JPWH Hello World\classes
    copymetafiles:
    [copy] Copying 4 files to C:\Documents and Settings\epauser\My Documents\Eclipse Workspace\JPWH Hello World\classes
    schemaexport:
    [hibernatetool] Executing Hibernate Tool with a Standard Configuration
    [hibernatetool] 1. task: hbm2ddl (Generates database schema)
    [hibernatetool] 14:13:09,812 INFO Environment:456 - Hibernate 3.0rc1
    [hibernatetool] 14:13:09,828 INFO Environment:469 - hibernate.properties not found
    [hibernatetool] 14:13:09,828 INFO Environment:502 - using CGLIB reflection optimizer
    [hibernatetool] 14:13:09,843 INFO Environment:532 - using JDK 1.4 java.sql.Timestamp handling
    [hibernatetool] 14:13:09,843 INFO Configuration:1262 - configuring from file: hibernate.cfg.xml
    [hibernatetool] 14:13:10,000 INFO Configuration:439 - Mapping resource: hello/Message.hbm.xml
    [hibernatetool] 14:13:10,187 INFO HbmBinder:256 - Mapping class: hello.Message -> Message
    [hibernatetool] 14:13:10,375 INFO Configuration:1340 - Configured SessionFactory: null
    [hibernatetool] 14:13:10,375 INFO Configuration:844 - processing extends queue
    [hibernatetool] 14:13:10,390 INFO Configuration:848 - processing collection mappings
    [hibernatetool] 14:13:10,390 INFO Configuration:857 - processing association property references
    [hibernatetool] 14:13:10,390 INFO Configuration:884 - processing foreign key constraints
    [hibernatetool] 14:13:10,406 INFO Dialect:89 - Using dialect: org.hibernate.dialect.SQLServerDialect
    [hibernatetool] 14:13:10,421 INFO Configuration:844 - processing extends queue
    [hibernatetool] 14:13:10,421 INFO Configuration:848 - processing collection mappings
    [hibernatetool] 14:13:10,421 INFO Configuration:857 - processing association property references
    [hibernatetool] 14:13:10,421 INFO Configuration:884 - processing foreign key constraints
    [hibernatetool] 14:13:10,500 INFO Configuration:844 - processing extends queue
    [hibernatetool] 14:13:10,500 INFO Configuration:848 - processing collection mappings
    [hibernatetool] 14:13:10,500 INFO Configuration:857 - processing association property references
    [hibernatetool] 14:13:10,500 INFO Configuration:884 - processing foreign key constraints

    BUILD FAILED
    java.lang.NoSuchMethodError: org.hibernate.tool.hbm2ddl.SchemaExport.setHaltOnError(Z)Lorg/hibernate/tool/hbm2ddl/SchemaExport;

    Total time: 3 seconds


Top
 Profile  
 
 Post subject: Doh! Found it.
PostPosted: Tue Feb 20, 2007 5:06 pm 
Newbie

Joined: Tue Feb 20, 2007 4:14 pm
Posts: 8
After I posted that message, I noticed that the output of the ant build was showing a Hibernate environment of 3.0 rc 1(!), not 3.2.2. I investigated and discovered that I was using an old hibernate3.jar file. I replaced it with the 3.2.2 jar file and suddenly it works!

So, in answer to my own question, org.hibernate.tool.hbm2ddl.SchemaExport is in the hibernate3.jar file.


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.