Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3347232
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:23:50+00:00 2026-05-18T01:23:50+00:00

I am trying to learn Hibernate from Java Persistence with hibernate by Gavin King.

  • 0

I am trying to learn Hibernate from Java Persistence with hibernate by Gavin King.

I just downloaded the examples given in the book from this location http://downloads.jboss.org/hibernate/caveatemptor/jpwh-gettingstarted-070401.zip

I started my HSQL db using ant startdb and database started successfully.

When trying to run the target schemaexport I am getting the below error..

schemaexport: [hibernatetool]
Executing Hibernate Tool with a
Standard Configuration [hibernatetool]
1. task: hbm2ddl (Generates database schema) [hibernatetool] 18:07:56,555
INFO Environment:500 – Hibernate
3.2.0.cr5 [hibernatetool] 18:07:56,555 INFO Environment:533 –
hibernate.properties not fo und
[hibernatetool] 18:07:56,555 INFO
Environment:667 – Bytecode provider
name : cg lib [hibernatetool]
18:07:56,571 INFO Environment:584 –
using JDK 1.4 java.sql.Time stamp
handling [hibernatetool] 18:07:56,617
INFO Configuration:1384 – configuring
from file: h ibernate.cfg.xml
[hibernatetool] 18:07:56,680 INFO
Configuration:507 – Reading mappings
from res ource: hello/Message.hbm.xml
[hibernatetool] 18:07:56,758 INFO
HbmBinder:300 – Mapping class:
hello.Message
-> MESSAGES [hibernatetool] 18:07:56,851 INFO Configuration:1465
– Configured SessionFactor y: null [hibernatetool] 18:07:56,851 INFO
Dialect:141 – Using dialect:
org.hibernate.di alect.HSQLDialect
[hibernatetool] 18:07:56,914 INFO
SchemaExport:154 – Running hbm2ddl
schema exp ort [hibernatetool]
18:07:56,914 INFO SchemaExport:174 –
writing generated schema t o file:
C:\Users\Ramesh\Desktop\Tutorials\hibernate\Hibernate
Code samples\jpwh-
gettingstarted-070401\helloworld-native\helloworld-ddl.sql
[hibernatetool] 18:07:56,914 INFO
SchemaExport:179 – exporting generated
schema to database [hibernatetool]
18:07:56,914 INFO
C3P0ConnectionProvider:50 – C3P0 using
driver : org.hsqldb.jdbcDriver at URL:
jdbc:hsqldb:hsql://localhost
[hibernatetool] 18:07:56,914 INFO
C3P0ConnectionProvider:51 – Connection
proper ties: {user=sa} [hibernatetool]
18:07:56,914 INFO
C3P0ConnectionProvider:54 – autocommit
mode: false [hibernatetool]
18:08:26,554 WARN
BasicResourcePool:1222 –
com.mchange.v2.resou
rcepool.BasicResourcePool$AcquireTask@61f1680f
— Acquisition Attempt Failed!!! Clearing pending acquires. While
trying to acquire a needed new
resource, we fai led to succeed more
than the maximum number of allowed
acquisition attempts (30) .
[hibernatetool] 18:08:26,554 ERROR
SchemaExport:202 – schema export
unsuccessful

