traccar do not start after changeing the traccar.xml

jos7 months ago

Hi,

A question, i have changed the traccart.xml with a sms url now the services will not start.
So i did somthing wrong in the xml file.
This is my file:

    -->

    <entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://ipadress/traccar?zeroDateTimeBehavior=round&amp;serverTimezone=UTC&amp;allowPublicKeyRetrieval=true&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
    <entry key='database.user'>username</entry>
    <entry key='database.password'>password</entry>

    <entry key='web.url'>gps.careapp.nl</entry>

    <entry key='notificator.types'>web,mail,sms</entry>
    <entry key='sms.http.url'>https://service.speakup.nl/msgbroker/?username=username&password=password&originator=065.........&recipients=%phone%&message=%text%</entry>

    <entry key='mail.smtp.host'>smtp.gmail.com</entry>
    <entry key='mail.smtp.port'>465</entry>
    <entry key='mail.smtp.ssl.enable'>true</entry>
    <entry key='mail.smtp.from'>blaoost@gmail.com</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.username'>blaoost@gmail.com</entry>
    <entry key='mail.smtp.password'>password</entry> 

    <entry key='database.registerUnknown'>true</entry>
    <entry key='database.registerUnknown.defaultGroupId'>1</entry>
    
 </properties>

I have put in the sms part.

Anton Tananaev7 months ago

Your configuration is probably invalid XML. Remember that you need to escape certain characters.

Track-trace7 months ago

You solved it ? See that your server is online.

Ik zie dat je gps server weer online is.

jos7 months ago

If i remove the <entry key='sms.http.url'.............................. entry it is starting.
I a other post i have seen that the sms can work this way:

<entry key='sms.http.url'>https://service.speakup.nl/msgbroker/?username=username&password=password&originator=065.........&recipients=%phone%&message=%text%</entry>

I whas looking for a way to send a sms by a url.
my sms provider dos not have a api only a url.
If i put the url in my webbrowser it is working.
Can you help me to get this sms provider working?

jos7 months ago

Hoi Track-trace,

weet jij hoe ik een sms via een url werkend zou kunnen krijgen?

Anton Tananaev7 months ago

You have to replace & with &amp;, at least.

jos7 months ago

So like this:

<entry key='sms.http.url'>https://service.speakup.nl/msgbroker/?username=username&amp;password=password&amp;originator=065.........&amp;recipients=%phone%&amp;message=%text%</entry>

then sill if i put in this entry the traccar services will not run.

Anton Tananaev7 months ago

Make sure you validate the whole XML file with some tools.

jos7 months ago

if i do a xml validation the file is OK.

Anton Tananaev7 months ago

Try running Java command manually from a command line and see what error you're going to get.

jos7 months ago

If i run the java manually i get this:

root@Traccar:/opt/traccar#  ./jre/bin/java -jar ./tracker-server.jar ./conf/traccar.xml
Database is up to date, no changesets to execute

UPDATE SUMMARY
Run:                          0
Previously run:              46
Filtered out:                 0
-------------------------------
Total change sets:           46

Exception in thread "main" java.lang.RuntimeException: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) [Guice/ErrorInCustomProvider]: NullPointerException: Cannot invoke "String.trim()" because the return value of "org.traccar.config.Config.getString(org.traccar.config.ConfigKey)" is null
  at MainModule.provideSmsManager(MainModule.java:154)
  at BaseProtocol.setSmsManager(BaseProtocol.java:58)
      \_ for 1st parameter
  while locating Minifinder2Protocol
  at ServerManager.<init>(ServerManager.java:49)
  at ServerManager.class(ServerManager.java:42)
  while locating ServerManager

Learn more:
  https://github.com/google/guice/wiki/ERROR_IN_CUSTOM_PROVIDER

1 error

