tags:

views:

2456

answers:

3

What are the possible causes of a "java.lang.Error: Unresolved compilation problem"?

Additional information:

I have seen this after copying a set of updated JAR files from a build on top of the existing JARs and restarting the application. The JARs are built using a Maven build process.

I would expect to see LinkageErrors or ClassNotFound errors if interfaces changed. The above error hints at some lower level problem.

A clean rebuild and redeployment fixed the problem. Could this error indicate a corrupted JAR?

+10  A: 

You are trying to run code inside Eclipse which has an error. Eclipse compiles the bad code to produce that message.

Ensure all errors are fixed and run again.


EDIT: Most accurate wording is "You are invoking code which has been generated by Eclipse. The source was erroneous, so the Eclipse compiler cannot compile it - instead byte code has been generated that shows the message in the question".

Thorbjørn Ravn Andersen
That's not my case. I saw this after deploying JAR files (build using Maven) to a server.
Maybe there's a problem with your Maven build config and it's using .class files from your eclipse output directory. Anyhow, the only time I've seen that error is when running code with compilation errors in eclipse.
Michael Borgwardt
In that case your maven build is most likely broken. Try cleaning and recompiling from the command line, with Eclipse shut down.
Thorbjørn Ravn Andersen
Didn't see you edited the question. I would reinvestigate the Maven build process since it appears to be not completely clean. It should NOT be able to create broken jars!Do you have a build server?
Thorbjørn Ravn Andersen
I just had the same problem. It looks like, as Michael said, this was Maven picking up the class files generated by Eclipse.
Wouter Coekaerts
A: 

I have the same problem -I am building the lucene srcs. I see the problem outside of eclipse too. In fact, I use eclipse to just debug and the build is done externally with ant -so eclipse is not involved in building. Its kind of hard to think that the lucene src build system is faulty.

nandy
A: 

Your compiled classes may need to be recompiled from the source with the new jars.

Try running "mvn clean" and then rebuild

Steve Pearson