Traccar Not starting 5.2

Glenn Miler2 years ago

Hi guys

I have a real strange issue, which i can't get my head around, as the traccar server does not start, but it had worked, but then i got a corrupted database by the provider, and they managed to fix that, but now it still does not want to start, and i am not getting any messages in /opt/traccar/logs, but that i am guessing due to the fact it is not starting.

Here is the print out from the syslog log file, maybe some of you can help in the investigation.

Sep 30 06:25:07 track systemd[1]: Stopped traccar.
Sep 30 06:25:07 track systemd[1]: Started traccar.
Sep 30 06:25:08 track traccar[16530]: 2022-09-30 06:25:08 ERROR: Main method error -  - SAXParseException (... < Config:46 < <gener:-1 < *:-1 < ... < Main:118 < ...)
Sep 30 06:25:08 track traccar[16530]: Exception in thread "main" java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector, see the following errors:
Sep 30 06:25:08 track traccar[16530]: 1) [Guice/ErrorInjectingConstructor]: RuntimeException: Configuration file is not a valid XML document
Sep 30 06:25:08 track traccar[16530]:   at Config.<init>(Config.java:42)
Sep 30 06:25:08 track traccar[16530]:   at MainModule.configure(MainModule.java:98)
Sep 30 06:25:08 track traccar[16530]:   while locating Config
Sep 30 06:25:08 track traccar[16530]: Learn more:
Sep 30 06:25:08 track traccar[16530]:   https://github.com/google/guice/wiki/ERROR_INJECTING_CONSTRUCTOR
Sep 30 06:25:08 track traccar[16530]: 1 error
Sep 30 06:25:08 track traccar[16530]: ======================
Sep 30 06:25:08 track traccar[16530]: Full classname legend:
Sep 30 06:25:08 track traccar[16530]: ======================
Sep 30 06:25:08 track traccar[16530]: Config:           "org.traccar.config.Config"
Sep 30 06:25:08 track traccar[16530]: MainModule:       "org.traccar.MainModule"
Sep 30 06:25:08 track traccar[16530]: ========================
Sep 30 06:25:08 track traccar[16530]: End of classname legend:
Sep 30 06:25:08 track traccar[16530]: ========================
Sep 30 06:25:08 track traccar[16530]: #011at org.traccar.Main.run(Main.java:148)
Sep 30 06:25:08 track traccar[16530]: #011at org.traccar.Main.main(Main.java:112)
Sep 30 06:25:08 track traccar[16530]: Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:
Sep 30 06:25:08 track traccar[16530]: 1) [Guice/ErrorInjectingConstructor]: RuntimeException: Configuration file is not a valid XML document
Sep 30 06:25:08 track traccar[16530]:   at Config.<init>(Config.java:42)
Sep 30 06:25:08 track traccar[16530]:   at MainModule.configure(MainModule.java:98)
Sep 30 06:25:08 track traccar[16530]:   while locating Config
Sep 30 06:25:08 track traccar[16530]: Learn more:
Sep 30 06:25:08 track traccar[16530]:   https://github.com/google/guice/wiki/ERROR_INJECTING_CONSTRUCTOR
Sep 30 06:25:08 track traccar[16530]: 1 error
Sep 30 06:25:08 track traccar[16530]: ======================
Sep 30 06:25:08 track traccar[16530]: Full classname legend:
Sep 30 06:25:08 track traccar[16530]: ======================
Sep 30 06:25:08 track traccar[16530]: Config:           "org.traccar.config.Config"
Sep 30 06:25:08 track traccar[16530]: MainModule:       "org.traccar.MainModule"
Sep 30 06:25:08 track traccar[16530]: ========================
Sep 30 06:25:08 track traccar[16530]: End of classname legend:
Sep 30 06:25:08 track traccar[16530]: ========================
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:568)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:190)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:113)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.Guice.createInjector(Guice.java:87)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.Guice.createInjector(Guice.java:69)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.Guice.createInjector(Guice.java:59)
Sep 30 06:25:08 track traccar[16530]: #011at org.traccar.Main.run(Main.java:118)
Sep 30 06:25:08 track traccar[16530]: #011... 1 more
Sep 30 06:25:08 track traccar[16530]: Caused by: java.lang.RuntimeException: Configuration file is not a valid XML document
Sep 30 06:25:08 track traccar[16530]: #011at org.traccar.config.Config.<init>(Config.java:64)
Sep 30 06:25:08 track traccar[16530]: #011at org.traccar.config.Config$$FastClassByGuice$$5214659.GUICE$TRAMPOLINE(<generated>)
Sep 30 06:25:08 track traccar[16530]: #011at org.traccar.config.Config$$FastClassByGuice$$5214659.apply(<generated>)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:296)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:213)
Sep 30 06:25:08 track traccar[16530]: #011at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:186)
Sep 30 06:25:08 track traccar[16530]: #011... 6 more
Sep 30 06:25:08 track traccar[16530]: Caused by: java.util.InvalidPropertiesFormatException: jdk.internal.org.xml.sax.SAXParseException;
Sep 30 06:25:08 track traccar[16530]: #011at java.base/jdk.internal.util.xml.PropertiesDefaultHandler.load(PropertiesDefaultHandler.java:85)
Sep 30 06:25:08 track traccar[16530]: #011at java.base/java.util.Properties.loadFromXML(Properties.java:986)
Sep 30 06:25:08 track traccar[16530]: #011at org.traccar.config.Config.<init>(Config.java:46)
Sep 30 06:25:08 track traccar[16530]: #011... 17 more
Sep 30 06:25:08 track traccar[16530]: Caused by: jdk.internal.org.xml.sax.SAXParseException;
Sep 30 06:25:08 track traccar[16530]: #011at java.base/jdk.internal.util.xml.impl.ParserSAX.panic(ParserSAX.java:652)
Sep 30 06:25:08 track traccar[16530]: #011at java.base/jdk.internal.util.xml.impl.Parser.step(Parser.java:355)
Sep 30 06:25:08 track traccar[16530]: #011at java.base/jdk.internal.util.xml.impl.ParserSAX.parse(ParserSAX.java:508)
Sep 30 06:25:08 track traccar[16530]: #011at java.base/jdk.internal.util.xml.impl.ParserSAX.parse(ParserSAX.java:411)
Sep 30 06:25:08 track traccar[16530]: #011at java.base/jdk.internal.util.xml.impl.ParserSAX.parse(ParserSAX.java:374)
Sep 30 06:25:08 track traccar[16530]: #011at java.base/jdk.internal.util.xml.impl.SAXParserImpl.parse(SAXParserImpl.java:97)
Sep 30 06:25:08 track traccar[16530]: #011at java.base/jdk.internal.util.xml.PropertiesDefaultHandler.load(PropertiesDefaultHandler.java:83)
Sep 30 06:25:08 track traccar[16530]: #011... 19 more
Sep 30 06:25:08 track systemd[1]: traccar.service: Main process exited, code=exited, status=1/FAILURE
Sep 30 06:25:08 track systemd[1]: traccar.service: Unit entered failed state.
Sep 30 06:25:08 track systemd[1]: traccar.service: Failed with result 'exit-code'.
Sep 30 06:25:18 track systemd[1]: traccar.service: Service hold-off time over, scheduling restart.
Sep 30 06:25:18 track systemd[1]: Stopped traccar.
Sep 30 06:25:18 track systemd[1]: Started traccar.

