Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何修复Spring(java11)中的错误java.lang.module.FindException_Java_Spring_Module_Java 11 - Fatal编程技术网

如何修复Spring(java11)中的错误java.lang.module.FindException

如何修复Spring(java11)中的错误java.lang.module.FindException,java,spring,module,java-11,Java,Spring,Module,Java 11,我已经在StackOverflow上读了将近一个小时的帖子,没有一个解决方案对我有效。 我正在使用Eclipse和JDK11学习一门初级春季课程。终端中出现以下错误: An error occurred during initialization of boot layer java.lang.module.FindException: Module proyectoSpringUno not found 这是我的java文件: package es.pildoras.IoC; import

我已经在StackOverflow上读了将近一个小时的帖子,没有一个解决方案对我有效。 我正在使用Eclipse和JDK11学习一门初级春季课程。终端中出现以下错误:

An error occurred during initialization of boot layer
java.lang.module.FindException: Module proyectoSpringUno not found
这是我的java文件:

package es.pildoras.IoC;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class UsoEmpleados {

    public static void main(String[] args) {    
        
        ClassPathXmlApplicationContext contexto = new ClassPathXmlApplicationContext("applicationContext.xml");
        
        Empleados Juan = contexto.getBean("miEmpleado",Empleados.class);
        
        System.out.println(Juan.getTareas());
        
        contexto.close();
    }

}
我在导入时出错,显示:

The type org.springframework.context.support.ClassPathXmlApplicationContext is not accessible
我知道发生这个错误是因为我使用的是java模块系统,如果我使用java 8,所有这些问题都会消失,但我对这个解决方案不感兴趣,因为我想学习如何在较新的java JDK中使用Spring

目前,我已将所有LIB添加到类路径中,但没有添加到Modulepath中

我尝试过的解决方案: 将LIB添加到modulepath。 结果:这不起作用。当我将libs添加到modulepath时,Eclipse会从类路径中删除libs(可能是为了避免重复)。现在,我在模块信息(eclipse插入的自动模块)或导入中没有任何问题,但当我启动应用程序时,出现以下错误:

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for C:\Users\Stephane\Desktop\curso Spring\ProyectoSpringUno\libs\spring-context-indexer-5.3.6-sources.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.springframework.context.index.processor.CandidateComponentsIndexer not in module
这是模块信息:

module ProyectoSpringUno {  
    exports es.pildoras.IoC;
    requires spring.context; // this is automaticly added by eclipse when i add libs to the modulepath
}
恢复
  • 当我将依赖项添加到modulepath时,Eclipse无法工作,因为他希望它位于类路径中
  • 当我将依赖项添加到类路径时,eclipse说我需要将一些依赖项移动到modulepath,否则模块信息将无法工作
  • eclipse不允许我将它们添加到modulepath和classpath中,因为它们是重复的
你知道怎么解决这个问题吗