Error when trying to execute serve code

amine benjelloun8 years ago

Hello,
First thank you for all you do, it a formidable work.

When I execute this in a server (aws ec2 with ubuntu)
java -jar tracker-server.jar conf/traccar.xml

I have this error:

Exception in thread "main" java.io.FileNotFoundException: ./logs/tracker-server.log (Permission denied)
	at java.io.FileOutputStream.open0(Native Method)
	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
	at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
	at org.apache.log4j.FileAppender.<init>(FileAppender.java:110)
	at org.apache.log4j.DailyRollingFileAppender.<init>(DailyRollingFileAppender.java:203)
	at org.traccar.helper.Log.setupLogger(Log.java:61)
	at org.traccar.Context.init(Context.java:273)
	at org.traccar.Main.main(Main.java:35)

There is no file in logs, should I create it?
Or how can I give the Permissions to traccar to do that?

Thank you

Anton Tananaev8 years ago

The problem seems to be with Linux file permissions. Maybe you don't have the "logs" folder?

amine benjelloun8 years ago

I do have the logs folder, for now i didn’t change any permission. Should i change the permission of any file or folder?

Anton Tananaev8 years ago

Obviously process has to have access to the folder.

amine benjelloun8 years ago

Thank you!

I resolved the problem by launching Traccar with admin access.
This line:
sudo java -jar tracker-server.jar conf/traccar.xml
Instead of this one:
java -jar tracker-server.jar conf/traccar.xml

Is it a good solution? is that secure?

Anton Tananaev8 years ago

I think it's fine. We usually run it from a root user.