当前位置: 首页 > 知识库问答 >
问题:

带有java模块的springframework ldap核心程序

顾喜
2023-03-14
rg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ldapContextSource' defined in class path resource [org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.ldap.core.support.LdapContextSource]: Factory method 'ldapContextSource' threw exception; nested exception is java.lang.IllegalAccessError: class org.springframework.ldap.core.support.AbstractContextSource (in module spring.ldap.core) cannot access class com.sun.jndi.ldap.LdapCtxFactory (in module java.naming) because module java.naming does not export com.sun.jndi.ldap to module spring.ldap.core
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.context@5.2.2.RELEASE/org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.2.RELEASE.jar:na]
    at spring.context@5.2.2.RELEASE/org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.2.RELEASE.jar:na]
    at spring.boot@2.2.2.RELEASE/org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.2.RELEASE.jar:na]
    at spring.boot@2.2.2.RELEASE/org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.2.RELEASE.jar:na]
    at spring.boot@2.2.2.RELEASE/org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.2.RELEASE.jar:na]
    at spring.boot@2.2.2.RELEASE/org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.2.RELEASE.jar:na]
    at app/com.test.app.App.main(App.java:9) ~[classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.ldap.core.support.LdapContextSource]: Factory method 'ldapContextSource' threw exception; nested exception is java.lang.IllegalAccessError: class org.springframework.ldap.core.support.AbstractContextSource (in module spring.ldap.core) cannot access class com.sun.jndi.ldap.LdapCtxFactory (in module java.naming) because module java.naming does not export com.sun.jndi.ldap to module spring.ldap.core
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.2.RELEASE.jar:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.2.RELEASE.jar:na]
    ... 17 common frames omitted
Caused by: java.lang.IllegalAccessError: class org.springframework.ldap.core.support.AbstractContextSource (in module spring.ldap.core) cannot access class com.sun.jndi.ldap.LdapCtxFactory (in module java.naming) because module java.naming does not export com.sun.jndi.ldap to module spring.ldap.core
    at spring.ldap.core@2.3.2.RELEASE/org.springframework.ldap.core.support.AbstractContextSource.(AbstractContextSource.java:77) ~[spring-ldap-core-2.3.2.RELEASE.jar:na]
    at spring.boot.autoconfigure@2.2.2.RELEASE/org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration.ldapContextSource(EmbeddedLdapAutoConfiguration.java:93) ~[spring-boot-autoconfigure-2.2.2.RELEASE.jar:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
    at spring.beans@5.2.2.RELEASE/org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.2.RELEASE.jar:na]
    ... 18 common frames omitted


Process finished with exit code 1

 

共有1个答案

闻人修明
2023-03-14

如果您确实了解该错误,当它详细读到以下内容时:

模块java.naming不将com.sun.jndi.ldap导出到模块spring.ldap.core

然后,您可以为此制定解决方案,通过命令行使用修饰符作为JVM选项提供访问:

--add-exports java.naming/com.sun.jndi.ldap=spring.ldap.core
 类似资料:
  • 这些模块是 ansible 团队维护的核心模块,同样也是 ansible 自带的模块,在收到的的请求中,它们有比 “extras” 源更高的优先级 核心模块的源码托管在 Github 的 ansible-modules-core repo. 如果你确信你在核心模块上发现了一个 bug ,同时你使用的是最新的稳定版或者开发版本的 Ansible ,首先你需要看看 github.com/ansible

  • 19.2 核心与核心模块 谈完了整个开机的流程,您应该会知道,在整个开机的过程当中,是否能够成功的驱动我们主机的硬件配备, 是核心 (kernel) 的工作!而核心一般都是压缩文件,因此在使用核心之前,就得要将他解压缩后,才能载入内存当中。 另外,为了应付日新月异的硬件,目前的核心都是具有“可读取模块化驱动程序”的功能, 亦即是所谓的“ modules (模块化)”的功能啦!所谓的模块化可以将他想

  • alias syntax: alias file-path|directory-path; default: no context: location This directive assigns a path to be used for the indicated location. Note that it may look similar to the root directive, bu

  • 这个模块主要是参考了 Dropwizard 框架,是一位用户提醒我说有这么一个框架,然后里面实现一些很酷的东西。那个 issue 详细描述了该功能的雏形,然后就在参考该功能的情况下增加了一些额外的很酷的功能,接下来我将一一介绍这个模块中的几个功能:健康检查、性能调试、访问统计、计划任务。 如何安装 go get github.com/astaxie/beego/toolbox healthche

  • Macaron 会注入一些默认服务来驱动您的应用,这些服务被称之为 核心服务。也就是说,您可以直接使用它们作为处理器参数而不需要任何附加工作。 请求上下文(Context) 该服务通过类型 *macaron.Context 来体现。这是 Macaron 最为核心的服务,您的任何操作都是基于它之上。该服务包含了您所需要的请求对象、响应流、模板引擎接口、数据存储和注入与获取其它服务。 使用方法: pa

  • 任何人都可以帮助我将MongoDB驱动程序配置为JBoss中连接池的核心模块。请参阅我在阅读几篇文章后尝试的以下步骤。 EAP_HOME/modules/com/mongodb/main/ 创建了一个目录,并复制了 mongodb-driver-3.4.0-rc1.jar(rc1 版本,因为稳定版 3.3.0 不包含 MongoClientFactory.class)并创建了模块.xml文件,如下