-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem with the hibernate example
PostPosted: Thu Aug 21, 2008 5:21 am 
Newbie

Joined: Wed Aug 20, 2008 5:52 am
Posts: 3
I have downloaded source code for Java Persistence with Hibernate book and trying to execute the helloworld program. I am getting the following error when I execute

ant schemaexport

Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.5 in: C:\jdk1.5.0_12\jre
Detected OS: Windows XP
parsing buildfile D:\Projects\hibernate\helloWorld\build.xml with URI = file:///D:/Projects/hibernate/helloWorld/build.xml
Project base dir set to: D:\Projects\hibernate\helloWorld
Build sequence for target(s) `schemaexport' is [compile, copymetafiles, schemaexport]
Complete build sequence is [compile, copymetafiles, schemaexport, startdb, clean, dbmanager, run, ]

compile:
[javac] META-INF\MANIFEST.MF skipped - don't know how to handle it
[javac] hello\HelloWorld.java added as hello/HelloWorld.class doesn't exist.
[javac] hello\Message.java added as hello/Message.class doesn't exist.
[javac] hello\message.hbm.xml skipped - don't know how to handle it
[javac] hibernate.cfg.xml skipped - don't know how to handle it
[javac] persistence\HibernateUtil.java added as persistence/HibernateUtil.class doesn't exist.
[javac] Compiling 3 source files to D:\Projects\hibernate\helloWorld\build
[javac] Using modern compiler
[javac] Compilation arguments:
[javac] '-d'
[javac] 'D:\Projects\hibernate\helloWorld\build'
[javac] '-classpath'
[javac] 'D:\Projects\hibernate\helloWorld\build;D:\Projects\hibernate\helloWorld\lib\antlr-2.7.6.jar;D:\Projects\hibernate\helloWorld\lib\asm-attrs.jar;D:\Projects\hibernate\helloWorld\lib\asm.jar;D:\Projects\hibernate\helloWorld\lib\c3p0-0.9.0.jar;D:\Projects\hibernate\helloWorld\lib\cglib-2.1.
3.jar;D:\Projects\hibernate\helloWorld\lib\commons-collections-2.1.1.jar;D:\Projects\hibernate\helloWorld\lib\commons-logging-1.0.4.jar;D:\Projects\hibernate\helloWorld\lib\dom4j-1.6.1.jar;D:\Projects\hibernate\helloWorld\lib\hibernate-tools.jar;D:\Projects\hibernate\helloWorld\lib\hibernate3.jar;D:
\Projects\hibernate\helloWorld\lib\hsqldb.jar;D:\Projects\hibernate\helloWorld\lib\jta.jar;D:\Projects\hibernate\helloWorld\lib\log4j-1.2.13.jar;D:\Projects\hibernate\helloWorld\lib\mysql-connector-java-3.1.14-bin.jar;D:\apache-ant-1.6.5\lib\ant-launcher.jar;D:\Projects\hibernate\helloWorld;D:\Tomca
t 5.5\webapps\axis\WEB-INF\lib\axis.jar;C:\selenium-remote-control-0.9.2\selenium-server-0.9.2\selenium-server.jar;D:\apache-ant-1.6.5\lib\ant-antlr.jar;D:\apache-ant-1.6.5\lib\ant-apache-bcel.jar;D:\apache-ant-1.6.5\lib\ant-apache-bsf.jar;D:\apache-ant-1.6.5\lib\ant-apache-log4j.jar;D:\apache-ant-1
.6.5\lib\ant-apache-oro.jar;D:\apache-ant-1.6.5\lib\ant-apache-regexp.jar;D:\apache-ant-1.6.5\lib\ant-apache-resolver.jar;D:\apache-ant-1.6.5\lib\ant-commons-logging.jar;D:\apache-ant-1.6.5\lib\ant-commons-net.jar;D:\apache-ant-1.6.5\lib\ant-icontract.jar;D:\apache-ant-1.6.5\lib\ant-jai.jar;D:\apach
e-ant-1.6.5\lib\ant-javamail.jar;D:\apache-ant-1.6.5\lib\ant-jdepend.jar;D:\apache-ant-1.6.5\lib\ant-jmf.jar;D:\apache-ant-1.6.5\lib\ant-jsch.jar;D:\apache-ant-1.6.5\lib\ant-junit.jar;D:\apache-ant-1.6.5\lib\ant-netrexx.jar;D:\apache-ant-1.6.5\lib\ant-nodeps.jar;D:\apache-ant-1.6.5\lib\ant-starteam.
jar;D:\apache-ant-1.6.5\lib\ant-stylebook.jar;D:\apache-ant-1.6.5\lib\ant-swing.jar;D:\apache-ant-1.6.5\lib\ant-trax.jar;D:\apache-ant-1.6.5\lib\ant-vaj.jar;D:\apache-ant-1.6.5\lib\ant-weblogic.jar;D:\apache-ant-1.6.5\lib\ant-xalan1.jar;D:\apache-ant-1.6.5\lib\ant-xslp.jar;D:\apache-ant-1.6.5\lib\an
t.jar;D:\apache-ant-1.6.5\lib\xercesImpl.jar;D:\apache-ant-1.6.5\lib\xml-apis.jar;C:\jdk1.5.0_12\lib\tools.jar'
[javac] '-sourcepath'
[javac] 'D:\Projects\hibernate\helloWorld\src'
[javac] '-g:none'
[javac]
[javac] The ' characters around the executable and arguments are
[javac] not part of the command.
[javac] Files to be compiled:
[javac] D:\Projects\hibernate\helloWorld\src\hello\HelloWorld.java
[javac] D:\Projects\hibernate\helloWorld\src\hello\Message.java
[javac] D:\Projects\hibernate\helloWorld\src\persistence\HibernateUtil.java

copymetafiles:
[copy] hello\message.hbm.xml added as hello/message.hbm.xml doesn't exist.
[copy] hibernate.cfg.xml added as hibernate.cfg.xml doesn't exist.
[copy] Copying 2 files to D:\Projects\hibernate\helloWorld\build
[copy] Copying D:\Projects\hibernate\helloWorld\src\hibernate.cfg.xml to D:\Projects\hibernate\helloWorld\build\hibernate.cfg.xml
[copy] Copying D:\Projects\hibernate\helloWorld\src\hello\message.hbm.xml to D:\Projects\hibernate\helloWorld\build\hello\message.hbm.xml

schemaexport:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)

BUILD FAILED
java.lang.ExceptionInInitializerError
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1225)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.ExceptionInInitializerError
at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:171)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
... 7 more
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@177b3cd for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused
by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@177b3cd for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.hibernate.tool.hbm2ddl.SchemaExport.<clinit>(SchemaExport.java:44)
... 14 more
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@177b3cd for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 18 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.getConstructor(Class.java:1629)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
... 19 more
--- Nested Exception ---
java.lang.ExceptionInInitializerError
at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:171)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@177b3cd for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused
by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@177b3cd for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.hibernate.tool.hbm2ddl.SchemaExport.<clinit>(SchemaExport.java:44)
... 14 more
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@177b3cd for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 18 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.getConstructor(Class.java:1629)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
... 19 more

Total time: 2 seconds
D:\Projects\hibernate\helloWorld>

I have not modified anything within the code, all the configuration files are as is. Please help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.