Getting org.apache.cxf.jaxws.spi.ProviderImpl not found Issue in AEM
I am working on an AEM maven project where I have to consume a web service. I am using Eclipse for writing code and for its implementation using CXF library. The code works fine in a sample project but as soon as I deploy package on CRXD in AEM and then try from it, it gives following error on the very first line while creating service object.
javax.xml.ws.spi.FactoryFinder$ConfigurationError: Provider org.apache.cxf.jaxws.spi.ProviderImpl not found
It is the code I am using.
ServiceXML serviceXml = new ServiceXML(wsdlURL, SERVICE_NAME); IServiceXML ixmlPort = serviceXml.getSAApiTPSIntegrationsXML(); ((BindingProvider) ixmlPort).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "username"); ((BindingProvider) ixmlPort).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pssw0rd"); final String username = "username"; final String password = "pssw0rd"; Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication( username, password.toCharArray()); } }); metaData = ixmlPort.getMetadata("username", "CA");
These are the dependencies I have included in my pom
<dependency>
<groupId>org.glassfish.metro</groupId>
<artifactId>wssx-impl</artifactId>
<version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-frontend-jaxws -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-policy</artifactId>
<version>3.3.2</version>
</dependency>I think probably it is unable to find this CXF library in AEM environment. I search a lot for its solution and only thing could found that in some scenarios people suggesting to use OSGI bundles for it. But I am wondering why would we need bundle when we have included dependencies in pom and these should be part of the package. Kindly guide.