无法在Wildfly上部署EAR-Project

时间:2016-07-29 19:03:34

标签: java jpa wildfly java-ee-7

我正在使用Wildfly 8.2.1,我尝试将我的EAR项目部署到Wildfly

一切正常,但由于我更改了数据库架构并通过 JPA-Tools 生成了新的实体类,因此出现错误。

这是我的persistence.xml(我在那里没有改变):

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="PrototypeShitstormRecEJB">
        <jta-data-source>java:jboss/datasources/ShitstormDS</jta-data-source>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="create"/>
            <property name="hibernate.show_sql" value="true"/>
        </properties>
    </persistence-unit>
</persistence>

此处console登录部署: ...

20:33:54,047 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 63) HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
20:33:54,359 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 63) MSC000001: Failed to start service jboss.persistenceunit."PrototypeShitstormRec.ear/PrototypeShitstormRecEJB.jar#PrototypeShitstormRecEJB": org.jboss.msc.service.StartException in service jboss.persistenceunit."PrototypeShitstormRec.ear/PrototypeShitstormRecEJB.jar#PrototypeShitstormRecEJB": javax.persistence.PersistenceException: [PersistenceUnit: PrototypeShitstormRecEJB] Unable to build Hibernate SessionFactory
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172) [wildfly-jpa-8.2.1.Final.jar:8.2.1.Final]
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117) [wildfly-jpa-8.2.1.Final.jar:8.2.1.Final]
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_73]
    at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:474)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182) [wildfly-jpa-8.2.1.Final.jar:8.2.1.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_73]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_73]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_73]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: PrototypeShitstormRecEJB] Unable to build Hibernate SessionFactory
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1239) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.access$600(EntityManagerFactoryBuilderImpl.java:120) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:855) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) [jipijapa-hibernate4-3-1.0.1.Final.jar:]
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154) [wildfly-jpa-8.2.1.Final.jar:8.2.1.Final]
    ... 8 more
Caused by: org.hibernate.DuplicateMappingException: Duplicate query mapping GETALL
    at org.hibernate.cfg.Configuration$MappingsImpl.checkQueryName(Configuration.java:2996) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration$MappingsImpl.applyQuery(Configuration.java:2990) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration$MappingsImpl.addQuery(Configuration.java:2985) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.annotations.QueryBinder.bindQuery(QueryBinder.java:90) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.AnnotationBinder.bindQueries(AnnotationBinder.java:364) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:618) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3845) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3799) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1412) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    ... 13 more

非常感谢您的帮助:)

1 个答案:

答案 0 :(得分:1)

非常感谢。在错误日志中,它对我来说有点隐藏:

Duplicate query mapping GETALL

我有两个同名的NamedQueries&#34; GETALL&#34;。