Recommend way to install sapjco3.jar in ESB runtime

One Star

Recommend way to install sapjco3.jar in ESB runtime

Hi,
there are multiple threads in this forum that deal with UnsatisfiedLinkError for sapjco3.jar in TOS. I'm fine with it, the jar is in lib/java and used if I execute routes/ jobs within the Studio. However if I deploy the stuff to the ESB runtime, I have several problems. Sometimes I get the error that the native library is already loaded in another classloader. Sometimes I get ClassNotFound exceptions. It's not reproducible, the behaviour changes after restart.
What's the recommend way to install the sapjco3.jar in the ESB runtime? In my view the jar has to be deployed only once for the whole ESB to avoid issues with the native library. So should I install it in OSGi way or put it in lib (or container/lib)?
Cheers
Dennis
Employee

Re: Recommend way to install sapjco3.jar in ESB runtime

HI,
for the ESB please see \add-ons\datasources\sap (within the Talend ESB / TESB SE package). There is a readme.txt and some config files which explains the way we recommend to setup the sapjco3.jar in a proper way and as you said, only one per container (in the tSAPxxx components you can use the 'Shared Destination' option which is the 'connection' pool for the jco library and something you should consider to use. (only the new 5.5.1 release includes this folder, not available in older releases) 
HTH,
Dietmar 
One Star

Re: Recommend way to install sapjco3.jar in ESB runtime

Hi Dietmar,
thanks this README is exactly what I was looking for and should be referenced in the documentation. There is one point left: If I select "Shared Destination" everything works in the ESB Runtime but I get an exception during development and testing in TOS:
Exception in component tSAPConnection_1
com.sap.conn.jco.JCoException: (106) JCO_ERROR_RESOURCE: Destination SAP_CONNECTION_POOL could not be created: java.lang.RuntimeException: File xxx/TOS_ESB-r118616-V5.5.1/Studio/./SAP_CONNECTION_POOL.jcoDestination does not exist.
at com.sap.conn.jco.rt.DefaultDestinationManager.update (DefaultDestinationManager.java:208)
at com.sap.conn.jco.rt.DefaultDestinationManager.searchDestination (DefaultDestinationManager.java:374)
at com.sap.conn.jco.rt.DefaultDestinationManager.getDestinationInstance (DefaultDestinationManager.java:89)
at com.sap.conn.jco.JCoDestinationManager.getDestination (JCoDestinationManager.java:77)
at xxx.SapService.tSAPConnection_1Process
(...)
Caused by: java.lang.RuntimeException: File xxx/TOS_ESB-r118616-V5.5.1/Studio/./SAP_CONNECTION_POOL.jcoDestination does not exist.
at com.sap.conn.jco.rt.FileDestinationsDataProvider.loadProperties (FileDestinationsDataProvider.java:91)
at com.sap.conn.jco.rt.FileDestinationsDataProvider.getDestinationProperties (FileDestinationsDataProvider.java:77)

How can I avoid that? I don't want to change it everytime before the deployment.
Cheers
Dennis
One Star

Re: Recommend way to install sapjco3.jar in ESB runtime

As a workaround I've now created a SAP_CONNECTION_POOL.jcoDestination file in the Studio directory with the properties documented in the Javadoc of the DestinationDataProvider.
As far as I can see the javajet files of the SAP components already contain a check if com.sap.conn.jco.JCoDestinationManager.getDestination(<%=alias%>) returns null. The connection configuration in the Studio should be hidden if shared destination is selected or the exception should be catched here (to allow fallback to the specified configuration).