-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem when running Hibernate Tutorial example Chapter 1
PostPosted: Wed Jul 02, 2008 5:16 am 
Newbie

Joined: Sun Jun 29, 2008 10:27 am
Posts: 5
Location: london
Dear Hibernates,

Could someone please help me here. I am trying to run the Hibernate Tutorial example from Chapter 1,

http://www.hibernate.org/hib_docs/v3/re ... orial.html

but am getting the following error messages. Please find below the full listing when I enter the Ant command-line,

D:\Data\java\eclipse\com.eclipse.hibernate>ant run -Daction=store

The code compiles fine. I'm really stuck at the moment so any help would be much appreciated as I've spent a long time looking at this and am not making any progress.

Regards
Robert.

    D:\Data\java\eclipse\com.eclipse.hibernate>ant run -Daction=store
    Buildfile: build.xml

    clean:
    [delete] Deleting directory D:\Data\java\eclipse\com.eclipse.hibernate\bin
    [mkdir] Created dir: D:\Data\java\eclipse\com.eclipse.hibernate\bin

    copy-resources:
    [copy] Copying 8 files to D:\Data\java\eclipse\com.eclipse.hibernate\bin

    compile:
    [javac] Compiling 3 source files to D:\Data\java\eclipse\com.eclipse.hibernate\bin

    run:
    [java] 09:42:02,307 INFO Environment:514 - Hibernate 3.2.6
    [java] 09:42:02,317 INFO Environment:547 - hibernate.properties not found
    [java] 09:42:02,327 INFO Environment:681 - Bytecode provider name : cglib
    [java] 09:42:02,337 INFO Environment:598 - using JDK 1.4 java.sql.Timestamp handling
    [java] 09:42:02,447 INFO Configuration:1432 - configuring from resource: /hibernate.cfg.xml
    [java] 09:42:02,447 INFO Configuration:1409 - Configuration resource: /hibernate.cfg.xml
    [java] 09:42:02,877 INFO Configuration:559 - Reading mappings from resource : Events/Event.hbm.xml
    [java] 09:42:03,078 INFO HbmBinder:300 - Mapping class: Events.Event -> EVENTS
    [java] 09:42:03,108 INFO Configuration:1547 - Configured SessionFactory: null
    [java] 09:42:03,218 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
    [java] 09:42:03,218 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 1
    [java] 09:42:03,218 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
    [java] 09:42:03,238 INFO DriverManagerConnectionProvider:80 - using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hsql://localhost
    [java] 09:42:03,238 INFO DriverManagerConnectionProvider:86 - connection properties: {user=sa, password=****}
    [java] 09:42:04,279 WARN SettingsFactory:117 - Could not obtain connection metadata
    [java] java.sql.SQLException: socket creation error
    [java] at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
    [java] at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
    [java] at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
    [java] at org.hsqldb.jdbcDriver.connect(Unknown Source)
    [java] at java.sql.DriverManager.getConnection(DriverManager.java:582)
    [java] at java.sql.DriverManager.getConnection(DriverManager.java:154)
    [java] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
    [java] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
    [java] at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073)
    [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)
    [java] at util.HibernateUtil.<clinit>(HibernateUtil.java:13)
    [java] at Events.EventManager.createAndStoreEvent(Unknown Source)
    [java] at Events.EventManager.main(Unknown Source)
    [java] 09:42:04,339 INFO Dialect:152 - Using dialect: org.hibernate.dialect.HSQLDialect
    [java] 09:42:04,360 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
    [java] 09:42:04,370 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    [java] 09:42:04,370 INFO SettingsFactory:143 - Automatic flush during beforeCompletion(): disabled
    [java] 09:42:04,370 INFO SettingsFactory:147 - Automatic session close at end of transaction: disabled
    [java] 09:42:04,380 INFO SettingsFactory:162 - Scrollable result sets: disabled
    [java] 09:42:04,380 INFO SettingsFactory:170 - JDBC3 getGeneratedKeys(): disabled
    [java] 09:42:04,380 INFO SettingsFactory:178 - Connection release mode: auto
    [java] 09:42:04,380 INFO SettingsFactory:205 - Default batch fetch size: 1
    [java] 09:42:04,380 INFO SettingsFactory:209 - Generate SQL with comments: disabled
    [java] 09:42:04,380 INFO SettingsFactory:213 - Order SQL updates by primary key: disabled
    [java] 09:42:04,380 INFO SettingsFactory:217 - Order SQL inserts for batching: disabled
    [java] 09:42:04,390 INFO SettingsFactory:386 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    [java] 09:42:04,390 INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTranslatorFactory
    [java] 09:42:04,390 INFO SettingsFactory:225 - Query language substitutions: {}
    [java] 09:42:04,400 INFO SettingsFactory:230 - JPA-QL strict compliance: disabled
    [java] 09:42:04,400 INFO SettingsFactory:235 - Second-level cache: enabled
    [java] 09:42:04,400 INFO SettingsFactory:239 - Query cache: disabled
    [java] 09:42:04,400 INFO SettingsFactory:373 - Cache provider: org.hibernate.cache.NoCacheProvider
    [java] 09:42:04,400 INFO SettingsFactory:254 - Optimize cache for minimal puts: disabled
    [java] 09:42:04,400 INFO SettingsFactory:263 - Structured second-level cache entries: disabled
    [java] 09:42:04,410 INFO SettingsFactory:283 - Echoing all SQL to stdout
    [java] 09:42:04,420 INFO SettingsFactory:290 - Statistics: disabled
    [java] 09:42:04,420 INFO SettingsFactory:294 - Deleted entity synthetic identifier rollback: disabled
    [java] 09:42:04,420 INFO SettingsFactory:309 - Default entity-mode: pojo
    [java] 09:42:04,420 INFO SettingsFactory:313 - Named query checking : enabled
    [java] 09:42:04,480 INFO SessionFactoryImpl:161 - building session factory
    [java] 09:42:04,940 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
    [java] 09:42:04,950 INFO SchemaExport:154 - Running hbm2ddl schema export
    [java] 09:42:04,950 DEBUG SchemaExport:170 - import file not found: /import.sql
    [java] 09:42:04,950 INFO SchemaExport:179 - exporting generated schema to database
    [java] 09:42:05,942 ERROR SchemaExport:202 - schema export unsuccessful
    [java] java.sql.SQLException: socket creation error
    [java] at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
    [java] at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
    [java] at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
    [java] at org.hsqldb.jdbcDriver.connect(Unknown Source)
    [java] at java.sql.DriverManager.getConnection(DriverManager.java:582)
    [java] at java.sql.DriverManager.getConnection(DriverManager.java:154)
    [java] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
    [java] at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:27)
    [java] at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:180)
    [java] at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
    [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:311)
    [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
    [java] at util.HibernateUtil.<clinit>(HibernateUtil.java:13)
    [java] at Events.EventManager.createAndStoreEvent(Unknown Source)
    [java] at Events.EventManager.main(Unknown Source)
    [java] 09:42:07,144 WARN JDBCExceptionReporter:77 - SQL Error: -80, SQLState: 08000
    [java] 09:42:07,144 ERROR JDBCExceptionReporter:78 - socket creation error
    [java] Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection
    [java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
    [java] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
    [java] at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
    [java] at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
    [java] at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
    [java] at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [java] at java.lang.reflect.Method.invoke(Method.java:597)
    [java] at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
    [java] at $Proxy0.beginTransaction(Unknown Source)
    [java] at Events.EventManager.createAndStoreEvent(Unknown Source)
    [java] at Events.EventManager.main(Unknown Source)
    [java] Caused by: java.sql.SQLException: socket creation error
    [java] at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
    [java] at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
    [java] at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
    [java] at org.hsqldb.jdbcDriver.connect(Unknown Source)
    [java] at java.sql.DriverManager.getConnection(DriverManager.java:582)
    [java] at java.sql.DriverManager.getConnection(DriverManager.java:154)
    [java] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
    [java] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
    [java] ... 12 more

    BUILD SUCCESSFUL
    Total time: 7 seconds


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 6:54 am 
Newbie

Joined: Sun Jun 29, 2008 10:27 am
Posts: 5
Location: london
I think I found the problem. The database wasn't started! You have to remember to have the db started in separate DOS window. This step was mentioned earlier in the tutorial but I'd closed that DOS window down in the meantime. So once again, you must have the DB started in another window for the first example to work !!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 04, 2008 11:10 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Yes, starting the database always help! LOL

Keep in trucking, as they say.

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