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
: Attempt to recreate a file for type {myclass
}
(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.
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.
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?
Here is the beginning of the stack trace:
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.
Having two persistence units using the same Entity class did seem to be the problem.
In my case I had one unit for querying data and the other for authentication. The one for authentication does not need to know about my Entity classes, so in Netbeans I had to uncheck the "Include All Entity Classes in "MyWebServiceProject" Module".
Or add:
<exclude-unlisted-classes>true</exclude-unlisted-classes>
to the web.xml file for that persistence unit.