Search code examples
netbeansjava-ee-6

FilerException when building Java EE 6 Project


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.

Solution

  • 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.

    More answers still welcome.