简体   繁体   中英

Hibernate 3 maven plugin hbm2ddl very slow

I am using hibernate 3 maven plugin to generate DDL for my schema using the JPA entities. It all works fine, but the plugin execution takes about 3-4 mins to execute.

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.

    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.

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. On more analysis, I found it was xerces class trying to download persistence 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. Now the build is back to a few minutes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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