Traccar server on Raspberry Pi 4

RichardGa year ago

Traccar comes with java, so there is no need to install additional versions of java, jre or openjdk.. or any other variant.

The instructables guide that you followed states otherwise, but that is not the case. It needs to be corrected.

The Traccar java file is in the location /opt/traccar/jre/bin/

You can see for yourself, by entering the the traccar java folder and listing the contents of the directory.

cd /opt/traccar/jre/bin/

List the directory contents

ls -alh 

The directory listing.

-rwxr-xr-x 1 root root 13120 Feb 12 02:23 java*
-rwxr-xr-x 1 root root 13176 Feb 12 02:23 jrunscript*
-rwxr-xr-x 1 root root 13144 Feb 12 02:23 keytool*
-rwxr-xr-x 1 root root 13144 Feb 12 02:23 rmid*
-rwxr-xr-x 1 root root 13144 Feb 12 02:23 rmiregistry*

You can refer to my post 'post-59689' in this thread to attempt to run traccar from the command line to see if it will start.

Raoula year ago

Hi Richard,
Thanks a lot for your support!
See below for my commands and results:

raoul@Raspberry:/opt/traccar/jre/bin$ ls -alh
total 68K
drwxr-xr-x 2 root root 4,0K feb 16 09:17 .
drwxr-xr-x 7 root root 4,0K feb 16 09:17 ..
-rwxr-xr-x 1 root root 8,5K feb 16 09:17 java
-rwxr-xr-x 1 root root 8,5K feb 16 09:17 jrunscript
-rwxr-xr-x 1 root root 8,5K feb 16 09:17 keytool
-rwxr-xr-x 1 root root 8,5K feb 16 09:17 rmid
-rwxr-xr-x 1 root root 8,5K feb 16 09:17 rmiregistry
raoul@Raspberry:/opt/traccar/jre/bin$ cd
raoul@Raspberry:~$ /opt/traccar/jre/bin/java -jar tracker-server.jar /opt/traccar/conf/traccar.xml
bash: /opt/traccar/jre/bin/java: No such file or directory
raoul@Raspberry:~$ 

Although java is there, the system doesn't seem to find it.

RichardGa year ago

We've overlooked the fact that tracker-server.jar needs to be run from within the /opt/traccar location, unless we're using complete paths.
You are currently in the /opt/traccar/bin/java folder, so my bad there for not advising correctly.

Try run this updated command which specifies the full location of tracker-server.jar:

/opt/traccar/jre/bin/java -jar /opt/traccar/tracker-server.jar /opt/traccar/conf/traccar.xml

If no luck with the above command, you can try install another version of Java and attempt to run traccar with it.

  1. Install Java 'default-jre-headless"

    apt install default-jre-headless
  2. Rename the existing traccar java bin. We don't want to delete it because we might need to restore it.

    mv /opt/traccar/jre/bin/java /opt/traccar/jre/bin/java-backup
  3. Create a symbolic link for the file location /opt/traccar/jre/bin/java to point to the newly installed Java.

    ln -s /usr/bin/java /opt/traccar/jre/bin/java
  4. Attempt to run traccar from command line again

    /opt/traccar/jre/bin/java -jar /opt/traccar/tracker-server.jar /opt/traccar/conf/traccar.xml
Anton Tananaeva year ago

We overlooked? This was one of the first things I said:

https://www.traccar.org/forums/topic/traccar-server-on-raspberry-pi-4/#post-59645

RichardGa year ago

I wasn't referring to you.

Raoula year ago

Hi Guys,
I kept very well in mind that I do not need to install java again, as said earlier by Anton.
(Although I installed java one time and tried to launch the application: tracker-server.jar.
I succeeded one time to get the server running again but after a restart of the system I could not get the server running again).
However I made some progress: please take a look at the following comand:

raoul@Raspberry:/opt/traccar/jre/bin$ java -jar tracker-server.jar conf/traccar.xml 
Error: Unable to access jarfile tracker-server.jar
raoul@Raspberry:/opt/traccar/jre/bin$ 

So the command recognizes java but cannot access the jar file.
Reading about jar files I see that they should be stored in a kind of myJarfile??

Raoula year ago

The traccar server has now been running late sunday eveneing and this afternoon, but as soon as I have it running I want to be sure that it will remain running after a restart of the system..
In both cases I was not able to repeat the procedure to start the server again.

Raoula year ago

P.S.: as soon as the server runs I can see him on my mobile phone including my 3 GPS devices.. So all necessary ports are open in such a case

RichardGa year ago

In regards to your error message Refer to my post above. #post-59710

RichardGa year ago

If you restart the server and traccar does not automatically run, then take note of each of your steps to get it to the point of where it is working again. using that information you should be able to resolve the issue.

Raoula year ago

I even made a copy of the Terminal with all command to come that far. But repeating those command does not yield results after a restart!!
Very frustrating.....

RichardGa year ago

You can try to work out what you did that fixed it by checking what commands you ran previously.

history

Otherwise, you can try to reboot the server and follow the instructions I provided above in #post-59710

Raoula year ago

As you can see in #59713 I already used the correct folder for using java

I use the command "history" frequently.
I tried this afternoon with java version: jre-8u281-linux-x64

Any suggestions why java does not see the tracker-server.jar file?

Tomorrow I will try to execute #59710

Thanks a lot guys,...everyday little steps...(for me!)

Raoula year ago

This is what happens when I give the following command:

raoul@Raspberry:/opt/traccar/jre/bin$ sudo java -jar /opt/traccar/tracker-server.jar /opt/traccar/conf/traccar.xml
[sudo] password for raoul: 
2021-02-16 21:36:34 ERROR: Main method error - ./conf/default.xml (No such file or directory) - FileNotFoundException (... < Config:44 < Context:272 < Main:120 < ...)
Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: ./conf/default.xml (No such file or directory)
    at org.traccar.Main.run(Main.java:147)
    at org.traccar.Main.main(Main.java:106)
Caused by: java.io.FileNotFoundException: ./conf/default.xml (No such file or directory)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
    at org.traccar.config.Config.<init>(Config.java:44)
    at org.traccar.Context.init(Context.java:272)
    at org.traccar.Main.run(Main.java:120)
    ... 1 more
Anton Tananaeva year ago

Change directory to /opt/traccar.