Manually upgrade - including Java

code_af20 days ago

Hello everyone,

For some reasons, including no root access, when I wanted to update the traccar, I only update the contents of the, lib, schema, templates folder including the tracker-server.jar file, it was working perefectly. Now I see that the java version is updated in v6.3 where I have v6.2. Now I wanted to replace the content again, then it did not work because of the java version. I have also update/replace the jre folder but unfortunately it still does not work. Is there a workaround to update the traccar to the latest version without root access? or at least to update the java version of the traccar to 17.

The current Java version on my system is

OpenJDK version "11.0.15" 2022-04-19 LTS
OpenJDK runtime environment 18.9 (build 11.0.15+10-LTS)
OpenJDK 64-bit server VM 18.9 (build 11.0.15+10-LTS, mixed mode)

But after the update, when I run /opt/traccar/jre/bin/java -version, it shows:

Error occurred during VM initialisation
java/lang/NoClassDefFoundError: java/lang/Object
Anton Tananaev20 days ago

Why would you do something like this?

code_af20 days ago

If you mean why manually upgrade:
Because I don't have root access, but I can replace files and restart the service.

Anton Tananaev20 days ago

How can you update files without root access? I think you're not telling us some context because by default Traccar folder will be root only.

code_af20 days ago

To add context:
Traccar was installed by the root user. I have a regular user and the root user gave me write access to the /opt/traccar/ directory so I can replace/update files. I also have access to stop/start the traccar.service.

The same according to this link: https://www.traccar.org/run-as-non-root/

But I cannot execute other commands that require root privileges or access other directories and files than /opt/traccar/.

Anton Tananaev20 days ago

That doc is about running service as non-root, so it's completely irrelevant to this conversation.

Anyway, to answer your question, you should just extract installer and replace all files and folders.

code_af20 days ago

Thanks for your answer. Unfortunately replacing all files through files from extracted-installer, also doesn't work. Still not able to start the traccar service. Again if I check that if Java VM is working or not, after checking /opt/traccar/jre/bin/java -version the same bellow error shows:

Error occurred during VM initialisation
java/lang/NoClassDefFoundError: java/lang/Object

I think the main problem is somehow java vm.

Anton Tananaev20 days ago

How did you extract the files?

code_af20 days ago

I extracted the files in a separate test linux server, where I have root accesss.
First I downloaded the installer from: https://github.com/traccar/traccar/releases/tag/v6.6

Then I run this command at my test linux server:
./traccar.run --noexec --target ./extracted-traccar

Then I deleted the files traccar.service and setup.sh from extracted-traccar, I downloaded the remaining files and uploaded back to the live server. In live server, I removed all files (without config and templates) from /opt/traccar/ directory and pasted the new extracted files (without config and templates).

Anton Tananaev20 days ago

This looks correct to me.

code_af20 days ago

Is the traccar.service file is something which is being updated in some major versions? Because the traccar which we firstly installed was in september 2021, after that we are always replacing the files for a new upgrade.

Othewise we will ask the administrators to upgrade the traccar.

Anton Tananaev20 days ago

It does get updated sometimes. You can find history on GitHub.

code_af20 days ago

Would it be a problem if I replaced the jre folder's content with a version higher than 17 from this link?
https://jdk.java.net/archive/

I think, there is some files missing with my extraction of runner, or copying. But I downloaded a version from above link, extracted in a folder and saw the result of -version:

openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)

So, it means the java is working, and I am thinking that the problem is related to the java.

code_af20 days ago

I noted that instead of complete JDK, a jre is also available to download at: https://adoptium.net/de/temurin/releases/?version=17

Is traccar is using the same source for getting the jre? as I downloaded jre from above link and is also working, but that I extracted from installer has problem. If it is not the correct source, I will appreciate if I can get the information that from where I can get an updated jre which is used by traccar also.

code_af20 days ago

Finally fixed.

There was no need to download the jre or jdk separtely.

The manual upgrade, as we did above, was correct, the only thing happening was, that some files were missing between downloading and uploading back, after extracting. So I zipped the files after extracting the installer and unzipped them back on the live server, after restarting the service it worked.

Thanks for your help.