Loading

SAP Connector - Error: "It is not allowed to rename or repackage the original archive" when using JCo and IDoc libraries version 3.1.12

Publiceringsdatum: Aug 7, 2025
Beskrivning

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.

 

Lösning

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.

Knowledge-artikelnummer

005108677

 
Laddar
Salesforce Help | Article