======================
Full classname legend:
======================
BaseProtocol:         "org.traccar.BaseProtocol"
MainModule:           "org.traccar.MainModule"
Minifinder2Protocol:  "org.traccar.protocol.Minifinder2Protocol"
ServerManager:        "org.traccar.ServerManager"
========================
End of classname legend:
========================

        at org.traccar.Main.run(Main.java:146)
        at org.traccar.Main.main(Main.java:110)
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) [Guice/ErrorInCustomProvider]: NullPointerException: Cannot invoke "String.trim()" because the return value of "org.traccar.config.Config.getString(org.traccar.config.ConfigKey)" is null
  at MainModule.provideSmsManager(MainModule.java:154)
  at BaseProtocol.setSmsManager(BaseProtocol.java:58)
      \_ for 1st parameter
  while locating Minifinder2Protocol
  at ServerManager.<init>(ServerManager.java:49)
  at ServerManager.class(ServerManager.java:42)
  while locating ServerManager

Learn more:
  https://github.com/google/guice/wiki/ERROR_IN_CUSTOM_PROVIDER

1 error

======================
Full classname legend:
======================
BaseProtocol:         "org.traccar.BaseProtocol"
MainModule:           "org.traccar.MainModule"
Minifinder2Protocol:  "org.traccar.protocol.Minifinder2Protocol"
ServerManager:        "org.traccar.ServerManager"
========================
End of classname legend:
========================

        at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:251)
        at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1151)
        at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1186)
        at org.traccar.Main.run(Main.java:124)
        ... 1 more
Caused by: java.lang.NullPointerException: Cannot invoke "String.trim()" because the return value of "org.traccar.config.Config.getString(org.traccar.config.ConfigKey)" is null
        at org.traccar.sms.HttpSmsClient.<init>(HttpSmsClient.java:59)
        at org.traccar.MainModule.provideSmsManager(MainModule.java:155)
        at org.traccar.MainModule$$FastClassByGuice$$de817.GUICE$TRAMPOLINE(<generated>)
        at org.traccar.MainModule$$FastClassByGuice$$de817.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.SingleMethodInjector.inject(SingleMethodInjector.java:84)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:146)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:124)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
        at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148)
        at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1186)
        at org.traccar.ServerManager.<init>(ServerManager.java:58)
        at org.traccar.ServerManager$$FastClassByGuice$$1d8b6ab.GUICE$TRAMPOLINE(<generated>)
        at org.traccar.ServerManager$$FastClassByGuice$$1d8b6ab.apply(<generated>)
        at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
        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.InjectorImpl$1.get(InjectorImpl.java:1148)
jos7 months ago

And this is my config:

<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.cj.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://10.2.2.14/traccar?zeroDateTimeBehavior=round&amp;serverTimezone=UTC&amp;allowPublicKeyRetrieval=true&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
    <entry key='database.user'>bla</entry>
    <entry key='database.password'>bla</entry>

    <entry key='web.url'>gps.careapp.nl</entry>

    <entry key='notificator.types'>web,mail,sms</entry>

    <entry key='mail.smtp.host'>smtp.gmail.com</entry>
    <entry key='mail.smtp.port'>465</entry>
    <entry key='mail.smtp.ssl.enable'>true</entry>
    <entry key='mail.smtp.from'>bla@gmail.com</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.username'>bla@gmail.com</entry>
    <entry key='mail.smtp.password'>password</entry>

    <entry key='sms.http.enable'>true</entry>
    <entry key='sms.http.url'>https://service.speakup.nl/msgbroker/?username=usernam..&amp;password=passwor..G&amp;originator=0658726563&amp;recipients=%phone%&amp;message=%text%</entry>

    <entry key='database.registerUnknown'>true</entry>
    <entry key='database.registerUnknown.defaultGroupId'>1</entry>
    
 </properties>
Anton Tananaev7 months ago

Your SMS configuration is wrong. It requires sms.http.template.

jos7 months ago
<entry key='sms.http.url'>https://service.speakup.nl/msgbroker/?username=username&amp;password=password&amp;originator=0658726563</entry>
<entry key='sms.http.template'>
    recipients={phone}&amp;message={message}
</entry>
jos7 months ago

Somthing like this:

<entry key='sms.http.url'>https://service.speakup.nl/msgbroker/?username=username&amp;password=password&amp;originator=0658726563</entry>
<entry key='sms.http.template'>
    recipients={phone}&amp;message={message}
</entry>