简体   繁体   English

Hibernate 3 Maven插件hbm2ddl非常慢

[英]Hibernate 3 maven plugin hbm2ddl very slow

I am using hibernate 3 maven plugin to generate DDL for my schema using the JPA entities. 我正在使用hibernate 3 maven插件使用JPA实体为我的架构生成DDL。 It all works fine, but the plugin execution takes about 3-4 mins to execute. 一切正常,但是插件执行大约需要3-4分钟才能执行。

Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/user15273/.m2/repository/org/slf4j/slf4j- nop/1.6.1/slf4j-nop-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/user15273/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[INFO] Executed tasks

I tried running maven with -X flag to see where it gets stuck for a while after printing following output. 我尝试使用-X标志运行maven,以查看打印以下输出后卡住了一段时间。

    main:
    Class org.hibernate.tool.ant.HibernateToolTask loaded from parent loader (parentFirst)
     +Datatype hibernatetool org.hibernate.tool.ant.HibernateToolTask
        [mkdir] Created dir: C:\user15273\MySource\Workspace\NewSourceCode\Entity\target\sql\hibernate3
    [hibernatetool] Executing Hibernate Tool with a JPA Configuration
    [hibernatetool] 1. task: hbm2ddl (Generates database schema)
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/C:/Users/user15273/.m2/repository/org/slf4j/slf4j-nop/1.6.1/slf4j-nop-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/C:/Users/user15273/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    Class org.hibernate.ejb.Ejb3Configuration loaded from parent loader (parentFirst)
    Couldn't load ResourceStream for commons-logging.properties
    ResourceStream for META-INF/services/org.apache.commons.logging.LogFactory loaded from parent loader
    Class org.apache.commons.logging.impl.SLF4JLogFactory loaded from parent loader (parentFirst)
    Couldn't load ResourceStream for hibernate.properties
    Couldn't load ResourceStream for META-INF/services/javax.xml.parsers.DocumentBuilderFactory
    Class com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl loaded from parent loader (parentFirst)
    Class com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl loaded from parent loader (parentFirst)
    Class com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl loaded from parent loader (parentFirst)
    Class com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl loaded from parent loader (parentFirst)
    Class com.sun.org.apache.xerces.internal.impl.dv.xs.ExtendedSchemaDVFactoryImpl loaded from parent loader (parentFirst)
    Class com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl loaded from parent loader (parentFirst)
    Class com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl loaded from parent loader (parentFirst)
    Class com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl loaded from parent loader (parentFirst)

Does any one have any idea how to find out the cause of this delay or what to do to resolve this ? 是否有人知道如何找出造成延迟的原因或如何解决? TIA. TIA。

I've solved the issue now. 我已经解决了这个问题。 Analyzed the thread dump of maven process and found that the thread was in WAITING state on a socket connection. 分析了Maven进程的线程转储,发现该线程在套接字连接上处于WAITING状态。 On more analysis, I found it was xerces class trying to download persistence XSD. 经过更多分析,我发现这是xerces类试图下载持久性XSD。

Since I was not using the version of Hibernate entity jar which had that XSD, I had to manually place the XSD in the project structure. 由于我没有使用具有该XSD的Hibernate实体jar版本,因此必须手动将XSD放置在项目结构中。 Now the build is back to a few minutes. 现在,构建又回到了几分钟。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM