Unable to derive module descriptor: Provider {class X} not in module
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.
JDK 11.0.2 - Unable to derive module descriptor in ECLIPSE
It seems the xpp3.jar
file is broken:
The JAR file contains the provider-configuration file META-INF/services/org.xmlpull.v1.XmlPullParserFactory
with the following content:
org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer
The two provider classes are specified as comma-separated list instead of one class per line. See Javadoc of ServiceLoader (highlighting in bold by me):
The file contains a list of fully-qualified binary names of concrete
provider classes, one per line.
See also the error message: it says Provider class and not Provider classes and there is no space after the ,
so it names only the single class with the invalid name org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer
.
The misleading error message talking about a module descriptor implies that the implementation of services specified via META-INF/services/*
files (available since Java 6), has been merged with the new implementation of JPMS services specified via the module-info.java
file (which are available since Java 9). This might result that in Java 9 and higher errors occur that did not occur in Java 8 and lower or that an error occurs at an earlier point in time (already when starting the application instead of when using it).
java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.bsf.BSFManager not in module error with ChromeDriver Selenium
InvalidModuleDescriptorException
InvalidModuleDescriptorException is thrown when reading a module descriptor and the module descriptor is found to be malformed or otherwise cannot be interpreted as a module descriptor.
InvalidModuleDescriptorException can be raised in either of the following scenarios:
- Issues with the Java project.
- Issues with the Java package with in a Java project.
- Issues with the Java class with in a Java package.
However, as per the discussion in Does Selenium v3.141 support Java 13? it seems the latest version of Selenium still doesn't supports java-13.
Solution
The strategic solution will be to install the latest version of JDK 8u222 and execute the @Tests
Additionally, you also need to replace uppercap W with the lowercap w in the System.setProperty()
line. So, effectively, you need to replace:
System.setProperty("Webdriver.chrome.driver","E:\\Selenium\\chromedriver.exe");
With
System.setProperty("webdriver.chrome.driver","E:\\Selenium\\chromedriver.exe");
Additional Consideration
Additionally, ensure that:
- Selenium is upgraded to current levels Version 3.141.59.
- ChromeDriver is updated to current ChromeDriver v79.0.3945.36 level.
- Chrome is updated to current Chrome Version 79.0 level. (as per ChromeDriver v79.0 release notes)
Related Topics
Nullpointerexception in Java with No Stacktrace
Difference Between _Java_Options, Java_Tool_Options and Java_Opts
Integrating Tomcat and Eclipse as a Hot-Deploy Environment
Import Maven Dependencies in Intellij Idea
Convert Existing Eclipse Project to Maven Project
Initializing Multiple Variables to the Same Value in Java
Calculating Distance Between Two Points, Using Latitude Longitude
Upload Files from Java Client to a Http Server
Java Embedded Databases Comparison
How to Use Classes from .Jar Files
Get Domain Name from Given Url
Java 8 Nested (Multi Level) Group By
Test If Element Is Present Using Selenium Webdriver
How to Set the Maximum Memory Usage for Jvm
How to Solve the Error "Not a Valid Xpath Expression"