构建Java EE 6项目时出现FilerException [英] FilerException when building Java EE 6 Project

查看:366
本文介绍了构建Java EE 6项目时出现FilerException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Netbeans 7中有一个Java EE 6项目,当我在IDE中编译并启动它时,它运行良好.但是,当我清理并构建项目时,会得到

I have a Java EE 6 Project in Netbeans 7 which runs fine when I compile and start it in the IDE. However, when I clean and build the project, I am getting a

java.lang.RuntimeException:javax.annotation.processing.FilerException:尝试重新创建类型为{myclass}

java.lang.RuntimeException: javax.annotation.processing.FilerException: Attempt to recreate a file for type {myclass}

(其中myclass始终是JPA实体类).

(where myclass is always a JPA entity class).

如果我更改代码中的某些内容,则是哪个实体类会更改.

Which entity class it is changes if I change something in the code.

我不知道是什么原因导致此错误-任何人都可以提供一个要看的内容的想法.

I have no clue what might cause this error - can anyone provide an idea what to look at.

我唯一使用的lib是Velocity.

The only extra lib I am using is Velocity.

更新:我在同一数据库上使用两个持久性单元,一个为正常"单元,一个为非事务性单元.我用于将事物记录到数据库的非事务性事务;在每次插入日志事件后提交一次提交.

Update: I am using two persistence units on the same database, one 'normal' one and one non transactional one. The non-transactional one I use for logging things to the database; with a commit after each insert of a log event.

当我更改它并仅使用一个正常" PU时,该项目可以正常编译.可能是两个PU干扰了eclipselink所做的某些优化吗?

When I change that and only use the one 'normal' PU, the project compiles fine. Could it be that the two PUs interfere with some optimization done by eclipselink?

这是堆栈跟踪的开始:

An annotation processor threw an uncaught exception.
Consult the following stack trace for details.
java.lang.RuntimeException: javax.annotation.processing.FilerException: Attempt to recreate a file for type de.guj.contenthub.ftdts.entity.AgofEntry_
    at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:407)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:625)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:554)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:699)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:981)
    at com.sun.tools.

推荐答案

似乎,问题在于我在两个不同的持久性单元中使用了一个相同的实体类.我不确定这是JPA普遍禁止还是仅是eclipselink的问题.

It seems, the problem is that I use one and the same entity class in two different persistence units. I am not sure whether this forbidden by JPA in general or is only a problem with eclipselink.

我发现的一个解决方案"是复制我的实体类.不好,但目前可以使用.

One 'solution' I found then is to duplicate my entity class. Not nice, but works for now.

仍然欢迎更多答案.

这篇关于构建Java EE 6项目时出现FilerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