开始 Hibernate 3.5 - ant 任务的问题
我正在尝试完成“Beginning Hibernate 3.5”,但遇到了最初的障碍。
当我运行 ant exportDDL
时,出现以下错误:
exportDDL:
[htools] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
[htools] 1. task: hbm2ddl (Generates database schema)
[htools] SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8]
[htools] SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
[htools] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
[htools] To get the full stack trace run ant with -verbose
[htools] Problems in creating a AnnotationConfiguration. Have you remembered to add it to the classpath ?
[htools] java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
BUILD FAILED
C:\hibernate\project\build.xml:30: Problems in creating a AnnotationConfiguration. Have you
remembered to add it to the classpath ?
执行以下 ant 任务:
<target name="exportDDL" depends="compile">
<mkdir dir="${sql}"/>
<htools destdir="${sql}">
<classpath refid="classpath.tools"/>
<annotationconfiguration
configurationfile="${src}/hibernate.cfg.xml"/>
<hbm2ddl drop="true" outputfilename="sample.sql"/>
</htools>
</target>
<target name="compile">
<javac srcdir="${src}" destdir="${bin}" classpathref="classpath.base"/>
</target>
这里发生了什么? antcompile
工作正常,但 exportDDL
任务却不行。 sl4j jar 位于类路径中,我下载了 slf4j-simple-1.6.1.jar。想法?
I'm trying to work through "Beginning Hibernate 3.5", and I've hit an initial snag.
When I run ant exportDDL
, I get the following error:
exportDDL:
[htools] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
[htools] 1. task: hbm2ddl (Generates database schema)
[htools] SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8]
[htools] SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
[htools] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
[htools] To get the full stack trace run ant with -verbose
[htools] Problems in creating a AnnotationConfiguration. Have you remembered to add it to the classpath ?
[htools] java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
BUILD FAILED
C:\hibernate\project\build.xml:30: Problems in creating a AnnotationConfiguration. Have you
remembered to add it to the classpath ?
with the following ant task:
<target name="exportDDL" depends="compile">
<mkdir dir="${sql}"/>
<htools destdir="${sql}">
<classpath refid="classpath.tools"/>
<annotationconfiguration
configurationfile="${src}/hibernate.cfg.xml"/>
<hbm2ddl drop="true" outputfilename="sample.sql"/>
</htools>
</target>
<target name="compile">
<javac srcdir="${src}" destdir="${bin}" classpathref="classpath.base"/>
</target>
What's going on here? ant compile
works fine, but the exportDDL
task does not. The sl4j jar is on the classpath, and I downloaded slf4j-simple-1.6.1.jar
. Thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里解决你想要的
Here solves what you want
这是我遇到的一个示例,当您有不兼容的 slf4j 版本时,会出现 SLF4J 启动警告:
SLF4J: The requested version 1.5.10 by your slf4j Binding is not Compatible with [1.6]
SLF4J:请参阅 http://www.slf4j.org/codes.html#version_mismatch进一步的细节。
Here's an example I came across of the SLF4J start up warning when you've got incompatible slf4j versions:
SLF4J: The requested version 1.5.10 by your slf4j binding is not compatible with [1.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.