Hey everyone, first time poster.
Excited about getting Traccar setup on my home-server to manage my Turo Fleet.
I want to setup traccar with mysql so that I have back-up of my database.
I followed the docs on this site but I clearly still dont' have it setup correctly.
I'll post my docker-compose first, my traccar.xml next, and then my logs.
Thanks for your help!
version: "3"
networks:
app-tier-traccar:
driver: bridge
services:
db:
image: mysql:8.0.20
container_name: db
command: --default-authentication-plugin=mysql_native_password
restart: always
volumes:
- /docker/traccar/mysql:/var/lib/mysql
- /docker/traccar/mysql/conf:/etc/mysql/conf.d
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=sKrillaz-22
networks:
- t2_proxy
traccar:
image: traccar/traccar:latest
container_name: traccar
depends_on:
- db
restart: always
volumes:
- /docker/traccar/traccar.xml:/opt/traccar/conf/traccar.xml:ro
- /docker/traccar/logs:/opt/traccar/logs:rw
ports:
- "4000-4150:5000-5150"
- "8082:8082"
environment:
- MYSQL_DATABASE=tc
- MYSQL_USER=tc
- MYSQL_PASSWORD=sKrillaz-22
networks:
labels:
caddy: fleet.naff.casa
caddy.reverse_proxy: "{{upstreams 8082}}"
- t2_proxy
volumes:
mysql-data:
mysql:
logs:
networks:
t2_proxy:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
<properties>
<entry key='config.default'>./conf/default.xml</entry>
<entry key='database.driver'>com.mysql.rj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://db:3306/tc?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=>
<entry key='database.user'>tc</entry>
<entry key='database.password'>sKrillaz-22</entry>
</properties>
at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:251)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1103)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1138)
at org.traccar.Main.run(Main.java:126)
... 1 more
Caused by: java.lang.ClassNotFoundException: com.mysql.rj.jdbc.Driver
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at org.traccar.storage.DatabaseModule.provideDataSource(DatabaseModule.java:63)
at org.traccar.storage.DatabaseModule$$FastClassByGuice$$1458797.GUICE$TRAMPOLINE(<generated>)
at org.traccar.storage.DatabaseModule$$FastClassByGuice$$1458797.apply(<generated>)
at com.google.inject.internal.ProviderMethod$FastClassProviderMethod.doProvision(ProviderMethod.java:260)
at com.google.inject.internal.ProviderMethod.doProvision(ProviderMethod.java:171)
at com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.provision(InternalProviderInstanceBindingImpl.java:185)
at com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.get(InternalProviderInstanceBindingImpl.java:162)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:40)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:60)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:296)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:60)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1100)
... 3 more
I hope this is info info, please let me know if you need anything else!
ClassNotFoundException?
I posted this because I wasn't able to figure it out on my own, not because I didn't try first before asking for help.
Keep in mind, not everyone using your product is a developer or coder.
I'm just a 40 year old dad trying to start a turo business and self host as much as I can to cut down on costs before I scale my fleet.
I already RTFM and that's how I got to my current state. I'm close!
Error message:
ClassNotFoundException: com.mysql.rj.jdbc.Driver
This is what you have in the config:
<entry key='database.driver'>com.mysql.rj.jdbc.Driver</entry>
This is from the documentation I asked you to double check:
<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
Hopefully you see the difference. You don't need to be a coder for this.
this is what I get for trying to type everything and avoid copy and pasting! LOL
Ok so I have a new set of errors though, and the web gui isn't even accessible anymore, like it was earlier (albeit with the blue line on top and no functionality)
Caused by: com.mysql.cj.exceptions.CJException: Access denied for user 'tc'@'traccar.t2_proxy' (using password: YES)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:129)
at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:787)
at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:709)
at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:677)
at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:137)
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:468)
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:210)
at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1369)
at com.mysql.cj.NativeSession.connect(NativeSession.java:133)
at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:842)
... 31 more
Now looks like either login issue or permission issues on the MySQL side.
Is my docker compose setup ideal for MySQL?
I couldn't find any documentation on it so I used i used another users (from this forum) compose and edited it to my own SQL settings.
Not sure about that. Not an expert in Docker Compose.
I got it working Anton!
I need a device for my fleet of cars that can unlock and lock the doors via traccar.
Is this possible?
Hey everyone, first time poster.
Excited about getting Traccar setup on my home-server to manage my Turo Fleet.
I want to setup traccar with mysql so that I have back-up of my database.
I followed the docs on this site but I clearly still dont' have it setup correctly.
I'll post my docker-compose first, my traccar.xml next, and then my logs.
Thanks for your help!
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'> <properties> <entry key='config.default'>./conf/default.xml</entry> <!-- This is the main configuration file. All your configuration parameters should be placed in this file. Default configuration parameters are located in the "default.xml" file. You should not modify it to avoid issues with upgrading to a new version. Parameters in the main config file override values in the default file. Do not remove "config.default" parameter from this file unless you know what you are doing. For list of available parameters see following page: https://www.traccar.org/configuration-file/ --> <entry key='database.driver'>com.mysql.rj.jdbc.Driver</entry> <entry key='database.url'>jdbc:mysql://db:3306/tc?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=> <entry key='database.user'>tc</entry> <entry key='database.password'>sKrillaz-22</entry> </properties>