(I’ve made this a new forum question)
I’ve managed to get all required JARs (39 of them!) into the package code/jars folder. But the Java service now fails with the dependency error below. Any ideas how to resolve?
Basically, I need to compel my Java code (and classes it calls) to use the newly packaged Jackson version 2.x JARs (instead of Jackson version 1.x JARs packaged by IS).
Could not run 'deliverDataToAzureBlobStorageService'
java.lang.reflect.InvocationTargetException: Package versions: jackson-annotations=2.10.1, jackson-core=2.10.1, jackson-databind=2.10.1, jackson-dataformat-xml=unknown, jackson-datatype-jsr310=unknown, azure-core=1.22.0, Troubleshooting version conflicts: https://aka.ms/azsdk/java/dependency/troubleshoot
Below, I outlined the steps taken to package up the JARs.
1. #Install Maven and check version
#Adapted from https://tecadmin.net/install-apache-maven-on-fedora/
wget https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz
sudo tar xzf apache-maven-3.8.4-bin.tar.gz -C /opt
cd /opt && sudo ln -s apache-maven-3.8.4 maven
sudo vi /etc/profile.d/maven.sh
Add this content
--------------------------
export M2_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}
--------------------------------
source /etc/profile.d/maven.sh
mvn -version
2. # Go to home folder, initialize Maven and have it generate a dummy pom.xml
#Adapted from https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
cd
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
3. #Configure Maven to download all required JARs for Azure Blob storage locally
#Adapted from https://technology.amis.nl/software-development/java/download-all-directly-and-indirectly-required-jar-files-using-maven-install-dependencycopy-dependencies/
cd my-app
vi pom.xml
Add the following to the dependencies section:
# Dependency adapted from: https://docs.microsoft.com/en-us/java/api/overview/azure/storage?view=azure-java-stable)
# Only the first dependency is taken. The current version is used
#If not, you can expect a "Could not resolve dependencies" error
-----------------------
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-blob</artifactId>
<version>12.4.0</version>
</dependency>
----------------------------
mvn install dependency:copy-dependencies
4. #Maven now downloads 39 JAR files to the 'my-app/target/dependency/' folder
# Move these into the IS <package>/code/jars folder.
#Reload your package
cd /home/<user>/my-app/target/dependency/
5. #At this point, running the service gets past the missing JAR errors, but returns this new dependency error below.
-----------------------------
java.lang.reflect.InvocationTargetException: Package versions: jackson-annotations=2.10.1, jackson-core=2.10.1, jackson-databind=2.10.1, jackson-dataformat-xml=unknown, jackson-datatype-jsr310=unknown, azure-core=1.22.0, Troubleshooting version conflicts: https://aka.ms/azsdk/java/dependency/troubleshoot
-----------------------------
#This is probably because IS 10.1 shows the 1.x version of the Jackson JAR loaded on it's 'About' page, while the JAR version used by Azure is 2.x:
# /opt/SoftwareAG101/IntegrationServer/lib/jars/jackson-coreutils-1.8.jar