Hi @saravanan_ms ,
The error java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl indicates that the required JAX-WS implementation is not accessible to the AEM classloader. This happens because the Java runtime in AEM is modularized, and dependencies need to be explicitly managed in the OSGi framework.
Problem Analysis
The class com.sun.xml.internal.ws.spi.ProviderImpl is part of the JAX-WS reference implementation, and its absence in the OSGi environment suggests:
- The required libraries are not correctly packaged as OSGi bundles.
- The dependencies are not resolving properly in the OSGi container due to missing metadata in the bundle or incorrect configurations.
Solution
1. Use a Compatible JAX-WS Implementation
The dependency jaxws-rt (runtime) and jaxws-ri (reference implementation) from com.sun.xml.ws are correct choices. However, they need proper OSGi metadata.
Convert JARs to OSGi Bundles
Ensure your JAX-WS libraries are OSGi-compliant:
Use the Apache Felix Maven Bundle Plugin to wrap non-OSGi JARs into OSGi bundles.
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.6</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>com.sun.xml.ws.jaxws-rt</Bundle-SymbolicName>
<Export-Package>
com.sun.xml.internal.ws.spi;version="2.3.5",
com.sun.xml.ws.*;version="2.3.5"
</Export-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
- Deploy the resulting OSGi bundle into AEM.
2. Adjust SlingServlet to Load the Provider
Explicitly set the JAX-WS provider in your code: System.setProperty("javax.xml.ws.spi.Provider", "com.sun.xml.internal.ws.spi.ProviderImpl");
3. Handle Classloading in AEM
Ensure your bundle imports the required packages. Update the Import-Package statement in your POM:
<Import-Package>
com.sun.xml.internal.ws.spi,
javax.xml.ws.spi,
*
</Import-Package>
4. Verify SOAP Library in Runtime
After deploying the bundle, confirm that the required classes are available:
- Go to AEM Web Console → Bundles (http://<host>:<port>/system/console/bundles).
- Check if the JAX-WS libraries are installed and active.
5. Debug the Resolution Issues
Enable OSGi debug logging to track classloader issues:
- Open AEM Web Console → Log Support.
- Add a logger for org.apache.felix.framework at DEBUG level.
Also you can check this article: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/invoking-soap-web-services-inside-aem-osgi-service-using-apache/m-p/396485
Best regards,
Kostiantyn Diachenko.