Java EE tutorial, problem with ANT populating database
Hi!
I have followed the instructions in the Java EE tutorial to set up the enviroment but when I execute the command "ant create tables" I get this output:
C:\javaeetutorial5\examples\web\bookstore1>ant create-tables
Buildfile: build.xml
-pre-init:
init:
check:
tools:
start-db:
BUILD FAILED
C:\javaeetutorial5\examples\bp-project\app-server-ant.xml:140: The directory you specified does not exist
I have changed in the build.properties file to this:
#
# The SDK's default installation on Windows is c:/Sun/SDK
# The Application Server's default installation on Windows is
# c:/Sun/AppServer
#
javaee.home=C:\Sun\SDK
javaee.tutorial.home=C:\javaeetutorial5
# machine name (or the IP address) where the applications will be deployed.
javaee.server.name=localhost
# port number where the app-server is accessed by the users
javaee.server.port=8080
# port number where the admin server of the app-server is available
javaee.adminserver.port=4848
# Uncomment the property j2ee.server.username,
# and replace the administrator username of the app-server
javaee.server.username=admin
# Uncomment the property j2ee.server.passwordfile,
# and replace the following line to point to a file that
# contains the admin passwordfor your app-server.
# The file should contain the password in the following line:
#
# AS_ADMIN_PASSWORD=adminadmin
#
# Notice that the password is adminadmin sincethis is
# thedefault password used by the glassfish app-server installation.
#
javaee.server.passwordfile=${javaee.tutorial.home}\examples\common\admin-passwo rd.txt
appserver.instance=server
# Uncomment and setthis property to the location of the browser you
# choose to launch when an application is deployed.
# On Windows and Mac OS X thedefault browser is used.
#default.browser=\Applications\Firefox.app\Contents\MacOS\firefox-bin
# Database vendor propertyfor db tasks
db.vendor=javadb
# Digital certificate propertiesfor mutual authentication
keystore=${javaee.tutorial.home}\examples\jaxws\simpleclient-cert\support\clien t_keystore.jks
truststore=${javaee.home}\domains\domain1\config\cacerts.jks
keystore.password=changeit
truststore.password=changeit
Any idea which directory the error refers to?
I磎 using Netbeans 5.5 and have a connection to my local mysql database.
[3053 byte] By [
blackgatea] at [2007-11-27 5:09:01]

Ok, this is the build.xml from bookstore1:
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="bookstore1" default="default" basedir=".">
<description>Builds, tests, and runs the project bookstore1.</description>
<property name="is.war.module" value="true" />
<property name="uses.db.sql.file" value="true"/>
<path id="common.jars">
<filelist dir="../bookstore" files="build.xml"/>
</path>
<macrodef name="iterate">
<attribute name="target"/>
<sequential>
<subant target="@{target}" failonerror="false">
<buildpath refid="common.jars"/>
</subant>
</sequential>
</macrodef>
<import file="../../bp-project/main.xml" />
<target name="-pre-deploy" unless="netbeans.home">
<antcall target="create-tables"/>
</target>
<target name="-pre-compile" unless="netbeans.home" depends="init,build-common,copy-common-jars"/>
<target name="build-common" unless="netbeans.home" depends="init">
<iterate target="default"/>
</target>
<target name="copy-common-jars" unless="netbeans.home" depends="init">
<mkdir dir="${build.web.dir}/WEB-INF/lib"/>
<copy file="${reference.bookstore.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
</project>
And the build.xml in bookstore looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="bookstore1" default="default" basedir=".">
<description>Builds, tests, and runs the project bookstore1.</description>
<property name="is.war.module" value="true" />
<property name="uses.db.sql.file" value="true"/>
<path id="common.jars">
<filelist dir="../bookstore" files="build.xml"/>
</path>
<macrodef name="iterate">
<attribute name="target"/>
<sequential>
<subant target="@{target}" failonerror="false">
<buildpath refid="common.jars"/>
</subant>
</sequential>
</macrodef>
<import file="../../bp-project/main.xml" />
<target name="-pre-deploy" unless="netbeans.home">
<antcall target="create-tables"/>
</target>
<target name="-pre-compile" unless="netbeans.home" depends="init,build-common,copy-common-jars"/>
<target name="build-common" unless="netbeans.home" depends="init">
<iterate target="default"/>
</target>
<target name="copy-common-jars" unless="netbeans.home" depends="init">
<mkdir dir="${build.web.dir}/WEB-INF/lib"/>
<copy file="${reference.bookstore.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
</project>
And the main.xml in \bp-projects looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved. You may not modify, use, reproduce, or distribute this software except in compliance with the terms of the License at:
http://developer.sun.com/berkeley_license.html
$Id: main.xml,v 1.2 2006/04/12 17:20:13 ie139813 Exp $ -->
<!-- main.xml: this is the file that should be included by the project
build files. It will figure out whether it is running from inside Netbeans
or command line and include appropriate tasks.
@Author: Inderjeet Singh -->
<project name="main" default="dummy-default">
<property file="build.properties"/>
<property value="1.5" name="default.javac.source"/>
<property value="1.5" name="default.javac.target"/>
<condition property="common-ant-tasks-file"
value="${ant.file}/../nbproject/build-impl.xml"
else="${ant.file.main}/../command-line-ant-tasks.xml">
<and>
<isset property="netbeans.home"/>
<available file="${ant.file}/../nbproject/build-impl.xml"/>
</and>
</condition>
<import file="${common-ant-tasks-file}"/>
<target name="dummy-default"/>
</project>