How To Install Traccar 4.1 With MariaDB

IBRAHIM ALSAYED6 years ago

Hello,

I installed Traccar 4.1 on ubuntu 18.04 and is work perfectly, But i need the database MariaDB and i make everything note that database is Remote MySQL , PhpMyAdmin and i gave Access Host but not work and here my default.xml

<?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='web.port'>80</entry>
    <entry key='geocoder.enable'>false</entry>
    <entry key='database.driverFile'>./lib/mariadb-java-client-2.3.0.jar</entry>
    <entry key='database.driver'>org.mariadb.jdbc.Driver</entry> 
    <entry key='database.url'>jdbc:mariadb://209.124.64.126:3306/floraonet_Traccar?allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>
    <entry key='database.user'>floraonet_User</entry> 
    <entry key='database.password'>P@123456</entry>
</properties>

And here the Server Logs

2018-10-27 15:02:57 ERROR: Main method error - java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader - ClassCastException (DataManager:106 < *:90 < Context:382 < Main:110 < ...)
2018-10-27 15:04:00 ERROR: Main method error - java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader - ClassCastException (DataManager:106 < *:90 < Context:382 < Main:110 < ...)
2018-10-27 15:24:11 ERROR: Main method error - java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader - ClassCastException (DataManager:106 < *:90 < Context:382 < Main:110 < ...)
2018-10-27 15:36:06 ERROR: Main method error - org.mariadb.jdbc.Driver - ClassNotFoundException (... < DataManager:114 < *:90 < Context:382 < Main:110 < ...)
2018-10-27 15:39:20 ERROR: Main method error - java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader - ClassCastException (DataManager:106 < *:90 < Context:382 < Main:110 < ...)

i need your help to connect with MariaDB

and thx,

Anton Tananaev6 years ago

Use MySQL driver.

bublik56 years ago

I've got the same issue.

If I change to mysql driver instead of mariadb connector
https://pastebin.com/fCS0e7P3

I get next error
https://pastebin.com/uWZZaQHN

ERROR: Main method error - 1 - ArrayIndexOutOfBoundsException (... < DataManager:306 < *:91 < Context:382 < Main:110 < ...)

Smth got wrong with mariadb since traccar 4.0 =(

bublik56 years ago
Anton Tananaev6 years ago

I would recommend you search forum. It has already been discussed several times.

bublik56 years ago

Unfortunately forum solutions do not work with 4.1. But they did work with 4.0.

Smth is still in 4.1 update.
Even clean installation didn't help me.

Tried to move back to clean 4.0 installation . It does tables renaming like

ALTER TABLE mytraccardb.device_geofence RENAME mytraccardb.tc_device_geofence 

and then I get errors in web interface like
http://prntscr.com/lckkgb

bublik56 years ago

There is a typo in my previous post.
MariaDB solutions did work fine with 3.17
But fails with 4.0-4.1
Simple driver replacement doesn't help. Just crashes in another lines of code

bublik56 years ago

Ok, I can make a conclusion now.

MariaDB connector 2.3.0 works fine in 4.0 (at least on a clean installation and clean database)
But fails in 4.1 because of traccar built-in java environment...
though it CAN create two tables - databasechangelog and databasechangeloglock and crashes somewhere after that

I tried to migrate from 4.0 to 4.1 with created tables but no success.
I have no ideas now what can I do now with mariadb.
mysql driver doesn't work either

Anton Tananaev6 years ago

I would recommend you to search again because, as I said, the issue has been discussed and solved.

bublik56 years ago

That was quite difficult to find... Had to read each topic on forum in descending order... no tags about mariadb there. I think you could help me quicker...

https://www.traccar.org/forums/topic/another-40-greater41-problem/
so what helped me -

  1. replace
    https://github.com/traccar/traccar/commit/e4bbd04c84dffa351e2b782df9b7bedb19c314c3
    xml file with a correct one
  2. Use MySQL driver. Yes, MySQL.

But that is all about clean installation, no ideas about migrating...

Thank you all

bublik56 years ago

http://prntscr.com/lco4zb noticed that, maybe that will be useful for you

Anton Tananaev6 years ago

Again, this has been posted and discussed several time.

Of course I can answer quicker than you can by doing your own search, but that's not the point. I have limited time and if I need to waste it on answering questions that have already been answered, the progress of this project would halt completely. The expectation is that people would respect my time and do their homework first before asking anything. The only exception is if you are using any of our paid subscription, but in that case I would recommend to use email for support.