Issue: The errors below are encountered when using SAP JCo and IDoc libraries version 3.1.12 in the MuleSoft SAP Connector. Following the steps provided in the MuleSoft SAP Connector documentation to configure the libraries in Anypoint Studio does not resolve the issue.
SAP JCo library Error:
java.lang.ExceptionInInitializerError: Illegal JCo archive "com.sap.conn.jco.sapjco3-3.1.12.jar". It is not allowed to rename or repackage the original archive "sapjco3.jar".
SAP IDoc library Error:
java.lang.ExceptionInInitializerError: Illegal IDoc library archive "sapidoc3-3.1.4.jar". It is not allowed to rename or repackage the original archive "sapidoc3.jar".
Cause: This error occurs while using SAP JCo and IDoc libraries version 3.1.12 due to new stricter validations introduced by SAP in this version. These changes are conflicting with the Maven's build process, which is leading to the this failure.
To resolve this error, add the following maven-shade-plugin configuration to the Mule application pom.xml file. In the code below, replace the placeholders "sapjco3-group-id:sapjco3-artifact-id" and "sapidoc3-group-id:sapidoc3-artifact-id" with the the actual group and artifact IDs from your SAP dependencies
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version> <!-- use latest version -->
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>false</minimizeJar>
<artifactSet>
<includes combine.children="append">
<include>sapjco3-group-id:sapjco3-artifact-id</include>
<include>sapidoc3-group-id:sapidco3-artifact-id</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
An example SAP dependencies is as shown below.
<dependency>
<groupId>com.sap.conn.jco</groupId>
<artifactId>com.sap.conn.jco.sapjco3</artifactId>
<version>3.1.12</version>
</dependency>
<dependency>
<groupId>com.sap.conn.idoc</groupId>
<artifactId>com.sap.conn.idoc.sapidoc3</artifactId>
<version>3.1.12</version>
</dependency>
Based on this, the full artifact coordinates to be placed under maven-shade-plugin is as below:
<include>com.sap.conn.jco:com.sap.conn.jco.sapjco3</include>
<include>com.sap.conn.idoc:com.sap.conn.idoc.sapidoc3</include>
Important Note: The shading plugin included in the pom.xml might increase the application size by nearly 2MB.
005108677

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.