[hibernatetool] java.sql.SQLException:
Connections could not be acquired from
th e underlying database!
[hibernatetool] at
com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.j
ava:104) [hibernatetool] at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.che
ckoutPooledConnection(C3P0PooledConnectionPool.java:236)
[hibernatetool] at
com.mchange.v2.c3p0.PoolBackedDataSource.getConnectio
n(PoolBackedDataSource.java:94)
[hibernatetool] at
org.hibernate.connection.C3P0ConnectionProvider.getCo
nnection(C3P0ConnectionProvider.java:35)
[hibernatetool] at
org.hibernate.tool.hbm2ddl.ManagedProviderConnectionH
elper.prepare(ManagedProviderConnectionHelper.java:28)
[hibernatetool] at
org.hibernate.tool.hbm2ddl.SchemaExport.execute(Schem
aExport.java:180) [hibernatetool]
at
org.hibernate.tool.hbm2ddl.SchemaExport.create(Schema
Export.java:133) [hibernatetool]
at
org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hb
m2DDLExporterTask.java:55)
[hibernatetool] at
org.hibernate.tool.ant.HibernateToolTask.execute(Hibe
rnateToolTask.java:171)
[hibernatetool] at
org.apache.tools.ant.UnknownElement.execute(UnknownEl
ement.java:291) [hibernatetool]
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
M ethod) [hibernatetool] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMet
hodAccessorImpl.java:39)
[hibernatetool] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Deleg
atingMethodAccessorImpl.java:25)
[hibernatetool] at
java.lang.reflect.Method.invoke(Method.java:597)
[hibernatetool] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(D
ispatchUtils.java:106) [hibernatetool]
at
org.apache.tools.ant.Task.perform(Task.java:348)
[hibernatetool] at
org.apache.tools.ant.Target.execute(Target.java:390)
[hibernatetool] at
org.apache.tools.ant.Target.performTasks(Target.java:
411) [hibernatetool] at
org.apache.tools.ant.Project.executeSortedTargets(Pro
ject.java:1397) [hibernatetool]
at
org.apache.tools.ant.Project.executeTarget(Project.ja
va:1366) [hibernatetool] at
org.apache.tools.ant.helper.DefaultExecutor.executeTa
rgets(DefaultExecutor.java:41)
[hibernatetool] at
org.apache.tools.ant.Project.executeTargets(Project.j
ava:1249) [hibernatetool] at
org.apache.tools.ant.Main.runBuild(Main.java:801)
[hibernatetool] at
org.apache.tools.ant.Main.startAnt(Main.java:218)
[hibernatetool] at
org.apache.tools.ant.launch.Launcher.run(Launcher.jav
a:280) [hibernatetool] at
org.apache.tools.ant.launch.Launcher.main(Launcher.ja
va:109) [hibernatetool] Caused by:
com.mchange.v2.resourcepool.CannotAcquireResourceExce
ption: A ResourcePool could not
acquire a resource from its primary
factory or s ource. [hibernatetool]
at
com.mchange.v2.resourcepool.BasicResourcePool.awaitAc
quire(BasicResourcePool.java:970)
[hibernatetool] at
com.mchange.v2.resourcepool.BasicResourcePool.checkou
tResource(BasicResourcePool.java:208)
[hibernatetool] at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.che
ckoutPooledConnection(C3P0PooledConnectionPool.java:232)
[hibernatetool] … 24 more
[hibernatetool] 1 errors occurred
while performing .
[hibernatetool] Error #1:
java.sql.SQLException: Connections
could not be acquir ed from the
underlying database! [hibernatetool]
18:08:26,569 WARN
BasicResourcePool:1222 –
com.mchange.v2.resou
rcepool.BasicResourcePool$AcquireTask@72f864fe
— Acquisition Attempt Failed!!! Clearing pending acquires. While
trying to acquire a needed new
resource, we fai led to succeed more
than the maximum number of allowed
acquisition attempts (30) .`

I don’t have too much knowledge about either hiberate or HSQL..

Some one please explain whats wrong here??

Thanks

EDIT: I am trying to run the project helloworld-native.

The target given in the ant build.xml for startdb is as below:

<!-- Start the HSQL DB server -->
<target name="startdb" description="Run HSQL database server with clean DB">
    <!-- Delete database files -->
    <delete dir="${database.dir}"/>
    <java classname="org.hsqldb.Server"
          fork="yes"
          classpathref="project.classpath"
          failonerror="true">
        <arg value="-database.0"/>
        <arg value="file:${database.dir}/db"/>
    </java>
</target>

and when i run the command ant startdb i see the below output:

startdb:
     [delete] Deleting directory C:\Users\Ramesh\Desktop\Tutorials\hibernate\Hibernate Code samples\jpwh-gettingstarted-070401\helloworld-native\database
     [java] [Server@15ded0fd]: [Thread[main,5,main]]: checkRunning(false) entered
     [java] [Server@15ded0fd]: [Thread[main,5,main]]: checkRunning(false) exited

     [java] [Server@15ded0fd]: Startup sequence initiated from main() method
     [java] [Server@15ded0fd]: Loaded properties from [C:\Users\Ramesh\Desktop\Tutorials hibernate\Hibernate Code samples\jpwh-gettingstarted-070401\helloworld-native\server.properties]
     [java] [Server@15ded0fd]: Initiating startup sequence...
     [java] [Server@15ded0fd]: Server socket opened successfully in 29 ms.
     [java] [Server@15ded0fd]: Database [index=0, id=0, db=file:database/db, alias=] opened sucessfully in 469 ms.
     [java] [Server@15ded0fd]: Startup sequence completed in 523 ms.
     [java] [Server@15ded0fd]: 2010-11-08 22:11:08.027 HSQLDB server 1.8.0 is online
     [java] [Server@15ded0fd]: To close normally, connect and execute SHUTDOWN SQL
     [java] [Server@15ded0fd]: From command line, use [Ctrl]+[C] to abort abruptly

Then, i think i am running HSQL DB in server mode only (from the above output)..

Please tell me what else I am missing..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:23:51+00:00Added an answer on May 18, 2026 at 1:23 am

    Update: After a second look, it appears that I was wrong, you can start HSQL in server mode using the ant script and you’re not forced to use the command line. Actually, I tried to reproduce the problem with the helloworld-native sample but it worked fine for me.

    First, I started HSQLDB in a first shell using ant startdb:

    $ ant startdb 
    Buildfile: /home/pascal/Projects/jpwh-gettingstarted-070401/helloworld-native/build.xml
    
    startdb:
         [java] [Server@a97b0b]: [Thread[main,5,main]]: checkRunning(false) entered
         [java] [Server@a97b0b]: [Thread[main,5,main]]: checkRunning(false) exited
         [java] [Server@a97b0b]: Startup sequence initiated from main() method
         [java] [Server@a97b0b]: Loaded properties from [/home/pascal/Projects/jpwh-gettingstarted-070401/helloworld-native/server.properties]
         [java] [Server@a97b0b]: Initiating startup sequence...
         [java] [Server@a97b0b]: Server socket opened successfully in 39 ms.
         [java] [Server@a97b0b]: Database [index=0, id=0, db=file:database/db, alias=] opened sucessfully in 1148 ms.
         [java] [Server@a97b0b]: Startup sequence completed in 1281 ms.
         [java] [Server@a97b0b]: 2010-11-08 18:29:20.094 HSQLDB server 1.8.0 is online
         [java] [Server@a97b0b]: To close normally, connect and execute SHUTDOWN SQL
         [java] [Server@a97b0b]: From command line, use [Ctrl]+[C] to abort abruptly
    

    Then, I ran ant schemaexport from another shell:

    $ ant schemaexport 
    Buildfile: /home/pascal/Projects/jpwh-gettingstarted-070401/helloworld-native/build.xml
    
    compile:
        [mkdir] Created dir: /home/pascal/Projects/jpwh-gettingstarted-070401/helloworld-native/build
        [javac] /home/pascal/Projects/jpwh-gettingstarted-070401/helloworld-native/build.xml:39: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
        [javac] Compiling 3 source files to /home/pascal/Projects/jpwh-gettingstarted-070401/helloworld-native/build
    
    copymetafiles:
         [copy] Copying 3 files to /home/pascal/Projects/jpwh-gettingstarted-070401/helloworld-native/build
    
    schemaexport:
    [hibernatetool] Executing Hibernate Tool with a Standard Configuration
    [hibernatetool] 1. task: hbm2ddl (Generates database schema)
    [hibernatetool] 
    [hibernatetool]     alter table MESSAGES 
    [hibernatetool]         drop constraint FK_NEXT_MESSAGE;
    [hibernatetool] 
    [hibernatetool]     drop table MESSAGES if exists;
    [hibernatetool] 
    [hibernatetool]     create table MESSAGES (
    [hibernatetool]         MESSAGE_ID bigint generated by default as identity (start with 1),
    [hibernatetool]         MESSAGE_TEXT varchar(255),
    [hibernatetool]         NEXT_MESSAGE_ID bigint,
    [hibernatetool]         primary key (MESSAGE_ID)
    [hibernatetool]     );
    [hibernatetool] 
    [hibernatetool]     alter table MESSAGES 
    [hibernatetool]         add constraint FK_NEXT_MESSAGE 
    [hibernatetool]         foreign key (NEXT_MESSAGE_ID) 
    [hibernatetool]         references MESSAGES;
    [hibernatetool] 1 errors occurred while performing <hbm2ddl>.
    [hibernatetool] Error #1: java.sql.SQLException: Table not found: MESSAGES in statement [alter table MESSAGES]
    
    BUILD SUCCESSFUL
    Total time: 14 seconds
    

    And indeed, when running ant dbmanager, I can see the MESSAGES table as expected.

    So everything worked just fine, out of the box. If it doesn’t for you, maybe start looking at things such as a networking issue, a personal firewall, etc.


    According to the trace, it looks like HSQL is not started (at least not in server mode) and I suspect that you didn’t start it like you are supposed to. To start it in server mode, from the helloworld-reverse directory, run (as explained in the section Starting the HSQL database system, p 98):

    $ java -cp lib/hsqldb.jar org.hsqldb.Server
    

    Then you’ll be able to connect to it using the jdbc:hsqldb:hsql://localhost connection string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.