Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in Eclipse about type indirectly referenced from required .class file

Tags:

eclipse

I'm having this exception with some stubs generateds by Axis2:

"The type org.apache.axiom.om.OMElement cannot be resolved. It is indirectly referenced from required .class files"

I've been reading many posts, and trying to find a solution. What I've found so far is to add the apache tomcat 5.5 library to the build path. It removed the error in the java file, but then, when I to execute any java program inside the project, I got this error:

'Launching myApp' has encountered a problem Exception occurred executing command line. Cannot run program "C:\Program Files\Java\jdk1.5.0_22\bin\javaw.exe" (in directory "D:\Digicel\workspace\Digicel\myClassSample"): CreateProcess error=87, The parameter is incorrect

then if I remove the apache tomcat library from the build path, I can run the other java programs, but not the one mentioned initially.

Any thoughts about it?

like image 952
Fernando Moyano Avatar asked Sep 19 '11 19:09

Fernando Moyano


2 Answers

Okay, I've found the cause of the problem with the help of a friend :)

The thing is that Eclipse is aware that one of my dependencies, depends of another library, and Eclipse is checking for it when it tries to build the code.

So, what I've done is try to check which jar file contains this library: " org.apache.axiom.om.OMElement".

I've googled it and found that it is "axiom-api-1.2.10.jar" and finally my file compiled with 0 errors.

He also explained to me that my original solution of adding the apache tomcat server library is adding all the jars that cames with apache tomcat (which is a big list), and probably there may have been a version conflict with my current list of added jars.

So, the fix was to find the appropriate jar and add it to the project.

like image 74
Fernando Moyano Avatar answered Nov 19 '22 04:11

Fernando Moyano


This error can also occur when a indirect dependency has a corrupt jar file. This may be caused by problems at the public maven repository.

If this is the case removing the local maven repository to download fresh jar files will fix your problem:

rm -Rf ~/.m2/repository/{enter/path/to/broken/stuff}
like image 4
Martin Avatar answered Nov 19 '22 04:11

Martin