Hi All, We are implementing a SOAP call in our application and building the project using Java 11, in which while making a call to the SOAP API we get the following error. Please help us to resolve this issue.
Error
java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl not found by org.apache.felix.http.jetty
I tried adding the dependency of com.sun.xml to my POM files and installed it as a separate osgi bundle as well, but it didn't help
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.5</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-ri</artifactId>
<version>2.3.5</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>rt</artifactId>
<version>2.3.5</version>
</dependency>
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
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.
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 dependency jaxws-rt (runtime) and jaxws-ri (reference implementation) from com.sun.xml.ws are correct choices. However, they need proper OSGi metadata.
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>
Explicitly set the JAX-WS provider in your code: System.setProperty("javax.xml.ws.spi.Provider", "com.sun.xml.internal.ws.spi.ProviderImpl");
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>
After deploying the bundle, confirm that the required classes are available:
Enable OSGi debug logging to track classloader issues:
Also you can check this article: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/invoking-soap-web-services...
Best regards,
Kostiantyn Diachenko.
Views
Replies
Total Likes
Can you please try adding below dependencies :
<dependencies>
<!-- JAX-WS API -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>javax.xml.ws-api</artifactId>
<version>2.3.1</version> <!-- Choose the appropriate version -->
</dependency>
<!-- JAX-WS Runtime (provided by Metro) -->
<dependency>
<groupId>org.glassfish.metro</groupId>
<artifactId>jaxws-ri</artifactId>
<version>2.3.2</version> <!-- Or the latest version -->
</dependency>
<!-- JAX-WS Runtime (Optional for SOAP Handler) -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.3</version>
</dependency>
</dependencies>
Views
Replies
Total Likes
Views
Like
Replies