2014-11-23 52 views
0

如果我将JPA实体添加到我的JSF项目,那么它的部署失败(没有成功)。我使用netbeans向导来创建实体(并且我不扩展代码)。此外,我使用maven构建和部署Wildfly 8.0作为应用程序服务器。部署由maven的wildfly-plugin完成。它与MojoException失败,当插件未能执行某些操作时抛出,但我没有收到任何错误信息(也不包含-e或-X参数)。如果包含JPA实体,JSF项目部署失败

我的Hibernate依赖

<dependency> 
    <groupId>org.hibernate</groupId> 
    <artifactId>hibernate-entitymanager</artifactId> 
    <version>4.3.1.Final</version> 
    <scope>provided</scope> 
</dependency> 
<dependency> 
    <groupId>org.hibernate</groupId> 
    <artifactId>hibernate-jpamodelgen</artifactId> 
    <version>4.3.1.Final</version> 
    <scope>provided</scope> 
</dependency> 

我的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="de.wilhelm_UserManagementPU" transaction-type="JTA"> 
     <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> 
     <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source> 
     <exclude-unlisted-classes>false</exclude-unlisted-classes> 
     <properties> 
      <property name="javax.persistence.schema-generation.database.action" value="create"/> 
     </properties> 
    </persistence-unit> 
</persistence> 

我从 “org.hibernate.ejb.HibernatePersistence” 已经改变了供应商标签“org.hibernate.jpa.HibernatePersistenceProvider “(因为我使用休眠版本4.3.1,根据https://docs.jboss.org/author/display/WFLY8/JPA+Reference+Guide?_sscc=t#JPAReferenceGuide-UpdateyourPersistence.xmlforHibernate4.3.0

回答

0

我在终端上发现wildfly错误消息:

Caused by: org.h2.jdbc.JdbcSQLException: Table "APPLICATIONUSER" already exists; SQL statement:     
create table ApplicationUser (id bigint not null, primary key (id)) 

现在很容易解决