Wednesday 23 November 2016

java.lang.object cannot be resolved / javax.cache.Cache cannot be resolved. It is indirectly referenced from required .class files


Problem Statements :

Description
Location
Type
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
line 1
Java Problem
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project
Unknown
Java Problem
The method myMethod(SomeClass) from the type MyOtherClass refers to the missing type (insert java type here: InputStream|File|Vector|IOException|etc)
line 123
Java Problem


Solutions : 

  • Close the project and reopen it.
  • Clean the project (It will rebuild the buildpath hence reconfiguring with the JDK libraries)
    OR
  • Delete and Re-import the project and if necessary do the above steps again.



The following steps could help:
  1. Right-click on project » Properties » Java Build Path
  2. Select Libraries tab
  3. Find the JRE System Library and remove it
  4. Click Add Library... button at right side » Add the JRE System Library (Workspace default JRE)




Add this  entry in your POM.xml file


Preview:
<dependency>

    <groupId>javax.cache</groupId>

    <artifactId>cache-api</artifactId>

</dependency>


No comments:

Post a Comment

Spring boot with CORS

CORS (Cross-Origin Resource Sharing) errors occur when a web application running in a browser requests a resource from a different domain or...