/Glenn

Anton Tananaev2 years ago

The error message is:

Configuration file is not a valid XML document

Glenn Miler2 years ago

I got that, but i have not changed it :D how can i validate it ? is there a way i can extract the original ones ?

Anton Tananaev2 years ago

You haven't changed the config file? I don't believe that statement. Default configs are definitely valid XML.

Anton Tananaev2 years ago

Validate it using any XML validation tool. There are probably a million website where you can do it.

Glenn Miler2 years ago

I found the error, it was that the jdbc.Mysql can't handle ip it need to be a host name in front of the port, it is because after the provider broke my database, with power failure, they moved the backup one to an other instance, and it didnt have a url but only ip, but i just made an DNS record one of my domains and then directed it to that ip, now it is up and running again.

Anton Tananaev2 years ago

Wait. But you said you haven't changed the config files? Where did the error come from?

Glenn Miler2 years ago

Off course i changed the traccar.xml to point to my database

Configuration parameters for MySQL (replace [HOST], [DATABASE], [USER], [PASSWORD] with appropriate values; for local database use "localhost" as HOST)

This line, the [HOST] have to be an url like 12345.XX.COM etc. it can't be X.X.X.X as in IP for the database, i made an A record in one of my domains to point to that ip i got from my VPS provider with the new database instance on, and volia it worked.

Anton Tananaev2 years ago

That's again incorrect. You can totally use IP address for the database. It has nothing to do with the original error.

Glenn Miler2 years ago

Well that is what i did, and it worked sorry if it is not correct :D

Anton Tananaev2 years ago

It's always puzzling and frustrating to me why people try to hide information when they are asking for help.

Glenn Miler2 years ago

Well i am not hiding anything, could also be that i tried a backup of my files, but it still didnt worked, and i change to an URL instead of IP, i dont know why you dont belive me :D

Glenn Miler2 years ago

So what it could be, that the backup file worked, but i still need to change to an URL instead of an IP, either way, i guess the best thing is that everything is back online.

Anton Tananaev2 years ago

I got that, but i have not changed it

Off course i changed the traccar.xml

¯\_(ツ)_/¯

Glenn Miler2 years ago

Ahh that sentence :D yes true, that is off course changed, but i mean with that out of the ordinary :D and not since it worked i have changed it, only to ip. and then i got the error.

So what i mean by that sentence is, not changed it after it worked to some abscure format, or have mistaken pushed a wrong character some place, and saved the file etc. as i hashed checked the files, after upgrade.

But after the corrupted database, i couldnt get it to work, even changed to the new instance with the ip, still didnt worked, but worked after changed it to URL.

So i think that sentence is a matter of maybe me explaining me wrong, not counting for the not self explaining :D