无法派生模块描述符:提供程序 {class X} 不在模块中 [英] Unable to derive module descriptor: Provider {class X} not in module

查看:44
本文介绍了无法派生模块描述符:提供程序 {class X} 不在模块中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试编译新的模块化 Java 11 应用程序时收到此错误消息:

启动层初始化时出错java.lang.module.FindException:无法为 C:Usersinter.m2
epositoryxalanxalan2.7.2xalan-2.7.2.jar 派生模块描述符引起:java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.bsf.BSFManager not in module

这似乎是依赖项的依赖项的问题.我什至找不到哪个模块在拉它,所以我可以更新它.

我使用的是 openjdk 11.0.2、IntelliJ 2018.3.4、Maven

有什么建议可以解决或解决此问题吗?我发现关于这个问题的文档很少.

解决方案

Xalan

我在

因此在 2.7.2 版本的 JAR 中,有服务声明 (META-INF/services),其中包括 org.apache.xalan.extensions.bsf.BSFManager 作为其中之一.此处的服务文件必须为其自身指明提供者,并且该类应该存在于要解析的模块路径上,以便可靠地配置模块.

在这种情况下,对于模块 xalan(自动模块),列出的服务没有将提供者类打包在依赖项本身中.(参见包 org.apache,它没有进一步的包 bsf 和类 BSFManager 因此.因此,你得到的例外.

短期黑客

解决这个问题的调整之一是更新库 jar(修补它)并在您不使用服务文件时删除它.或者添加从相应工件复制的提供程序.

如果您不直接依赖此工件或其父依赖项,您可以让它们保留在 --classpath 上并作为 未命名模块 用于您的应用程序.

长期解决

一种理想的方法是向维护者报告并解决它.这取决于他们维护它的积极程度,例如xalan 的最后一个版本是将近 5 年前,我认为可能只是想寻找一个积极参与的替代方案.

I am getting this error message when I try to compile my new modularized Java 11 application:

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for C:Usersinter.m2
epositoryxalanxalan2.7.2xalan-2.7.2.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.bsf.BSFManager not in module

This appears to be an issue from a dependency of a dependency. I can't even find which module is pulling it in so I can update it.

I am using openjdk 11.0.2, IntelliJ 2018.3.4, Maven

Any advice how I can troubleshoot or fix this? I have found very little documentation on this issue.

解决方案

Xalan

I had a look at their bug tracker following their index page and wasn't able to find this reported and not sure how actively is the library being maintained either.


General Explanation

Just to explain what has caused the issue in your code, I would share a screenshot and then try to add details around it.

So within the JAR that for version 2.7.2, there are service declarations (META-INF/services) which include org.apache.xalan.extensions.bsf.BSFManager as one of them. The service file here has to indicate the Provider thereby for itself and the class is supposed to be present on the modulepath to be resolved for reliable configuration of modules.

In this case for the module xalan(automatic module), the service listed doesn't have the provider class packaged within the dependency itself. (See the package org.apache, it doesn't further have package bsf and the class BSFManager thereby. Hence the exception as you get.

Short term hack

One of the tweaks to get that resolved would be to get update the library jar (patch it) and get rid of the service file if you're not using it. Or to add the provider copied from the corresponding artifact.

If you don't directly depend on this artifact or its parent dependencies, you can let those remain on the --classpath and get resolved as an unnamed module for your application.

Long term solve

An ideal way would be to report this to the maintainers and getting it resolved. It depends though on how actively are they maintaining it e.g. the last release for xalan was almost 5 years back, might just want to look for an actively participated alternative in my opinion.

这篇关于无法派生模块描述符:提供程序 {class X} 不在模块中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