-->
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: Need some helps to get started
PostPosted: Sat Sep 18, 2004 7:45 pm 
Regular
Regular

Joined: Wed Aug 25, 2004 7:40 pm
Posts: 65
Hibernate version: 2.1


Problem 1

After creating a few of mapping files, I run the command "hbm2java" to generate the Java files. I have the following warning messages.

[hbm2java] log4j:WARN No appenders could be found for logger (net.sf.hibernate.util.DTDEntit
yResolver).
[hbm2java] log4j:WARN Please initialize the log4j system properly.

The log related jar files, namingly common-logging, log4j are in the same directory as hibernate2.jar.

What I don't do it right here?


Problem 2

When I run the "init-db" targe, I get an error as the following:

C:\ss\build.xml:94: Schema text failed: net.sf.hibernate.MappingException: persiste
nt class [...] not found

<target name="init-db">
<taskdef classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
name="schemaexport" classpathref="lib.class.path"/>

<schemaexport delimiter=";"
drop="false"
output="schema-export.sql"
properties="hibernate.properties"
quiet="false"
text="false"> <-- line 94
<fileset dir="${src.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>


Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 19, 2004 4:23 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
Problem 1
This is an issue related to the configuration of the Log4J package. Please check their documentation (hint: you miss a log4j.properties in your classpath).


Problem 2
The SchemaExportTask needs access to your classes - so they must be available in the classpath. Include them in the classpath of the SchemaExportTask task definition (check Ant doc for more information if needed).


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 19, 2004 8:14 pm 
Regular
Regular

Joined: Wed Aug 25, 2004 7:40 pm
Posts: 65
Thanks very much bertrand for your response.

bertrand wrote:
Problem 1
This is an issue related to the configuration of the Log4J package. Please check their documentation (hint: you miss a log4j.properties in your classpath).

After I add another log4j properties specially for the hibernate task, I get another error as the followings:

hbm2java:
[hbm2java] Processing 4 files.
[hbm2java] Building hibernate objects
[hbm2java] java.util.zip.ZipException: error in opening zip file
[hbm2java] at java.util.zip.ZipFile.open(Native Method)
[hbm2java] at java.util.zip.ZipFile.<init>(Unknown Source)
[hbm2java] at java.util.zip.ZipFile.<init>(Unknown Source)
[hbm2java] at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:903
)
[hbm2java] at org.apache.tools.ant.AntClassLoader.getResource(AntClassLoader.java:832)
[hbm2java] at org.apache.log4j.helpers.Loader.getResource(Loader.java:91)
[hbm2java] at org.apache.log4j.LogManager.<clinit>(LogManager.java:94)
[hbm2java] at org.apache.log4j.Logger.getLogger(Logger.java:85)
[hbm2java] at org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:229
)
[hbm2java] at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:65)
[hbm2java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[hbm2java] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
[hbm2java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
[hbm2java] at java.lang.reflect.Constructor.newInstance(Unknown Source)
[hbm2java] at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.
java:529)
[hbm2java] at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.
java:235)
[hbm2java] at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.
java:209)
[hbm2java] at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
[hbm2java] at net.sf.hibernate.tool.hbm2java.CodeGenerator.<clinit>(CodeGenerator.java:3
2)
[hbm2java] at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:
145)
[hbm2java] at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:95)
[hbm2java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[hbm2java] at org.apache.tools.ant.Task.perform(Task.java:364)
[hbm2java] at org.apache.tools.ant.Target.execute(Target.java:301)
[hbm2java] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[hbm2java] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[hbm2java] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[hbm2java] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[hbm2java] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[hbm2java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[hbm2java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[hbm2java] java.util.zip.ZipException: error in opening zip file
. . .

I guess that the tar file can't be opened for some reasons. What is the cause if my guess is right?

bertrand wrote:
Problem 2
The SchemaExportTask needs access to your classes - so they must be available in the classpath. Include them in the classpath of the SchemaExportTask task definition (check Ant doc for more information if needed).


Do you imply that the SchemaExportTask is depended on compiling the Java source code? I don't see such dependence relationship in the build.xml files of the examples came with the hibernate installation.


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.