-->
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.  [ 7 posts ] 
Author Message
 Post subject: exporting DB schema issue
PostPosted: Sun Sep 06, 2009 2:39 am 
Newbie

Joined: Sun Aug 23, 2009 2:43 am
Posts: 9
As i try to export DB schema using Ant script I got the following error
Here is my ant script
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask">
<classpath refid="project.classpath"/>
<classpath path="${classes.dir}"/>
</taskdef>


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

<hibernatetool destdir="${basedir}">
<classpath path="${build.dir}"/>
<configuration configurationfile="${build.dir}/hibernate.cfg.xml"/>
<hbm2ddl drop="true" create="true" export="true" outputfilename="helloworld-ddl.sql" delimiter=";" format="true"/>

</hibernatetool>

</target>



C:\eclipsehibernatemanning\WORKDIIR>ant schemaexport
Buildfile: build.xml

compile:

copymetafiles:

schemaexport:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)

BUILD FAILED
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.hibernate.tool.hbm2ddl.SchemaExport.<clinit>(SchemaExport.java:47)
at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:183)
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:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 0 seconds


Top
 Profile  
 
 Post subject: Re: exporting DB schema issue
PostPosted: Sun Sep 06, 2009 6:35 am 
Newbie

Joined: Sat Sep 05, 2009 3:24 pm
Posts: 3
Do you have commons-logging.jar in your classpath ??


Top
 Profile  
 
 Post subject: Re: exporting DB schema issue
PostPosted: Sun Sep 06, 2009 11:03 am 
Newbie

Joined: Sun Aug 23, 2009 2:43 am
Posts: 9
Yes I do have commons-logging.jar in myclasspath ,still I can't figure out what is wrong with it


Top
 Profile  
 
 Post subject: Re: exporting DB schema issue
PostPosted: Sun Sep 06, 2009 6:36 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Quote:
org/apache/commons/logging/LogFactory


Clearly, that class isn't being located at runtime. Where on your classpath have you placed it, and how is your runtime environment linking to it. Remember, design time and runtime classpaths are often configured differently. Just because it compiles, doesn't mean it will run!

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: exporting DB schema issue
PostPosted: Mon Sep 07, 2009 2:33 am 
Newbie

Joined: Sun Aug 23, 2009 2:43 am
Posts: 9
Thanks cameron. I was able to fix that issue.But I am still getting the following error


C:\eclipsehibernatemanning\WORKDIIR>ant schemaexport
Buildfile: build.xml

schemaexport:
[schemaexport] SLF4J: Class path contains multiple SLF4J bindings.
[schemaexport] SLF4J: Found binding in [jar:file:/C:/eclipsehibernatemanning/WORKDIIR/lib/slf4j-jdk14-1.5.8.jar!/org/slf4j/impl/StaticLoggerBin
[schemaexport] SLF4J: Found binding in [jar:file:/C:/eclipsehibernatemanning/WORKDIIR/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerB
[schemaexport] SLF4J: Found binding in [jar:file:/C:/eclipsehibernatemanning/WORKDIIR/lib/slf4j-nop-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinde
[schemaexport] SLF4J: Found binding in [jar:file:/C:/eclipsehibernatemanning/WORKDIIR/lib/slf4j-simple-1.5.8.jar!/org/slf4j/impl/StaticLoggerBi
[schemaexport] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: Hibernate 3.3.0.SP1
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: hibernate.properties not found
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.cfg.Environment buildBytecodeProvider
[schemaexport] INFO: Bytecode provider name : javassist
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: using JDK 1.4 java.sql.Timestamp handling
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.dialect.Dialect <init>
[schemaexport] INFO: Using dialect: org.hibernate.dialect.HSQLDialect
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
[schemaexport] INFO: Running hbm2ddl schema export
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
[schemaexport] INFO: writing generated schema to file: C:\eclipsehibernatemanning\WORKDIIR\schema-export.sql
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
[schemaexport] INFO: exporting generated schema to database
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[schemaexport] INFO: Using Hibernate built-in connection pool (not for production use!)
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[schemaexport] INFO: Hibernate connection pool size: 20
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[schemaexport] INFO: autocommit mode: false
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[schemaexport] INFO: using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hsql://localhost
[schemaexport] Sep 7, 2009 1:28:00 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[schemaexport] INFO: connection properties: {user=sa, password=****}
[schemaexport] Sep 7, 2009 1:28:01 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
[schemaexport] SEVERE: schema export unsuccessful
[schemaexport] java.sql.SQLException: socket creation error
[schemaexport] at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
[schemaexport] at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
[schemaexport] at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
[schemaexport] at org.hsqldb.jdbcDriver.connect(Unknown Source)
[schemaexport] at java.sql.DriverManager.getConnection(DriverManager.java:525)
[schemaexport] at java.sql.DriverManager.getConnection(DriverManager.java:140)
[schemaexport] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
[schemaexport] at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:52)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:252)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:169)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[schemaexport] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[schemaexport] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[schemaexport] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[schemaexport] at java.lang.reflect.Method.invoke(Method.java:585)
[schemaexport] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:348)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:357)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[schemaexport] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[schemaexport] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[schemaexport] at org.apache.tools.ant.Main.runBuild(Main.java:758)
[schemaexport] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[schemaexport] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
[schemaexport] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

BUILD SUCCESSFUL


Top
 Profile  
 
 Post subject: Re: exporting DB schema issue
PostPosted: Mon Sep 07, 2009 7:46 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Quote:
java.sql.SQLException: socket creation error


Is your database started? Can you connect to it?

Sounds like a problem just connecting to the database.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: exporting DB schema issue
PostPosted: Mon Sep 07, 2009 12:01 pm 
Newbie

Joined: Sun Aug 23, 2009 2:43 am
Posts: 9
Yes I was able to connect to Database. I did start DB as well for schema exprot,but still having the following issue as I mentioned earlier, do not know why


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.