Feedback
Did this article resolve your question/issue?

   

Article

Connect for JDBC Salesforce driver conflicts with Jersey libraries

Information

 
TitleConnect for JDBC Salesforce driver conflicts with Jersey libraries
URL NameConnect-for-JDBC-Salesforce-driver-conflicts-with-Jersey-libraries
Article Number000186369
EnvironmentProduct: Connect for JDBC Salesforec driver
Version: All supported versions
OS: JAVA
Database: Salesforce
Application: All supported applications
Question/Problem Description
The JAXB libraries contained within the Connect for JDBC Salesforce driver conflicts with Jersey libraries
Steps to Reproduce
Clarifying Information
A runtime exception which only occurs when adding the Salesforce driver to the ODI's classpath. The exception occurs when invoking a REST service not related to Salesforce from ODI.
Error Messagejava.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;
at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119)
at org.glassfish.jersey.client.JerseyWebTarget.(JerseyWebTarget.java:71)
at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:290)
at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:76)
at oracle.odi.runtime.agent.processor.impl.TestDataServerProcessor.testRestDS(TestDataServerProcessor.java:622)
at oracle.odi.runtime.agent.processor.impl.TestDataServerProcessor.access$200(TestDataServerProcessor.java:70)
at oracle.odi.runtime.agent.processor.impl.TestDataServerProcessor$1.doAction(TestDataServerProcessor.java:205)
Defect Number
Enhancement Number
Cause
Salesforce driver uses CXF, which in turn includes Jersey 1.0. So an application that uses Jersey has our jar in classpath before Jersey jars, it will find our implementation. This will cause the application to fail if they are using JAX-RS version greater than the one packaged with our jar file.
Resolution
Fixed in hot fix 5.1.4.00147

Refer to Connect for JDBC hot fix download and install instructions for instructions on how to download and install the hot fix.
 
Workaround
Possible workaround:
Salesforce includes a copy of jax-rs 1.1 and Jersey 1.? in the packages com.ddtek.sforce.externals.org.apache.cxf.jaxrs.*. The implementation of jax-rs is declared in the service file META-INF/services/javax.ws.rs.ext.RuntimeDelegate. When the Salesforce jar gets included before other jax-rs implementation jars, our service file gets loaded and the client application will see our implementation of the jax-rs. This can result in errors if the jax-rs that the client is using is latest version (2.0).

To make sure the right implementation of jax-rs gets picked up in client application, the class javax.ws.rs.ext.RuntimeDelegate provides a static method setInstance, which accepts an instance of RuntimeDelegate implementaiton. This can be set to the instance of implementation that the client application needs needs.

To set the jax-rs implemetation to Jersey 2.x, the following line can be added to the application before using any other jax-rs classes:
RuntimeDelegate.setInstance(new org.glassfish.jersey.internal.RuntimeDelegateImpl());

For more information look at the implementation of methods javax.ws.rs.ext.RuntimeDelegate#findDelegate and javax.ws.rs.ext.FactoryFinder#find
Notes
Last Modified Date7/5/2016 3:46 PM
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.