Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception Provider class xmlpull not found in modularized application #1155

Closed
tobiasdiez opened this issue Nov 11, 2019 · 7 comments
Closed

Comments

@tobiasdiez
Copy link

When using applicationinsights-core-2.5.1 in an modularized java 12 (or 13) application, you get the following error:

Error:java: java.lang.module.FindException: Unable to derive module descriptor for applicationinsights-core-2.5.1.jar
Provider class com.microsoft.applicationinsights.core.dependencies.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer not in module

The file /META-INF/services/com.microsoft.applicationinsights.core.dependencies.xmlpull.v1.XmlPullParserFactory indeed contains com.microsoft.applicationinsights.core.dependencies.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer which is indeed a strange format (as there should be one class per line). I guess one should use StAX instead of XPP3 anyway...

@trask
Copy link
Member

trask commented Nov 11, 2019

Hi @tobiasdiez, thanks for reporting this! I wonder if the problem is that org.xmlpull.mxp1_serializer.MXSerializer should be shaded.

Can you try modifying /META-INF/services/com.microsoft.applicationinsights.core.dependencies.xmlpull.v1.XmlPullParserFactory to instead contain

com.microsoft.applicationinsights.core.dependencies.xmlpull.mxp1.MXParser,com.microsoft.applicationinsights.core.dependencies.xmlpull.mxp1_serializer.MXSerializer

and see if that change would fix the issue?

@tobiasdiez
Copy link
Author

This issue is still present in 2.6:

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /home/runner/.gradle/caches/modules-2/files-2.1/com.microsoft.azure/applicationinsights-core/2.6.0/6eb3da0681d7bdf0aa6318c6946994a37d25f962/applicationinsights-core-2.6.0.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class com.microsoft.applicationinsights.core.dependencies.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer not in module
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /home/runner/.gradle/caches/modules-2/files-2.1/com.microsoft.azure/applicationinsights-core/2.6.0/6eb3da0681d7bdf0aa6318c6946994a37d25f962/applicationinsights-core-2.6.0.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class com.microsoft.applicationinsights.core.dependencies.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer not in module

@tobiasdiez
Copy link
Author

In 2.6.1 it is still present: JabRef/jabref#6594

@trask
Copy link
Member

trask commented Jun 9, 2020

Hi @tobiasdiez, can you create a github repository with a simple repro?

@jesjobom
Copy link

Hello. I am facing the same problem.
Here's a simple test.
https://github.com/jesjobom/applicationinsights-java-module-test

module-info.java

module com.jesjobom {
    requires applicationinsights.core; //automatic module
}

Error:

Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class com.microsoft.applicationinsights.core.dependencies.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer not in module

@Torrenal
Copy link

Torrenal commented Jun 1, 2021

Just going to throw this out there as a something that might save someone some work, or prod something into motion.

I've got insights working for another project in a modularized build by way of adding module-info to the insights jars...

The caveat is this is dependent on having a working webservice stack, which last I looked was still not jigsaw compliant, and still relied on reflection, meaning jdeps didn't ferret out all the needed dependencies. Making insights modular looks reasonably trivial compared to the j2ee stacks needed for webservice calls.

Use at own risk. Your mileage may vary. Insert caveat here.
Reminder: Jigsaw treats the 'static' keyword in module-info files as meaning "Optional" - those modules are added to the module-graph if available, but the application launch does not fail if they cannot be found.
module-info for logging was created against logging version 2.6.2.
module-info for core was created against core version 2.5.0
module-infos.txt

@trask
Copy link
Member

trask commented Sep 19, 2022

Closing, there are new 3.4.0 versions applicationinsights-core and applicationinsights-web artifacts that are modularized, and specifically target Application Insights Java 3.x. Please see upgrading from 2.x.

@trask trask closed this as completed Sep 19, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants