Class file not found

In IntelliJ I get this weird error when I try to compile.

Cannot find annotation method 'cascade()' in type 'javax.persistence.ManyToOne': class file for javax.persistence.ManyToOne not found

I know, it seems pretty obvious what the problem is, but having spent too much time on this problem I now turn my trust to you!

I use ideaCommunity-9, where I have created a global library for JBoss, which contains all JBoss jars including ejb3-persistence.jar. My module includes this library, and I have moved it to the top of dependencies. No otherwhere in classpath I have a javax.persistence.ManyToOne class, and it also opens up in IntelliJ without problems. If I open the file where I get the compile error, IntelliJ shows no problems and also navigates to the class file on pressing Ctrl+B.
The code is also build with ant and here it works fine.

Besides the above error I get six others along the same path (name in Table, etc.) - all related to JPA. I also get a message saying "Please file a bug to JDC yada yada yada."

Has anyone seen this problem before?

Comment actions Permalink


I don't notice any problem in the configuration you have described, and didn't meet such problem before.

This may be a corruption of compiler cashes or so. You can try to perform full rebuild of the project. If this doesn't help, then main menu / File / Invalidate caches and rebuild again. (Just common recommendations in case of compiler problems.)


Comment actions Permalink

I got the solution from a copy of this post on stackoverflow. The solution was to check my JBoss global library as export in "dependencies".


Please sign in to leave a comment.