实体类的娱乐

Jos*_*oka 3 jpa

我尝试在netbeans 8.0.1上使用hibernate,spring和jpa运行一个Web应用程序,但是现在我在编译应用程序时遇到了这个异常...以下是错误:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-    compile) on project SMSXxxxx: Compilation failure: Compilation failure:
error: Problem with Filer: Attempt to recreate a file for type  com.equitel.smsmanager.entities.TextMessageContent_
error: Problem with Filer: Attempt to recreate a file for type com.smsmanager.entities.SmsUser_
Run Code Online (Sandbox Code Playgroud)

这是持久性单元,我的项目中只有一个

<?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="SMSManagerPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jboss/datasources/SMSManagerDS</jta-data-source>
<class>com.smsmanager.entities.Approval</class>
<class>com.smsmanager.entities.Changelog</class>
<class>com.smsmanager.entities.Contacts</class>
<class>com.smsmanager.entities.Dispatches</class>
<class>com.smsmanager.entities.MessageSchedule</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
  <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
</properties>
</persistence-unit>
</persistence>
Run Code Online (Sandbox Code Playgroud)

我没有解决此错误,您能帮我解决此问题吗?

ACV*_*ACV 5

由于某些原因,pom.xml在我的情况下有一个依赖性导致了问题。查找并删除它:

    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>hibernate-jpamodelgen-4.3.1.Final</artifactId>
        <version>SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

这可能是Netbeans中的错误。 https://netbeans.org/bugzilla/show_bug.cgi?id=183779


vin*_*_vh 0

检查您的 pom.xml 文件maven-compiler-plugin是否已添加。如果没有,请添加插件,如下所示。

<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>              
</plugin>
Run Code Online (Sandbox Code Playgroud)

您可以通过在 cmd 提示符中使用来查找根本原因mvn clean install -X

检查文件中pom.xml提到的 java 版本,并检查$JAVA_HOME 环境变量中提到的 java 版本。两者应该是相同的。

也检查一下这个

  • 可能是Java编译器的问题。
  • 下载 jar 时可能出现问题