Maven error: Unable to load cache item not working on vps but works locally

Viewed 2107

So I have been trying to compile my maven project on a VPS and made sure that all the versions of maven and jdk are the same as on my system. I even use the same system yet when I compile it on the VPS I get the error:

[ERROR] Error executing Maven.
[ERROR] java.lang.IllegalStateException: Unable to load cache item
[ERROR] Caused by: Unable to load cache item
[ERROR] Caused by: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper

the output of mvn -v is:

Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 17.0.1, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-17-oracle
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-97-generic", arch: "amd64", family: "unix"

output of java -version is:

java version "17.0.1" 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
1 Answers

The problem is that you maven version is too old, similar to this qustion. Try updating maven manually. If you have curl installed, run

curl -O https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.zip

in the directory that should contain maven at the end. Unzip it with

unzip apache-maven-3.8.6-bin.zip

There should now be a new directory called apache-maven-3.8.6. Now add apache-maven-3.8.6/bin to your PATH. If you don't know how to do this: add

export PATH="$PATH:YOURPATH/apache-maven-3.8.6/bin"

to ~/.profile. But remember to change YOURPATH to the path where the apache-maven-3.8.6 directory is located.

Related