Error when building gradle project (non-zero exit value 1)

Cris Amende2 years ago

Hi,

I am trying to make some modifications to traccar 5.5 to include some more overlay layer, but having trouble building the project in Intellij.
Error message:

Process 'command 'C:/Program Files/Java/jdk-11.0.16.1/bin/java.exe'' finished with non-zero exit value 1

Here's the output log when ran with the --debug option:

2022-12-17T12:03:49.911+0100 [ERROR] [system.err] Exception in thread "main" java.lang.RuntimeException: Configuration file is not provided
2022-12-17T12:03:49.911+0100 [ERROR] [system.err] 	at org.traccar.Main.main(Main.java:88)
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':Main.main()'.
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Process 'command 'C:/Program Files/Java/jdk-11.0.16.1/bin/java.exe'' finished with non-zero exit value 1
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Run with --stacktrace option to get the stack trace.
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Run with --scan to get full insights.
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 
2022-12-17T12:03:49.937+0100 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 2s
12:03:50: Execution finished ':Main.main() --debug'.

When I run it with --scan option it stalls after 5-6 hours....

What could be the reason ?

Anton Tananaev2 years ago

Are you modifying the web app or the backend?

Cris Amende2 years ago

Ik have downloaded the traccar-master from github, the intention is to modify the web-app, I followed instructions from the "building from source" (https://www.traccar.org/build-in-intellij-idea/) page on this, as I understand, (please correct me if i'm wrong) I need to have the backend running in order to test new code...

Anton Tananaev2 years ago

You need to set "program arguments" to point to the config file.

Cris Amende2 years ago

hmm, that may indeed help, sorry for the ignorance....

ok, copied the default.xml and traccar.xml files from an existing (running) server and pointed the "Progam Arguments" to that location, initially 1 (self explanatory error) that ./logs/tracker-server.log did not exist, when comment out that line in the xml file, intellij returned with the same error "Finished with non-zero exit value"...

Anton Tananaev2 years ago

Why would you comment it out? You need to provide a valid config file, which requires logging configuration.

Cris Amende2 years ago

I believed the backend server would also run without logging, but appearantly not... oops...thanks for that.

Manually copied the log from an existing server running traccar, starts to progress now, but the next error:

Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:
java.lang.NullPointerException

does this have to do with the JRE setting, I don't have 1.8 so I have it on default in the configuration (Main)

Below a screen shot of the current "Configuration"

Configuration

Your great help, as always is highly appreciated.

Anton Tananaev2 years ago

You still have some configuration issue most likely.

Radar2 years ago

I am getting similar error in intellij idea and netbeans programs. It is not compiled in any way.

Execution failed for task ':compileJava'.
> invalid source release: 11

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileJava'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:142)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:140)
...
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
Anton Tananaev2 years ago

Radar, please don't duplicate your questions.

Cris Amende2 years ago

Any thoughts as what could be the issue. I tried running it with both local Mysql instance, with H2 database(local) and various other config setups... but sofar no luck....

Anton Tananaev2 years ago

Cris, what is the full error message you're getting?

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

1) [Guice/ErrorInCustomProvider]: NullPointerException
  at DatabaseModule.provideDataSource(DatabaseModule.java:46)
  at DatabaseStorage.<init>(DatabaseStorage.java:48)
      \_ for 2nd parameter
  while locating DatabaseStorage
  at MainModule.configure(MainModule.java:109)
  while locating Storage

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

1 error

======================
Full classname legend:
======================
DatabaseModule:       "org.traccar.storage.DatabaseModule"
DatabaseStorage:      "org.traccar.storage.DatabaseStorage"
MainModule:           "org.traccar.MainModule"
Storage:              "org.traccar.storage.Storage"
========================
End of classname legend:
========================

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

1) [Guice/ErrorInCustomProvider]: NullPointerException
  at DatabaseModule.provideDataSource(DatabaseModule.java:46)
  at DatabaseStorage.<init>(DatabaseStorage.java:48)
      \_ for 2nd parameter
  while locating DatabaseStorage
  at MainModule.configure(MainModule.java:109)
  while locating Storage

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

1 error

======================
Full classname legend:
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:

======================
DatabaseModule:       "org.traccar.storage.DatabaseModule"
DatabaseStorage:      "org.traccar.storage.DatabaseStorage"
MainModule:           "org.traccar.MainModule"
Storage:              "org.traccar.storage.Storage"
========================
End of classname legend:
========================

    at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:251)
    at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1104)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1139)
    at org.traccar.Main.run(Main.java:126)
    ... 1 more
Caused by: java.lang.NullPointerException
    at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
    at java.base/java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:1541)
    at java.base/java.lang.ClassLoader.getClassLoadingLock(ClassLoader.java:667)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:651)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at com.zaxxer.hikari.HikariConfig.attemptFromContextLoader(HikariConfig.java:967)
    at com.zaxxer.hikari.HikariConfig.setDriverClassName(HikariConfig.java:477)
    at org.traccar.storage.DatabaseModule.provideDataSource(DatabaseModule.java:67)
Caused by: java.lang.NullPointerException

    at org.traccar.storage.DatabaseModule$$FastClassByGuice$$2037865.GUICE$TRAMPOLINE(<generated>)
    at org.traccar.storage.DatabaseModule$$FastClassByGuice$$2037865.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:300)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:60)
    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:1101)
    ... 3 more

Not sure if this is all you need?

Anton Tananaev2 years ago

The error seems to indicate that you have not specified the config file at all.

Cris Amende2 years ago

It would indeed seem so, however, from earlier picture there is a specification in the Run/Debug Configurations.
Below is the file location:

File Location

default.xml is the standard default that comes with any instalation.
traccar.xml's contents shown below:

<?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.cj.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://localhost:3306/tbuild?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'>traccar</entry>
    <entry key='database.password'>Pa55word</entry>
-->
    <entry key='database.driver'>org.h2.Driver</entry>
    <entry key='database.url'>jdbc:h2:~/test</entry>
    <entry key='database.user'>sa</entry>
    <entry key='web.port'>7072</entry>
    <entry key='database.password'></entry>
</properties>

Obviously the MYSQL password is not the real password....
As you can see I tried running it with Mysql (Local) as well as H2, and also on a different port (8082 & 80 also did not work)
Firewall is open on both 7072 & 8082.