8
package springdemo4;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class HelloSpringApp {

    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Coach theCoach = context.getBean("myCoach",Coach.class);
        System.out.println(theCoach.getDailyFortune());
        System.out.println(theCoach.getDailyWorkout());
        context.close();

    }

}

I ran it, then it said:

Error occurred during initialization of boot layer java.lang.module.FindException: Unable to derive module descriptor for C:\Users\ngoch\eclipse-workspace\springdemo4\libs\spring-context-indexer-5.1.9.RELEASE-sources.jar Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.springframework.context.index.processor.CandidateComponentsIndexer not in module

Please,help

Naman
  • 27,789
  • 26
  • 218
  • 353

4 Answers4

21

I had the same issue with Eclipse IDE. I mistakenly added the spring jar files under Modulepath. It should be under Classpath (Properties > Java Build Path > Classpath > addJARs ).

Josue Nsumba
  • 211
  • 2
  • 3
10

You need to add the libraries under classpath and not under modulepath.

Eclipse IDE

praveennin
  • 111
  • 1
  • 5
3

enter image description here

Spring libraries should be under classpath

Adarsh D
  • 511
  • 6
  • 14
2

Below steps worked for me: Go to project properties -> Libraries -> add your user libraries under classpath. Remove your librarey reference from Modulepath.

Project properties from eclipse

Mahesh
  • 21
  • 1