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.  [ 2 posts ] 
Author Message
 Post subject: Chapter 2 example - Hellow World
PostPosted: Mon May 24, 2010 6:55 pm 
Newbie

Joined: Mon May 24, 2010 6:35 pm
Posts: 1
Just got the book. Having the following error in trying out the example. Looks like Build was successful but the run was a problem. Can you help? The rest of the set up exactly as stated in the book. It is a download from the site.

[hibernatetool] May 24, 2010 3:01:31 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Configured SessionFactory: null
[hibernatetool] May 24, 2010 3:01:31 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Using dialect: org.hibernate.dialect.HSQLDialect
[hibernatetool] May 24, 2010 3:01:31 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Running hbm2ddl schema export
[hibernatetool] May 24, 2010 3:01:31 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: writing generated schema to file: F:\personal\hibernatestu
dy\hellowworld\helloworld-ddl.sql
[hibernatetool] May 24, 2010 3:01:31 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: exporting generated schema to database
[hibernatetool] May 24, 2010 3:01:31 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Using Hibernate built-in connection pool (not for producti
on use!)
[hibernatetool] May 24, 2010 3:01:31 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Hibernate connection pool size: 20
[hibernatetool] May 24, 2010 3:01:31 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: autocommit mode: false
[hibernatetool] May 24, 2010 3:01:31 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hs
ql://localhost
[hibernatetool] May 24, 2010 3:01:31 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: connection properties: {user=sa}
[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 (star
t 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] May 24, 2010 3:01:32 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: schema export complete
[hibernatetool] May 24, 2010 3:01:32 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: cleaning up connection pool: jdbc:hsqldb:hsql://localhost
[hibernatetool] 1 errors occurred while performing <hbm2ddl>.
[hibernatetool] Error #1: java.sql.SQLException: user lacks privilege or object
not found: MESSAGES

BUILD SUCCESSFUL
Total time: 2 seconds
F:\personal\hibernatestudy\hellowworld>Ant schemaexport
Buildfile: F:\personal\hibernatestudy\hellowworld\build.xml

compile:
[javac] F:\personal\hibernatestudy\hellowworld\build.xml:39: warning: 'inclu
deantruntime' was not set, defaulting to build.sysclasspath=last; set to false f
or repeatable builds

copymetafiles:
[copy] Copying 1 file to F:\personal\hibernatestudy\hellowworld\build

schemaexport:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] May 24, 2010 3:03:43 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Hibernate 3.5.2-Final
[hibernatetool] May 24, 2010 3:03:43 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] May 24, 2010 3:03:43 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Bytecode provider name : javassist
[hibernatetool] May 24, 2010 3:03:43 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: configuring from file: hibernate.cfg.xml
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Reading mappings from resource : hello/Message.hbm.xml
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Mapping class: hello.Message -> MESSAGES
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Configured SessionFactory: null
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Using dialect: org.hibernate.dialect.HSQLDialect
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Running hbm2ddl schema export
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: writing generated schema to file: F:\personal\hibernatestu
dy\hellowworld\helloworld-ddl.sql
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: exporting generated schema to database
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Using Hibernate built-in connection pool (not for producti
on use!)
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: Hibernate connection pool size: 20
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: autocommit mode: false
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hs
ql://localhost
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: connection properties: {user=SA}
[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 (star
t 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] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: schema export complete
[hibernatetool] May 24, 2010 3:03:44 PM org.slf4j.impl.JCLLoggerAdapter info
[hibernatetool] INFO: cleaning up connection pool: jdbc:hsqldb:hsql://localhost

BUILD SUCCESSFUL
Total time: 1 second
F:\personal\hibernatestudy\hellowworld>Ant run
Buildfile: F:\personal\hibernatestudy\hellowworld\build.xml

compile:
[javac] F:\personal\hibernatestudy\hellowworld\build.xml:39: warning: 'inclu
deantruntime' was not set, defaulting to build.sysclasspath=last; set to false f
or repeatable builds

copymetafiles:

run:
[java] May 24, 2010 3:06:30 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Hibernate 3.5.2-Final
[java] May 24, 2010 3:06:30 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: hibernate.properties not found
[java] May 24, 2010 3:06:30 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Bytecode provider name : javassist
[java] May 24, 2010 3:06:30 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: using JDK 1.4 java.sql.Timestamp handling
[java] May 24, 2010 3:06:30 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: configuring from resource: /hibernate.cfg.xml
[java] May 24, 2010 3:06:30 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Configuration resource: /hibernate.cfg.xml
[java] May 24, 2010 3:06:30 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Reading mappings from resource : hello/Message.hbm.xml
[java] May 24, 2010 3:06:30 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Mapping class: hello.Message -> MESSAGES
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Configured SessionFactory: null
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Using Hibernate built-in connection pool (not for production u
se!)
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Hibernate connection pool size: 20
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: autocommit mode: false
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hsql:/
/localhost
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: connection properties: {user=SA}
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: RDBMS: HSQL Database Engine, version: 2.0.0
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: JDBC driver: HSQL Database Engine Driver, version: 2.0.0
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Using dialect: org.hibernate.dialect.HSQLDialect
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Using default transaction strategy (direct JDBC transactions)
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: No TransactionManagerLookup configured (in JTA environment, us
e of read-write or transactional second-level cache is not recommended)
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Automatic flush during beforeCompletion(): disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Automatic session close at end of transaction: disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: JDBC batch size: 15
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: JDBC batch updates for versioned data: disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Scrollable result sets: enabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: JDBC3 getGeneratedKeys(): enabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Connection release mode: auto
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Default batch fetch size: 1
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Generate SQL with comments: disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Order SQL updates by primary key: disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Order SQL inserts for batching: disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFact
ory
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Using ASTQueryTranslatorFactory
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Query language substitutions: {}
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: JPA-QL strict compliance: disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Second-level cache: enabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Query cache: disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Cache region factory : org.hibernate.cache.impl.NoCachingRegio
nFactory
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Optimize cache for minimal puts: disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Structured second-level cache entries: disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Statistics: disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Deleted entity synthetic identifier rollback: disabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Default entity-mode: pojo
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Named query checking : enabled
[java] May 24, 2010 3:06:31 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: Check Nullability in Core (should be disabled when Bean Valida
tion is on): enabled
[java] May 24, 2010 3:06:32 PM org.slf4j.impl.JCLLoggerAdapter info
[java] INFO: building session factory
[java] Exception in thread "main" java.lang.ExceptionInInitializerError
[java] at persistence.HibernateUtil.<clinit>(Unknown Source)
[java] at hello.HelloWorld.main(Unknown Source)
[java] Caused by: org.hibernate.HibernateException: Unable to instantiate d
efault tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
[java] at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTup
lizer(EntityTuplizerFactory.java:110)
[java] at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDef
aultTuplizer(EntityTuplizerFactory.java:135)
[java] at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.
<init>(EntityEntityModeToTuplizerMapping.java:80)
[java] at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetam
odel.java:323)
[java] at org.hibernate.persister.entity.AbstractEntityPersister.<init>
(AbstractEntityPersister.java:475)
[java] at org.hibernate.persister.entity.SingleTableEntityPersister.<in
it>(SingleTableEntityPersister.java:133)
[java] at org.hibernate.persister.PersisterFactory.createClassPersister
(PersisterFactory.java:84)
[java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryIm
pl.java:295)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
tion.java:1385)
[java] ... 2 more
[java] Caused by: java.lang.reflect.InvocationTargetException
[java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
[java] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeC
onstructorAccessorImpl.java:39)
[java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Del
egatingConstructorAccessorImpl.java:27)
[java] at java.lang.reflect.Constructor.newInstance(Constructor.java:51
3)
[java] at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTup
lizer(EntityTuplizerFactory.java:107)
[java] ... 10 more
[java] Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/Meth
odFilter
[java] at org.hibernate.bytecode.javassist.BytecodeProviderImpl.getProx
yFactoryFactory(BytecodeProviderImpl.java:49)
[java] at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFacto
ryInternal(PojoEntityTuplizer.java:207)
[java] at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFacto
ry(PojoEntityTuplizer.java:185)
[java] at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(Abst
ractEntityTuplizer.java:170)
[java] at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEnti
tyTuplizer.java:77)
[java] ... 15 more
[java] Caused by: java.lang.ClassNotFoundException: javassist.util.proxy.Me
thodFilter
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
[java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

[java] ... 20 more
[java] Java Result: 1

BUILD SUCCESSFUL
Total time: 3 seconds
F:\personal\hibernatestudy\hellowworld>Ant run


Top
 Profile  
 
 Post subject: Re: Chapter 2 example - Hellow World
PostPosted: Sat Jun 25, 2011 10:25 am 
Newbie

Joined: Sat Jun 25, 2011 9:06 am
Posts: 2
hey,
i am try to build the helloworld too but I have no success then the build failed when I run schemaexport and as I can see the build was successful by you.
here is the error i became:
Buildfile: C:\HibernateTest\build.xml
clean:
[delete] Deleting directory C:\HibernateTest\bin
[mkdir] Created dir: C:\HibernateTest\bin
compile:
[javac] Compiling 7 source files to C:\HibernateTest\bin
copymetafiles:
[copy] Copying 5 files to C:\HibernateTest\bin
schemaexport:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)

BUILD FAILED
C:\HibernateTest\build.xml:60: java.lang.NoSuchMethodError: org/slf4j/impl/StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;

Total time: 2 seconds

a snipped of My Build.xml file look like this:

......
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="project.classpath"/>

<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>
...................


can you help me please?


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