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.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @touseefkhan4pk
I checked to find that from 6.5 we moved away from sling fragment bundles exposing underlying jdk webservice support and no longer have the default JRE provider impl available from felix framework bundle. I found an internal request with our Engineering Team regarding the same, where a workaround is suggested as follows. Can you try boot delegating the following:
org.osgi.framework.bootdelegation=sun.*,com.sun.*,javax.xml.ws,javax.xml.ws.*,javax.xml.bind,javax.xml.bind.*,javax.xml.soap,javax.jws,javax.jws.soap
To do this change, you just need to edit the *sling.properties* file under *crx-quickstart\conf*. Search for org.osgi.framework.bootdelegation and amend the value.
Hi @touseefkhan4pk
I checked to find that from 6.5 we moved away from sling fragment bundles exposing underlying jdk webservice support and no longer have the default JRE provider impl available from felix framework bundle. I found an internal request with our Engineering Team regarding the same, where a workaround is suggested as follows. Can you try boot delegating the following:
org.osgi.framework.bootdelegation=sun.*,com.sun.*,javax.xml.ws,javax.xml.ws.*,javax.xml.bind,javax.xml.bind.*,javax.xml.soap,javax.jws,javax.jws.soap
To do this change, you just need to edit the *sling.properties* file under *crx-quickstart\conf*. Search for org.osgi.framework.bootdelegation and amend the value.
It works for me, thanks!
Hello @touseefkhan4pk ,
We have same problem with servlet on AEM Cloud. How could you fix it? These suggestions do not work for me.
REgards.
Views
Replies
Total Likes
Views
Likes
Replies