File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Problem in schema export - Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem in schema export - Hibernate" Watch "Problem in schema export - Hibernate" New topic
Author

Problem in schema export - Hibernate

kapil patel
Ranch Hand

Joined: Sep 30, 2005
Posts: 33
Hello friends,
I am not able to understand where is the problem?? I run the program without exporting schema/Ant script it is working fine... However, when I try to use ant script for exporting schema. following error occurs:

NullPointerException. I know it is presummed that there is some null value. But error is from Ant script directly so I am not able to debug.. Can anyone help me please??



<?xml version="1.0"?>
<project name="build4.xml" default="build">
<property name="src.java.dir" value="src/java" />
<property name="build.classes.dir" value="build/classes" />
<property name="hibernate.version" value="3.1" />
<property name="mysql.jdbc.version" value="3.1.12" />
<property name="applications.dir" location="/applications" />
<property name="hibernate.lib.dir"
value="${applications.dir}/hibernate-${hibernate.version}" />
<property name="jdbc.driver.jar"
value="${applications.dir}/mysql-connector-java-${mysql.jdbc.version}/mysql-connector-java-${mysql.jdbc.version}-bin.jar" />
<import file="hibernate-build.xml" />
<path id="project.classpath">
<pathelement location="${build.classes.dir}" />
</path>
<path id="runtime.classpath">
<path refid="project.classpath" />
<path refid="hibernate.lib.path" />
<pathelement location="${jdbc.driver.jar}" />
<pathelement location="${src.java.dir}" />
</path>
<target name="clean">
<delete dir="${build.classes.dir}" />
</target>
<target name="init">
<mkdir dir="${build.classes.dir}" />
</target>
<target name="compile" depends="init">
<javac srcdir="${src.java.dir}"
destdir="${build.classes.dir}">
<classpath refid="hibernate.lib.path" />
</javac>
<echo>If you see this, it works!!! compile done</echo>
</target>
<target name="build" depends="compile">
<java classname="com.manning.hq.ch04.EventLoader">
<classpath refid="runtime.classpath" />
</java>
</target>
<target name="schema-export" depends="compile">
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask">
<classpath refid="runtime.classpath" />
</taskdef>
<schemaexport config="${src.java.dir}/hibernate.cfg.xml" />
<echo>If you see this, it works!!! schema done</echo>
</target>
</project>

************************

Thanks in advance
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
how about showing the excepttion that you get ?
kapil patel
Ranch Hand

Joined: Sep 30, 2005
Posts: 33
Hi pascal,

I have found following exception only;

BUILD FAILED: C:\d\software\eclipse\workspace\NewCalendarProject\build4.xml:44: java.lang.NullPointerException

*****

I figured out there is problme because of Schemaexport.. It is expecting some parameter not to be null... But I dont know what??

If you know, please do let me know
 
Don't get me started about those stupid light bulbs.
 
subject: Problem in schema export - Hibernate